From fcb83bd16b8897ce82fb787645052df32826b26a Mon Sep 17 00:00:00 2001 From: discountry Date: Fri, 3 Oct 2025 15:28:16 +0800 Subject: [PATCH] commit --- .env.example | 17 + docs/backpack/openapi.json | 12447 ++++++++++++++++ .../examples/ccxt.pro/html/watchTicker.html | 51 + docs/ccxt/examples/ccxt.pro/js/apex-watch.js | 74 + ...-balance-snapshot-watch-balance-updates.js | 55 + .../ccxt.pro/js/binance-https-proxy.js | 48 + ...e-watch-ohlcv-many-symbols-continuously.js | 38 + .../js/binance-watch-ohlcv-many-symbols.js | 64 + .../js/binance-watch-ticker-many-symbols.js | 62 + .../ccxt.pro/js/build-ohlcv-many-symbols.js | 68 + .../js/calculate-ohlcvs-from-trades-warmup.js | 82 + .../js/calculate-ohlcvs-from-trades.js | 59 + .../ccxt.pro/js/exchange-capabitities.js | 72 + .../examples/ccxt.pro/js/exchange-close.js | 46 + .../js/gateio-swap-watch-many-orderbooks.js | 30 + .../ccxt.pro/js/gateio-watch-balance.js | 23 + .../ccxt.pro/js/gateio-watch-order-book.js | 71 + .../examples/ccxt.pro/js/graceful-shutdown.js | 43 + .../js/many-exchanges-many-streams.js | 37 + .../ccxt.pro/js/okex-create-futures-order.js | 48 + .../js/okex-watch-balance-and-create-order.js | 54 + .../examples/ccxt.pro/js/okx-watch-tickers.js | 31 + .../js/one-exchange-many-different-streams.js | 46 + .../js/one-exchange-many-streams-2.js | 26 + .../ccxt.pro/js/one-exchange-many-streams.js | 28 + .../js/socks-binance-watch-orderbook.js | 30 + ...h-fetch-many-exchanges-many-ordersbooks.js | 40 + .../watch-many-exchanges-many-ordersbooks.js | 38 + .../js/watch-many-exchanges-many-symbols.js | 40 + .../ccxt.pro/js/watch-many-orderbooks.js | 27 + .../ccxt.pro/js/watch-new-trades-only.js | 43 + .../examples/ccxt.pro/js/watch-new-trades.js | 42 + .../ccxt.pro/js/watch-trades-many-symbols.js | 29 + .../examples/ccxt.pro/js/watch-vs-fetch.js | 29 + .../php/many-exchanges-many-accounts.php | 76 + .../php/many-exchanges-synchronously.php | 27 + .../php/one-exchange-many-streams.php | 30 + ...ch-multiple-methods-multiple-exchanges.php | 41 + .../py/binance-create-order-cancel-order.py | 34 + ...-balance-snapshot-watch-balance-updates.py | 53 + .../py/binance-futures-watch-balance.py | 39 + .../py/binance-futures-watch-order-book.py | 22 + .../examples/ccxt.pro/py/binance-futures.py | 27 + .../ccxt.pro/py/binance-reload-markets.py | 42 + .../ccxt.pro/py/binance-spot-and-futures.py | 73 + .../py/binance-watch-many-orderbooks.py | 51 + .../py/binance-watch-margin-balance.py | 40 + .../ccxt.pro/py/binance-watch-ohlcv.py | 43 + ...nce-watch-order-book-individual-updates.py | 34 + .../binance-watch-orderbook-watch-balance.py | 63 + .../py/binance-watch-orders-being-placed.py | 59 + ...atch-spot-futures-balances-continuously.py | 48 + .../ccxt.pro/py/bitmex_watch_ohlcv.py | 41 + .../py/bitmex_watch_ticker_and_ohlcv.py | 73 + .../ccxt.pro/py/bitvavo-watch-order-book.py | 23 + .../ccxt.pro/py/build-ohlcv-many-symbols.py | 53 + .../ccxt.pro/py/coinbase-watch-all-trades.py | 30 + .../ccxt.pro/py/coinbase-watch-trades.py | 27 + .../ccxt.pro/py/consume-all-trades.py | 22 + .../ccxt.pro/py/gateio-watch-trades.py | 25 + .../py/intercept-original-ohlcv-updates.py | 31 + .../py/kucoin-watch-multiple-orderbooks.py | 31 + .../many-exchanges-many-different-streams.py | 56 + ...-exchanges-many-orderbooks-synchronized.py | 59 + ...any-exchanges-many-orderbooks-throttled.py | 56 + .../many-exchanges-many-streams-with-keys.py | 83 + .../py/many-exchanges-many-streams.py | 36 + ...any-exchanges-many-symbols-watch-trades.py | 39 + .../examples/ccxt.pro/py/many-exchanges.py | 30 + ...-exchanges-watch-orderbook-continuously.py | 34 + .../ccxt.pro/py/okex-create-swap-order.py | 50 + .../okex-watch-margin-balance-with-params.py | 35 + .../ccxt.pro/py/okex-watch-margin-balance.py | 37 + docs/ccxt/examples/ccxt.pro/py/okx-bbo-tbt.py | 36 + .../ccxt.pro/py/on-connected-user-hook.py | 55 + .../py/one-exchange-different-streams.py | 35 + .../ccxt.pro/py/one-exchange-many-streams.py | 25 + .../ccxt.pro/py/phemex-cancel-all-orders.py | 23 + .../py/spot-vs-future-arbitrage-bitmart.py | 66 + .../examples/ccxt.pro/py/watch-all-symbols.py | 35 + .../watch-custom-exchange-specific-streams.py | 45 + .../py/watch-many-exchanges-many-tickers.py | 39 + .../ccxt.pro/py/watch-ticker-to-csv.py | 45 + docs/ccxt/examples/html/basic-cors-proxy.html | 46 + .../ccxt/examples/html/basic-inheritance.html | 47 + docs/ccxt/examples/html/basic-poller.html | 52 + .../examples/html/basic-rate-limiting.html | 49 + docs/ccxt/examples/html/basic.html | 43 + .../examples/html/binance-cors-proxy.html | 28 + .../html/bitmex-browser-cors-proxy.js | 7 + docs/ccxt/examples/html/bitmex-cors.html | 46 + .../examples/html/tradingview-charts.html | 61 + docs/ccxt/examples/html/webworker/index.html | 97 + docs/ccxt/examples/html/webworker/worker.js | 43 + docs/ccxt/examples/js/README.md | 15 + .../examples/js/advanced-error-handling.js | 39 + docs/ccxt/examples/js/aggregate-orderbook.js | 54 + docs/ccxt/examples/js/apex-example.js | 97 + docs/ccxt/examples/js/arbitrage-pairs.js | 130 + docs/ccxt/examples/js/basic-chart.js | 29 + .../examples/js/basic-orderbook-polling.js | 13 + docs/ccxt/examples/js/bcc-vs-bch.js | 115 + docs/ccxt/examples/js/benchmark.js | 104 + .../examples/js/binance-fetch-all-deposits.js | 45 + ...ce-fetch-ohlcv-many-symbols-async-await.js | 34 + ...lcv-many-symbols-promise-then-callbacks.js | 33 + .../binance-fetchTicker-delivery-vs-future.js | 31 + ...res-transfer-from-sub-account-to-master.js | 41 + .../examples/js/binance-margin-stop-order.js | 39 + docs/ccxt/examples/js/binance-server-time.js | 34 + .../examples/js/binance-universal-transfer.js | 16 + .../ccxt/examples/js/bitfinex-fetch-trades.js | 35 + .../examples/js/bitfinex2-fetch-trades.js | 35 + .../examples/js/bitmex-browser-cors-proxy.js | 7 + .../js/bitpanda-fetchMyTrades-reduce.js | 36 + docs/ccxt/examples/js/bitrue-fetch-balance.js | 28 + docs/ccxt/examples/js/bitstamp-private-api.js | 115 + docs/ccxt/examples/js/bitstamp-public-api.js | 39 + docs/ccxt/examples/js/bittrex-balance.js | 50 + .../js/bittrex-fetch-closed-orders-history.js | 69 + .../examples/js/blockchaincom-withdrawal.js | 59 + docs/ccxt/examples/js/build-ohlcv-bars.js | 48 + .../js/builtin-rate-limiting-rest-poller.js | 25 + docs/ccxt/examples/js/bybit-trailing.js | 62 + docs/ccxt/examples/js/bybit-updated.cjs | 154 + .../js/coinbase-fetch-all-balances.js | 38 + ...sit-addresses-using-fetchDepositAddress.js | 47 + docs/ccxt/examples/js/coinex-futures.js | 75 + .../ccxt/examples/js/coinone-fetch-tickers.js | 54 + docs/ccxt/examples/js/coinone-markets.js | 16 + .../js/compare-two-exchanges-capabilities.js | 36 + docs/ccxt/examples/js/cors-proxy.js | 5 + .../examples/js/create-order-handle-errors.js | 55 + ...order-position-with-takeprofit-stoploss.js | 71 + .../examples/js/create-order-with-retry.js | 65 + .../examples/js/create-order-ws-example.js | 25 + .../ccxt/examples/js/create-orders-example.js | 17 + .../js/create-trailing-amount-order.js | 36 + .../js/create-trailing-percent-order.js | 36 + docs/ccxt/examples/js/credentials.json | 5 + .../examples/js/custom-proxy-agent-for-js.js | 12 + docs/ccxt/examples/js/custom-proxy-url.js | 23 + ...ta-maintenance-margin-rate-max-leverage.js | 60 + docs/ccxt/examples/js/env-variables.js | 26 + docs/ccxt/examples/js/error-handling.js | 89 + .../ccxt/examples/js/exchange-capabilities.js | 135 + docs/ccxt/examples/js/exchanges-by-volume.js | 60 + docs/ccxt/examples/js/exchanges.js | 40 + docs/ccxt/examples/js/fetch-all-balances.js | 219 + .../js/fetch-all-tickers-to-files-2.js | 53 + .../examples/js/fetch-all-tickers-to-files.js | 77 + docs/ccxt/examples/js/fetch-balance.js | 28 + .../js/fetch-create-deposit-address.js | 101 + .../js/fetch-first-ohlcv-timestamp.js | 79 + ...etch-from-many-exchanges-simultaneously.js | 21 + .../examples/js/fetch-funding-rate-history.js | 25 + .../js/fetch-futures/prettier.config.js | 5 + .../examples/js/fetch-futures/src/index.js | 25 + .../fetch-ohlcv-from-to-mark-index-premium.js | 72 + .../fetch-ohlcv-many-exchanges-continuosly.js | 39 + docs/ccxt/examples/js/fetch-ohlcv.js | 16 + docs/ccxt/examples/js/fetch-okex-futures.js | 22 + docs/ccxt/examples/js/fetch-orders.js | 27 + .../fetch-ticker-from-multiple-exchanges.js | 35 + .../js/fetch-ticker-where-available.js | 75 + .../examples/js/fetch-tickers/build/index.js | 19 + .../js/fetch-tickers/prettier.config.js | 5 + .../examples/js/fetch-tickers/src/index.js | 17 + .../examples/js/gateio-create-batch-order.js | 43 + docs/ccxt/examples/js/gateio-futures.js | 49 + .../examples/js/gateio-open-close-contract.js | 49 + docs/ccxt/examples/js/gateio-swaps.js | 74 + .../js/gdax-fetch-trades-pagination.js | 29 + docs/ccxt/examples/js/hibachi-example.js | 113 + docs/ccxt/examples/js/hitbtc2-withdraw.js | 61 + .../js/how-to-import-one-exchange-esm.js | 10 + docs/ccxt/examples/js/huobi-futures.js | 71 + .../examples/js/huobi-open-close-contract.js | 63 + docs/ccxt/examples/js/huobi-swaps.js | 70 + ...ro-market-buy-sell-fetch-trading-limits.js | 98 + docs/ccxt/examples/js/hybridCJSExample.cjs | 19 + docs/ccxt/examples/js/hybridESMExample.js | 19 + docs/ccxt/examples/js/idex-fetch-balance.js | 13 + .../examples/js/instantiate-all-at-once.js | 46 + .../examples/js/instantiate-all-from-json.js | 31 + .../js/kraken-create-and-close-position.js | 54 + .../examples/js/kraken-fetch-order-trades.js | 33 + .../ccxt/examples/js/kraken-margin-trading.js | 89 + docs/ccxt/examples/js/kucoin-rate-limit.js | 38 + docs/ccxt/examples/js/latoken-example.js | 108 + docs/ccxt/examples/js/live-orderbook.js | 106 + docs/ccxt/examples/js/live-ticker.js | 80 + docs/ccxt/examples/js/live-tickers.js | 74 + docs/ccxt/examples/js/load-all-contracts.js | 41 + .../examples/js/load-all-symbols-at-once.js | 69 + .../examples/js/load-all-tickers-at-once.js | 91 + .../ccxt/examples/js/load-markets-to-files.js | 57 + ...-over-all-symbols-of-specific-exchanges.js | 61 + ...-over-specific-symbols-of-all-exchanges.js | 91 + .../js/margin-loan-borrow-buy-sell-repay.js | 70 + .../js/market-status-and-currency-status.js | 29 + docs/ccxt/examples/js/ohlcv-console-chart.js | 29 + .../js/okex-fetch-closed-orders-archive.js | 31 + docs/ccxt/examples/js/okex-transfer.js | 51 + .../examples/js/okx-poll-fetch-my-trades.js | 37 + docs/ccxt/examples/js/okx-poll-rate-limit.js | 48 + .../js/order-book-extra-level-depth-param.js | 20 + ...order-position-with-takeprofit-stoploss.js | 49 + docs/ccxt/examples/js/poll-ohlcv.js | 43 + .../examples/js/poloniex-fetch-order-books.js | 35 + .../examples/js/poloniex-limits-amount-min.js | 62 + docs/ccxt/examples/js/proxy-round-robin.js | 98 + docs/ccxt/examples/js/proxy-usage.js | 40 + .../js/sample-local-proxy-server-with-cors.js | 12 + docs/ccxt/examples/js/search-all-exchanges.js | 166 + docs/ccxt/examples/js/shared-load-markets.js | 80 + ...ort-swap-markets-by-hourly-price-change.js | 55 + docs/ccxt/examples/js/symbols.js | 110 + docs/ccxt/examples/js/theocean.js | 41 + docs/ccxt/examples/js/tickers.js | 106 + .../examples/js/validate-paginated-data.js | 61 + .../examples/js/watch-OHLCV-For-Symbols.js | 15 + docs/ccxt/examples/js/watch-OHLCV.js | 12 + .../js/watch-OrderBook-For-Symbols.js | 11 + .../examples/js/watch-Trades-For-Symbols.js | 11 + docs/ccxt/examples/js/watch-tickers.js | 11 + docs/ccxt/examples/js/watchOHLCVForSymbols.js | 15 + .../examples/js/watchOrderBookForSymbols.js | 11 + ...hPositions-many-exchanges-continuosly.d.ts | 2 + ...itions-many-exchanges-continuosly.d.ts.map | 1 + ...tchPositions-many-exchanges-continuosly.js | 49 + docs/ccxt/examples/js/watchPositions.d.ts | 2 + docs/ccxt/examples/js/watchPositions.d.ts.map | 1 + docs/ccxt/examples/js/watchPositions.js | 13 + .../examples/js/watchPositionsForSymbols.d.ts | 2 + .../js/watchPositionsForSymbols.d.ts.map | 1 + .../examples/js/watchPositionsForSymbols.js | 14 + .../ccxt/examples/js/watchTradesForSymbols.js | 11 + .../withdraw-from-one-exchange-to-another.js | 50 + docs/ccxt/examples/ts/.eslintrc | 111 + docs/ccxt/examples/ts/benchmark.ts | 134 + docs/ccxt/examples/ts/build-ohlcv-bars.ts | 53 + .../ts/compare-two-exchanges-capabilities.ts | 36 + ...order-position-with-takeprofit-stoploss.ts | 89 + .../examples/ts/create-order-ws-example.ts | 33 + .../ccxt/examples/ts/create-orders-example.ts | 21 + .../ts/create-trailing-amount-order.ts | 37 + .../ts/create-trailing-percent-order.ts | 37 + .../examples/ts/custom-proxy-agent-for-js.ts | 12 + .../ts/fetch-first-ohlcv-timestamp.ts | 88 + .../ccxt/examples/ts/fetch-futures/.gitignore | 1 + .../ts/fetch-futures/package-lock.json | 116 + .../examples/ts/fetch-futures/package.json | 34 + .../ts/fetch-futures/prettier.config.js | 4 + .../examples/ts/fetch-futures/src/index.ts | 28 + .../examples/ts/fetch-futures/tsconfig.json | 28 + .../fetch-ohlcv-many-exchanges-continuosly.ts | 44 + docs/ccxt/examples/ts/fetch-ohlcv.ts | 17 + .../ccxt/examples/ts/fetch-tickers/.gitignore | 1 + .../ts/fetch-tickers/package-lock.json | 116 + .../examples/ts/fetch-tickers/package.json | 34 + .../ts/fetch-tickers/prettier.config.js | 4 + .../examples/ts/fetch-tickers/src/index.ts | 21 + .../examples/ts/fetch-tickers/tsconfig.json | 28 + docs/ccxt/examples/ts/hibachi-example.ts | 137 + .../ts/how-to-import-one-exchange-esm.ts | 11 + .../ts/kraken-create-and-close-position.ts | 69 + .../ts/margin-loan-borrow-buy-sell-repay.ts | 72 + .../ts/nextjs-page-router/.eslintrc.json | 3 + .../examples/ts/nextjs-page-router/.gitignore | 36 + .../examples/ts/nextjs-page-router/README.md | 43 + .../ts/nextjs-page-router/next.config.js | 6 + .../ts/nextjs-page-router/package-lock.json | 8052 ++++++++++ .../ts/nextjs-page-router/package.json | 28 + .../ts/nextjs-page-router/postcss.config.js | 6 + .../ts/nextjs-page-router/public/favicon.ico | Bin 0 -> 25930 bytes .../ts/nextjs-page-router/src/pages/_app.tsx | 6 + .../src/pages/_document.tsx | 13 + .../nextjs-page-router/src/pages/balance.tsx | 46 + .../ts/nextjs-page-router/src/pages/index.tsx | 8 + .../nextjs-page-router/src/pages/tickers.tsx | 61 + .../nextjs-page-router/src/styles/globals.css | 27 + .../ts/nextjs-page-router/tailwind.config.ts | 20 + .../ts/nextjs-page-router/tsconfig.json | 22 + ...order-position-with-takeprofit-stoploss.ts | 62 + docs/ccxt/examples/ts/proxy-usage.ts | 49 + .../ts/sample-local-proxy-server-with-cors.ts | 15 + .../examples/ts/watch-OHLCV-For-Symbols.ts | 17 + docs/ccxt/examples/ts/watch-OHLCV.ts | 14 + .../ts/watch-OrderBook-For-Symbols.ts | 13 + .../examples/ts/watch-Trades-For-Symbols.ts | 13 + docs/ccxt/examples/ts/watch-tickers.ts | 13 + ...tchPositions-many-exchanges-continuosly.ts | 53 + docs/ccxt/examples/ts/watchPositions.ts | 15 + .../examples/ts/watchPositionsForSymbols.ts | 16 + docs/ccxt/wiki/.nojekyll | 0 docs/ccxt/wiki/Awesome.md | 188 + docs/ccxt/wiki/CHANGELOG.md | 1 + docs/ccxt/wiki/CLI.md | 156 + docs/ccxt/wiki/CONTRIBUTING.md | 1 + docs/ccxt/wiki/Certification.md | 11 + docs/ccxt/wiki/Examples.md | 54 + docs/ccxt/wiki/Exchange-Markets-By-Country.md | 118 + docs/ccxt/wiki/Exchange-Markets.md | 109 + docs/ccxt/wiki/FAQ.md | 172 + docs/ccxt/wiki/Install.md | 235 + docs/ccxt/wiki/Manual.md | 7347 +++++++++ docs/ccxt/wiki/README.md | 97 + docs/ccxt/wiki/Requirements.md | 47 + docs/ccxt/wiki/Stats.md | 62 + docs/ccxt/wiki/_coverpage.md | 14 + docs/ccxt/wiki/_sidebar.md | 109 + docs/ccxt/wiki/basePartials/body.hbs | 29 + docs/ccxt/wiki/basePartials/deprecated.hbs | 3 + docs/ccxt/wiki/basePartials/docs.hbs | 4 + docs/ccxt/wiki/basePartials/header.hbs | 9 + .../wiki/basePartials/member-index-list.hbs | 6 + docs/ccxt/wiki/basePartials/members.hbs | 9 + docs/ccxt/wiki/basePartials/params-table.hbs | 12 + docs/ccxt/wiki/basePartials/returns.hbs | 12 + docs/ccxt/wiki/baseSpec.md | 7663 ++++++++++ docs/ccxt/wiki/ccxt.pro.manual.md | 1318 ++ docs/ccxt/wiki/ccxt.pro.md | 44 + docs/ccxt/wiki/examples/js/README.md | 303 + .../examples/js/advanced-error-handling.md | 45 + .../wiki/examples/js/aggregate-orderbook.md | 59 + docs/ccxt/wiki/examples/js/apex-example.md | 103 + docs/ccxt/wiki/examples/js/arbitrage-pairs.md | 135 + docs/ccxt/wiki/examples/js/basic-chart.md | 34 + .../examples/js/basic-orderbook-polling.md | 18 + docs/ccxt/wiki/examples/js/bcc-vs-bch.md | 121 + docs/ccxt/wiki/examples/js/benchmark.md | 110 + .../examples/js/binance-fetch-all-deposits.md | 50 + ...ce-fetch-ohlcv-many-symbols-async-await.md | 39 + ...lcv-many-symbols-promise-then-callbacks.md | 38 + .../binance-fetchTicker-delivery-vs-future.md | 36 + ...res-transfer-from-sub-account-to-master.md | 47 + .../examples/js/binance-margin-stop-order.md | 45 + .../wiki/examples/js/binance-server-time.md | 40 + .../examples/js/binance-universal-transfer.md | 22 + .../wiki/examples/js/bitfinex-fetch-trades.md | 40 + .../examples/js/bitfinex2-fetch-trades.md | 40 + .../examples/js/bitmex-browser-cors-proxy.md | 13 + .../js/bitpanda-fetchMyTrades-reduce.md | 41 + .../wiki/examples/js/bitrue-fetch-balance.md | 34 + .../wiki/examples/js/bitstamp-private-api.md | 120 + .../wiki/examples/js/bitstamp-public-api.md | 44 + docs/ccxt/wiki/examples/js/bittrex-balance.md | 55 + .../js/bittrex-fetch-closed-orders-history.md | 75 + .../examples/js/blockchaincom-withdrawal.md | 65 + .../ccxt/wiki/examples/js/build-ohlcv-bars.md | 54 + .../js/builtin-rate-limiting-rest-poller.md | 30 + docs/ccxt/wiki/examples/js/bybit-trailing.md | 67 + docs/ccxt/wiki/examples/js/bybit-updated.md | 159 + .../js/coinbase-fetch-all-balances.md | 44 + ...sit-addresses-using-fetchDepositAddress.md | 53 + docs/ccxt/wiki/examples/js/coinex-futures.md | 80 + .../wiki/examples/js/coinone-fetch-tickers.md | 60 + docs/ccxt/wiki/examples/js/coinone-markets.md | 22 + .../js/compare-two-exchanges-capabilities.md | 42 + docs/ccxt/wiki/examples/js/cors-proxy.md | 11 + .../examples/js/create-order-handle-errors.md | 61 + ...order-position-with-takeprofit-stoploss.md | 77 + .../examples/js/create-order-with-retry.md | 71 + .../examples/js/create-order-ws-example.md | 31 + .../wiki/examples/js/create-orders-example.md | 23 + .../js/create-trailing-amount-order.md | 42 + .../js/create-trailing-percent-order.md | 42 + docs/ccxt/wiki/examples/js/credentials.md | 11 + .../examples/js/custom-proxy-agent-for-js.md | 18 + .../ccxt/wiki/examples/js/custom-proxy-url.md | 28 + ...ta-maintenance-margin-rate-max-leverage.md | 66 + docs/ccxt/wiki/examples/js/env-variables.md | 32 + docs/ccxt/wiki/examples/js/error-handling.md | 94 + .../wiki/examples/js/exchange-capabilities.md | 141 + .../wiki/examples/js/exchanges-by-volume.md | 65 + docs/ccxt/wiki/examples/js/exchanges.md | 46 + .../wiki/examples/js/fetch-all-balances.md | 225 + .../js/fetch-all-tickers-to-files-2.md | 58 + .../examples/js/fetch-all-tickers-to-files.md | 83 + docs/ccxt/wiki/examples/js/fetch-balance.md | 33 + .../js/fetch-create-deposit-address.md | 106 + .../js/fetch-first-ohlcv-timestamp.md | 85 + ...etch-from-many-exchanges-simultaneously.md | 26 + .../examples/js/fetch-funding-rate-history.md | 31 + .../fetch-ohlcv-from-to-mark-index-premium.md | 78 + .../fetch-ohlcv-many-exchanges-continuosly.md | 45 + docs/ccxt/wiki/examples/js/fetch-ohlcv.md | 22 + .../wiki/examples/js/fetch-okex-futures.md | 28 + docs/ccxt/wiki/examples/js/fetch-orders.md | 32 + .../fetch-ticker-from-multiple-exchanges.md | 40 + .../js/fetch-ticker-where-available.md | 80 + .../examples/js/gateio-create-batch-order.md | 48 + docs/ccxt/wiki/examples/js/gateio-futures.md | 55 + .../examples/js/gateio-open-close-contract.md | 55 + docs/ccxt/wiki/examples/js/gateio-swaps.md | 80 + .../js/gdax-fetch-trades-pagination.md | 35 + docs/ccxt/wiki/examples/js/hibachi-example.md | 119 + .../ccxt/wiki/examples/js/hitbtc2-withdraw.md | 66 + .../js/how-to-import-one-exchange-esm.md | 16 + docs/ccxt/wiki/examples/js/huobi-futures.md | 77 + .../examples/js/huobi-open-close-contract.md | 69 + docs/ccxt/wiki/examples/js/huobi-swaps.md | 76 + ...ro-market-buy-sell-fetch-trading-limits.md | 103 + .../ccxt/wiki/examples/js/hybridCJSExample.md | 24 + .../ccxt/wiki/examples/js/hybridESMExample.md | 24 + .../wiki/examples/js/idex-fetch-balance.md | 19 + .../examples/js/instantiate-all-at-once.md | 52 + .../examples/js/instantiate-all-from-json.md | 37 + .../js/kraken-create-and-close-position.md | 60 + .../examples/js/kraken-fetch-order-trades.md | 39 + .../wiki/examples/js/kraken-margin-trading.md | 94 + .../wiki/examples/js/kucoin-rate-limit.md | 44 + docs/ccxt/wiki/examples/js/latoken-example.md | 113 + docs/ccxt/wiki/examples/js/live-orderbook.md | 111 + docs/ccxt/wiki/examples/js/live-ticker.md | 85 + docs/ccxt/wiki/examples/js/live-tickers.md | 79 + .../wiki/examples/js/load-all-contracts.md | 46 + .../examples/js/load-all-symbols-at-once.md | 75 + .../examples/js/load-all-tickers-at-once.md | 97 + .../wiki/examples/js/load-markets-to-files.md | 63 + ...-over-all-symbols-of-specific-exchanges.md | 67 + ...-over-specific-symbols-of-all-exchanges.md | 97 + .../js/margin-loan-borrow-buy-sell-repay.md | 76 + .../js/market-status-and-currency-status.md | 35 + .../wiki/examples/js/ohlcv-console-chart.md | 34 + .../js/okex-fetch-closed-orders-archive.md | 36 + docs/ccxt/wiki/examples/js/okex-transfer.md | 56 + .../examples/js/okx-poll-fetch-my-trades.md | 42 + .../wiki/examples/js/okx-poll-rate-limit.md | 54 + .../js/order-book-extra-level-depth-param.md | 25 + ...order-position-with-takeprofit-stoploss.md | 55 + docs/ccxt/wiki/examples/js/poll-ohlcv.md | 48 + .../examples/js/poloniex-fetch-order-books.md | 41 + .../examples/js/poloniex-limits-amount-min.md | 67 + .../wiki/examples/js/proxy-round-robin.md | 104 + docs/ccxt/wiki/examples/js/proxy-usage.md | 46 + .../js/sample-local-proxy-server-with-cors.md | 18 + .../wiki/examples/js/search-all-exchanges.md | 172 + .../wiki/examples/js/shared-load-markets.md | 86 + ...ort-swap-markets-by-hourly-price-change.md | 61 + docs/ccxt/wiki/examples/js/symbols.md | 115 + docs/ccxt/wiki/examples/js/theocean.md | 47 + docs/ccxt/wiki/examples/js/tickers.md | 112 + .../examples/js/validate-paginated-data.md | 66 + .../examples/js/watch-OHLCV-For-Symbols.md | 21 + docs/ccxt/wiki/examples/js/watch-OHLCV.md | 18 + .../js/watch-OrderBook-For-Symbols.md | 17 + .../examples/js/watch-Trades-For-Symbols.md | 17 + docs/ccxt/wiki/examples/js/watch-tickers.md | 17 + .../wiki/examples/js/watchOHLCVForSymbols.md | 21 + .../examples/js/watchOrderBookForSymbols.md | 17 + ...hPositions-many-exchanges-continuosly.d.md | 7 + ...sitions-many-exchanges-continuosly.d.ts.md | 6 + ...tchPositions-many-exchanges-continuosly.md | 55 + .../ccxt/wiki/examples/js/watchPositions.d.md | 7 + .../wiki/examples/js/watchPositions.d.ts.md | 6 + docs/ccxt/wiki/examples/js/watchPositions.md | 19 + .../examples/js/watchPositionsForSymbols.d.md | 7 + .../js/watchPositionsForSymbols.d.ts.md | 6 + .../examples/js/watchPositionsForSymbols.md | 20 + .../wiki/examples/js/watchTradesForSymbols.md | 17 + .../withdraw-from-one-exchange-to-another.md | 56 + docs/ccxt/wiki/examples/php/README.md | 160 + .../ccxt/wiki/examples/php/arbitrage-pairs.md | 144 + .../php/async-await-fetch-multiple.md | 28 + .../wiki/examples/php/async-await-fetch.md | 64 + .../wiki/examples/php/basic-error-handling.md | 31 + docs/ccxt/wiki/examples/php/basic-order.md | 42 + ...ance-create-order-stop-loss-take-profit.md | 55 + ...fetch-all-trades-for-all-traded-symbols.md | 113 + .../wiki/examples/php/binance-oco-order.md | 69 + .../php/binance-set-futures-leverage.md | 41 + .../examples/php/binance-spot-trailing.md | 79 + .../php/bitfinex2-fetch-ohlcv-since-limit.md | 32 + .../examples/php/bitfinex2-fetch-ohlcv.md | 24 + .../php/bitfinex2-fetch-trades-since.md | 26 + .../wiki/examples/php/bitmex-create-order.md | 31 + .../wiki/examples/php/build-ohlcv-bars.md | 80 + .../php/built-in-rate-limiting-poller.md | 24 + docs/ccxt/wiki/examples/php/bybit-updated.md | 180 + .../examples/php/bytetrade-create-order.md | 32 + .../php/cache-exchange-instance-reuse.md | 34 + docs/ccxt/wiki/examples/php/cancel-order.md | 41 + docs/ccxt/wiki/examples/php/cli.md | 210 + .../php/coinbase-fetch-all-balances.md | 45 + .../php/coinbasepro-cursor-pagination.md | 53 + .../ccxt/wiki/examples/php/coinone-markets.md | 20 + .../php/compare-two-exchanges-capabilities.md | 61 + ...order-position-with-takeprofit-stoploss.md | 90 + .../examples/php/create-order-ws-example.md | 52 + .../examples/php/create-orders-example.md | 52 + .../php/create-trailing-amount-order.md | 61 + .../php/create-trailing-percent-order.md | 61 + .../examples/php/error-handling-message.md | 56 + .../wiki/examples/php/exchange-properties.md | 65 + docs/ccxt/wiki/examples/php/fetch-balance.md | 28 + .../php/fetch-first-ohlcv-timestamp.md | 108 + .../fetch-ohlcv-many-exchanges-continuosly.md | 75 + docs/ccxt/wiki/examples/php/fetch-ohlcv.md | 44 + docs/ccxt/wiki/examples/php/fetch-order.md | 95 + docs/ccxt/wiki/examples/php/fetch-ticker.md | 45 + docs/ccxt/wiki/examples/php/fetch-tickers.md | 46 + docs/ccxt/wiki/examples/php/gateio-futures.md | 54 + docs/ccxt/wiki/examples/php/gateio-swaps.md | 91 + .../wiki/examples/php/huobi-fetch-balance.md | 32 + docs/ccxt/wiki/examples/php/huobi-futures.md | 53 + docs/ccxt/wiki/examples/php/huobi-swaps.md | 48 + ...fetch-balance-create-order-cancel-order.md | 68 + .../php/kraken-create-and-close-position.md | 77 + .../wiki/examples/php/kraken-query-ledgers.md | 34 + .../php/kucoin-fetch-all-deposit-addresses.md | 93 + .../php/kucoin-implicit-inner-transfer-v1.md | 126 + .../ccxt/wiki/examples/php/latoken-example.md | 116 + .../examples/php/load-all-at-once-async.md | 62 + .../wiki/examples/php/load-all-at-once.md | 45 + .../php/margin-loan-borrow-buy-sell-repay.md | 115 + .../examples/php/method-overload-override.md | 38 + docs/ccxt/wiki/examples/php/nonce-override.md | 35 + .../php/order-book-level-depth-extra-param.md | 19 + ...order-position-with-takeprofit-stoploss.md | 72 + docs/ccxt/wiki/examples/php/proxy-usage.md | 77 + .../php/react-eventloop-with-rate-limiting.md | 34 + .../sample-local-proxy-server-with-cors.md | 77 + docs/ccxt/wiki/examples/php/shared-markets.md | 58 + docs/ccxt/wiki/examples/php/symbols.md | 87 + docs/ccxt/wiki/examples/php/trading-view.md | 33 + .../examples/php/watch-OHLCV-For-Symbols.md | 38 + docs/ccxt/wiki/examples/php/watch-OHLCV.md | 39 + .../php/watch-OrderBook-For-Symbols.md | 38 + .../examples/php/watch-Trades-For-Symbols.md | 38 + docs/ccxt/wiki/examples/php/watch-tickers.md | 38 + .../wiki/examples/php/watchOHLCVForSymbols.md | 38 + .../examples/php/watchOrderBookForSymbols.md | 38 + ...tchPositions-many-exchanges-continuosly.md | 85 + docs/ccxt/wiki/examples/php/watchPositions.md | 40 + .../examples/php/watchPositionsForSymbols.md | 41 + .../examples/php/watchTradesForSymbols.md | 38 + docs/ccxt/wiki/examples/py/README.md | 491 + .../py/aiohttp-custom-session-connector.md | 31 + docs/ccxt/wiki/examples/py/all-exchanges.md | 25 + docs/ccxt/wiki/examples/py/arbitrage-pairs.md | 136 + docs/ccxt/wiki/examples/py/asciichart.md | 70 + .../async-analyse-augur-v1-vs-v2-exchanges.md | 92 + .../examples/py/async-balance-coinbasepro.md | 29 + .../wiki/examples/py/async-balance-gdax.md | 29 + docs/ccxt/wiki/examples/py/async-balance.md | 27 + docs/ccxt/wiki/examples/py/async-balances.md | 36 + .../wiki/examples/py/async-basic-callchain.md | 81 + .../wiki/examples/py/async-basic-orderbook.md | 33 + .../examples/py/async-basic-rate-limiter.md | 25 + docs/ccxt/wiki/examples/py/async-basic.md | 25 + .../py/async-binance-cancel-option-order.md | 44 + .../py/async-binance-create-margin-order.md | 44 + .../py/async-binance-create-option-order.md | 53 + ...c-binance-create-trailing-percent-order.md | 53 + ...nance-fetch-margin-balance-with-options.md | 39 + ...inance-fetch-margin-balance-with-params.md | 34 + .../py/async-binance-fetch-option-OHLCV.md | 48 + .../py/async-binance-fetch-option-details.md | 39 + .../py/async-binance-fetch-option-order.md | 46 + .../async-binance-fetch-option-orderbook.md | 44 + .../py/async-binance-fetch-option-position.md | 42 + .../py/async-binance-fetch-option-ticker.md | 42 + ...async-binance-fetch-ticker-continuously.md | 49 + .../py/async-binance-futures-vs-spot.md | 51 + .../py/async-binance-margin-borrow.md | 43 + .../examples/py/async-binance-margin-repay.md | 40 + ...ance-usdm-fetch-continuous-klines-ohlcv.md | 50 + .../py/async-bitfinex-public-get-symbols.md | 27 + .../async-bitget-perpetual-futures-swaps.md | 60 + .../async-bitstamp-create-limit-buy-order.md | 50 + ...sync-bitstamp-create-order-cancel-order.md | 62 + .../examples/py/async-bittrex-orderbook.md | 33 + .../wiki/examples/py/async-bybit-transfer.md | 36 + .../wiki/examples/py/async-fetch-balance.md | 34 + ...sync-fetch-many-orderbooks-continuously.md | 51 + ...-fetch-ohlcv-indicators-discord-webhook.md | 62 + ...tch-ohlcv-multiple-symbols-continuously.md | 41 + ...nc-fetch-order-book-from-many-exchanges.md | 54 + .../wiki/examples/py/async-fetch-ticker.md | 17 + .../examples/py/async-gather-concurrency.md | 78 + ...sync-gdax-fetch-order-book-continuously.md | 28 + .../wiki/examples/py/async-generator-basic.md | 28 + .../py/async-generator-multiple-tickers.md | 28 + .../py/async-generator-ticker-poller.md | 33 + .../wiki/examples/py/async-hollaex-sandbox.md | 37 + .../py/async-instantiate-all-at-once.md | 29 + .../examples/py/async-kucoin-rate-limit.md | 47 + docs/ccxt/wiki/examples/py/async-macd.md | 52 + .../py/async-market-making-symbols.md | 43 + .../examples/py/async-multiple-accounts.md | 37 + .../py/async-multiple-parallel-calls.md | 56 + .../py/async-okx-create-margin-order.md | 47 + .../examples/py/async-okx-margin-borrow.md | 41 + .../examples/py/async-okx-margin-repay.md | 44 + .../py/async-okx-positional-orders.md | 64 + ...erbooks-from-multiple-exchanges-at-once.md | 64 + .../ccxt/wiki/examples/py/async-orderbooks.md | 47 + docs/ccxt/wiki/examples/py/async-rtt.md | 80 + .../examples/py/async-theocean-orderbook.md | 33 + .../examples/py/async-theocean-tickers.md | 47 + docs/ccxt/wiki/examples/py/async-ticker.md | 28 + ...ync-tickers-from-many-exchanges-at-once.md | 50 + docs/ccxt/wiki/examples/py/async-tickers.md | 45 + .../wiki/examples/py/async-with-threads.md | 42 + docs/ccxt/wiki/examples/py/async.md | 38 + .../wiki/examples/py/balance-coinbasepro.md | 25 + docs/ccxt/wiki/examples/py/balance-gdax.md | 25 + docs/ccxt/wiki/examples/py/balance-kraken.md | 21 + docs/ccxt/wiki/examples/py/balances.md | 87 + docs/ccxt/wiki/examples/py/basic-chart.md | 45 + .../wiki/examples/py/basic-rate-limiting.md | 29 + .../wiki/examples/py/binance-batch-orders.md | 37 + .../py/binance-coin-margined-take-profit.md | 42 + .../examples/py/binance-conditional-orders.md | 50 + ...-create-oco-order-with-implicit-methods.md | 43 + docs/ccxt/wiki/examples/py/binance-ema.md | 34 + ...ance-fetch-all-my-trades-paginate-by-id.md | 59 + .../py/binance-fetch-all-my-trades.md | 55 + .../examples/py/binance-fetch-all-trades.md | 52 + .../py/binance-fetch-ohlcv-closing-time-1.md | 23 + .../py/binance-fetch-ohlcv-closing-time-2.md | 48 + .../py/binance-fetch-ohlcv-pagination.md | 43 + .../py/binance-fetch-ohlcv-quote-volume.md | 55 + .../examples/py/binance-fetch-ohlcv-to-csv.md | 66 + .../wiki/examples/py/binance-fetch-ohlcv.md | 43 + docs/ccxt/wiki/examples/py/binance-fiat.md | 28 + .../examples/py/binance-futures-margin.md | 199 + .../examples/py/binance-futures-positions.md | 32 + ...nance-futures-set-leverage-implicit-api.md | 35 + .../py/binance-futures-set-leverage.md | 25 + .../py/binance-market-order-quote-usdt.md | 58 + .../wiki/examples/py/binance-poll-balance.md | 41 + .../examples/py/binance-poll-positions.md | 34 + .../examples/py/binance-savings-endpoints.md | 46 + .../wiki/examples/py/binance-spot-trailing.md | 89 + .../py/binance-stop-loss-take-profit.md | 46 + .../wiki/examples/py/binance-test-order.md | 34 + .../examples/py/binance-universal-transfer.md | 33 + ...ance-usdm-fetch-continuous-klines-ohlcv.md | 44 + .../examples/py/bitfinex-rate-limiting.md | 35 + .../py/bitget-perpetual-futures-swaps.md | 56 + .../wiki/examples/py/bitmex-cancel-orders.md | 72 + .../wiki/examples/py/bitmex-create-order.md | 33 + .../bitmex-fetch-ohlcv-with-extra-params.md | 39 + .../py/bitmex-ohlcv-convert-5m-to-15m.md | 56 + .../wiki/examples/py/bitmex-order-value.md | 48 + .../py/bittrex-fetch-closed-orders-history.md | 77 + .../ccxt/wiki/examples/py/build-ohlcv-bars.md | 66 + .../py/builtin-rate-limiting-long-poller.md | 20 + .../py/bybit-USDC-create-option-order.md | 32 + .../examples/py/bybit-conditional-orders.md | 28 + docs/ccxt/wiki/examples/py/bybit-positions.md | 36 + docs/ccxt/wiki/examples/py/bybit-trailling.md | 77 + docs/ccxt/wiki/examples/py/bybit-updated.md | 173 + docs/ccxt/wiki/examples/py/cli.md | 251 + .../wiki/examples/py/coinbase-cancel-order.md | 31 + .../wiki/examples/py/coinbase-create-order.md | 37 + .../wiki/examples/py/coinbase-fetch-OHLCV.md | 32 + .../wiki/examples/py/coinbase-fetch-order.md | 35 + .../wiki/examples/py/coinbase-fetch-ticker.md | 33 + .../wiki/examples/py/coinbase-fetch-trades.md | 32 + .../coinbasepro-fetch-my-trades-pagination.md | 46 + docs/ccxt/wiki/examples/py/coinex-futures.md | 87 + .../wiki/examples/py/coinone-fetch-tickers.md | 31 + docs/ccxt/wiki/examples/py/coinone-markets.md | 22 + .../py/compare-two-exchanges-capabilities.md | 43 + ...order-position-with-takeprofit-stoploss.md | 73 + .../examples/py/create-order-ws-example.md | 41 + .../wiki/examples/py/create-orders-example.md | 39 + .../py/create-trailing-amount-order.md | 47 + .../py/create-trailing-percent-order.md | 47 + .../py/exchange-save-load-markets-cache.md | 81 + .../wiki/examples/py/exchanges-by-country.md | 28 + docs/ccxt/wiki/examples/py/exchanges.md | 65 + .../wiki/examples/py/fetch-all-okex-ohclv.md | 83 + .../wiki/examples/py/fetch-all-tickers.md | 76 + .../py/fetch-balance-asset-valuation.md | 39 + .../py/fetch-bitfinex-ohlcv-history.md | 43 + .../fetch-coinbasepro-ohlcv-sequentially.md | 39 + .../py/fetch-create-deposit-address.md | 83 + .../py/fetch-first-ohlcv-timestamp.md | 83 + .../py/fetch-gdax-ohlcv-sequentially.md | 39 + docs/ccxt/wiki/examples/py/fetch-ohlcv-cex.md | 42 + .../wiki/examples/py/fetch-ohlcv-kraken.md | 46 + .../fetch-ohlcv-many-exchanges-continuosly.md | 50 + .../py/fetch-ohlcv-mark-index-price.md | 41 + .../examples/py/fetch-ohlcv-on-new-candle.md | 44 + .../examples/py/fetch-ohlcv-sequentially.md | 41 + docs/ccxt/wiki/examples/py/fetch-ohlcv.md | 30 + .../wiki/examples/py/fetch-okex-futures.md | 20 + .../wiki/examples/py/fetch-open-orders.md | 41 + .../wiki/examples/py/fetch-order-book-rtt.md | 60 + docs/ccxt/wiki/examples/py/fetch-orders.md | 25 + ...etch-ticker-many-exchanges-many-symbols.md | 66 + ..._through_multiple_calls_and_save_to_csv.md | 57 + .../py/gateio-fetch-ohlcv-pagination.md | 48 + docs/ccxt/wiki/examples/py/gateio-futures.md | 55 + .../examples/py/gateio-open-close-contract.md | 59 + docs/ccxt/wiki/examples/py/gateio-swaps.md | 83 + .../py/gdax-fetch-my-trades-pagination.md | 46 + docs/ccxt/wiki/examples/py/hitbtc-withdraw.md | 47 + docs/ccxt/wiki/examples/py/huobi-futures.md | 90 + .../examples/py/huobi-open-close-contract.md | 75 + .../py/huobi-open-close-position-bbo.md | 68 + docs/ccxt/wiki/examples/py/huobi-spot.md | 86 + docs/ccxt/wiki/examples/py/huobi-swaps.md | 92 + .../examples/py/instantiate-all-at-once.md | 22 + .../py/kraken-conditional-close-order.md | 48 + .../py/kraken-create-and-close-position.md | 61 + .../py/kraken-fetch-my-trades-pagination.md | 50 + .../wiki/examples/py/krakenfutures-basic.md | 28 + ...-fetch-all-deposit-addresses-by-network.md | 30 + .../py/kucoin-fetch-all-deposit-addresses.md | 44 + .../kucoin-fetch-closed-orders-pagination.md | 37 + .../wiki/examples/py/kucoin-rate-limit.md | 42 + .../wiki/examples/py/kucoin-withdraw-chain.md | 40 + .../py/kucoinfutures-create-stop-order.md | 49 + .../wiki/examples/py/latoken-create-order.md | 29 + docs/ccxt/wiki/examples/py/latoken-example.md | 118 + .../py/manual-rate-limiting-long-poller.md | 28 + .../py/margin-leverage-order-kraken.md | 41 + .../py/margin-loan-borrow-buy-sell-repay.md | 97 + docs/ccxt/wiki/examples/py/measure-latency.md | 69 + docs/ccxt/wiki/examples/py/minimal-2-lines.md | 8 + ...multiple-subscriptions-watchXForSymbols.md | 59 + .../py/normalize-sparse-candle-timestamps.md | 36 + .../examples/py/okx-fetch-all-my-trades.md | 67 + ...tch-closed-orders-pagenumber-pagination.md | 64 + .../py/okx-position-takeprofit-stoploss.md | 112 + docs/ccxt/wiki/examples/py/okx-transfer.md | 44 + .../py/order-book-extra-level-depth-param.md | 17 + ...order-position-with-takeprofit-stoploss.md | 56 + .../examples/py/phemex-create-stop-order.md | 46 + .../examples/py/phemex-leverage-orders.md | 46 + .../py/phemex-open-cancel-close-positions.md | 68 + .../examples/py/phemex-perpetual-balance.md | 34 + .../ccxt/wiki/examples/py/phemex-positions.md | 58 + docs/ccxt/wiki/examples/py/phemex-transfer.md | 106 + .../examples/py/playing_with_ccxt_example.md | 227 + .../py/poloniex-fetch-ohlcv-continuously.md | 72 + .../poloniex-fetch-ohlcv-with-pagination.md | 47 + .../examples/py/poloniex-fetch-order-books.md | 36 + .../py/poloniex-fetch-trades-continuously.md | 40 + ...iex-fetch-trades-with-pagination-to-csv.md | 55 + .../py/poloniex-python2-memleak-test.md | 20 + .../py/poloniex-python3-memleak-test.md | 20 + docs/ccxt/wiki/examples/py/proxy-usage.md | 61 + docs/ccxt/wiki/examples/py/rsi.md | 36 + docs/ccxt/wiki/examples/py/rtt.md | 75 + .../py/sample-local-proxy-server-with-cors.md | 71 + .../examples/py/set_markets_from_exchange.md | 47 + docs/ccxt/wiki/examples/py/sign-in.md | 37 + ...ort-swap-markets-by-hourly-price-change.md | 75 + .../wiki/examples/py/source-ip-address.md | 41 + docs/ccxt/wiki/examples/py/symbols.md | 97 + docs/ccxt/wiki/examples/py/test-server.md | 70 + docs/ccxt/wiki/examples/py/theocean.md | 46 + docs/ccxt/wiki/examples/py/tickers.md | 134 + .../examples/py/watch-OHLCV-For-Symbols.md | 27 + docs/ccxt/wiki/examples/py/watch-OHLCV.md | 28 + .../py/watch-OrderBook-For-Symbols.md | 27 + .../examples/py/watch-Trades-For-Symbols.md | 27 + docs/ccxt/wiki/examples/py/watch-tickers.md | 27 + .../wiki/examples/py/watchOHLCVForSymbols.md | 27 + .../examples/py/watchOrderBookForSymbols.md | 27 + ...tchPositions-many-exchanges-continuosly.md | 61 + docs/ccxt/wiki/examples/py/watchPositions.md | 29 + .../examples/py/watchPositionsForSymbols.md | 30 + .../wiki/examples/py/watchTradesForSymbols.md | 27 + .../py/wazirx-create-cancel-orders.md | 50 + .../withdraw-from-one-exchange-to-another.md | 48 + docs/ccxt/wiki/examples/py/ws_test_load.md | 120 + docs/ccxt/wiki/examples/ts/README.md | 64 + docs/ccxt/wiki/examples/ts/benchmark.md | 140 + .../ccxt/wiki/examples/ts/build-ohlcv-bars.md | 59 + .../ts/compare-two-exchanges-capabilities.md | 42 + ...order-position-with-takeprofit-stoploss.md | 95 + .../examples/ts/create-order-ws-example.md | 39 + .../wiki/examples/ts/create-orders-example.md | 27 + .../ts/create-trailing-amount-order.md | 43 + .../ts/create-trailing-percent-order.md | 43 + .../examples/ts/custom-proxy-agent-for-js.md | 18 + .../ts/fetch-first-ohlcv-timestamp.md | 94 + .../fetch-ohlcv-many-exchanges-continuosly.md | 50 + docs/ccxt/wiki/examples/ts/fetch-ohlcv.md | 23 + docs/ccxt/wiki/examples/ts/hibachi-example.md | 143 + .../ts/how-to-import-one-exchange-esm.md | 17 + .../ts/kraken-create-and-close-position.md | 75 + .../ts/margin-loan-borrow-buy-sell-repay.md | 78 + ...order-position-with-takeprofit-stoploss.md | 68 + docs/ccxt/wiki/examples/ts/proxy-usage.md | 55 + .../ts/sample-local-proxy-server-with-cors.md | 21 + .../examples/ts/watch-OHLCV-For-Symbols.md | 23 + docs/ccxt/wiki/examples/ts/watch-OHLCV.md | 20 + .../ts/watch-OrderBook-For-Symbols.md | 19 + .../examples/ts/watch-Trades-For-Symbols.md | 19 + docs/ccxt/wiki/examples/ts/watch-tickers.md | 19 + ...tchPositions-many-exchanges-continuosly.md | 59 + docs/ccxt/wiki/examples/ts/watchPositions.md | 21 + .../examples/ts/watchPositionsForSymbols.md | 22 + docs/ccxt/wiki/exchangePartials/body.hbs | 29 + .../ccxt/wiki/exchangePartials/deprecated.hbs | 3 + docs/ccxt/wiki/exchangePartials/docs.hbs | 5 + docs/ccxt/wiki/exchangePartials/header.hbs | 9 + .../exchangePartials/member-index-list.hbs | 6 + docs/ccxt/wiki/exchangePartials/members.hbs | 9 + .../wiki/exchangePartials/params-table.hbs | 12 + docs/ccxt/wiki/exchangePartials/returns.hbs | 12 + docs/ccxt/wiki/exchanges/.gitkeep | 0 docs/ccxt/wiki/exchanges/alpaca.md | 758 + docs/ccxt/wiki/exchanges/apex.md | 847 ++ docs/ccxt/wiki/exchanges/ascendex.md | 958 ++ docs/ccxt/wiki/exchanges/backpack.md | 1153 ++ docs/ccxt/wiki/exchanges/bigone.md | 550 + docs/ccxt/wiki/exchanges/binance.md | 2665 ++++ docs/ccxt/wiki/exchanges/bingx.md | 1753 +++ docs/ccxt/wiki/exchanges/bit2c.md | 264 + docs/ccxt/wiki/exchanges/bitbank.md | 331 + docs/ccxt/wiki/exchanges/bitbns.md | 336 + docs/ccxt/wiki/exchanges/bitfinex.md | 1142 ++ docs/ccxt/wiki/exchanges/bitflyer.md | 425 + docs/ccxt/wiki/exchanges/bitget.md | 4752 ++++++ docs/ccxt/wiki/exchanges/bithumb.md | 383 + docs/ccxt/wiki/exchanges/bitmart.md | 1587 ++ docs/ccxt/wiki/exchanges/bitmex.md | 1018 ++ docs/ccxt/wiki/exchanges/bitopro.md | 653 + docs/ccxt/wiki/exchanges/bitrue.md | 767 + docs/ccxt/wiki/exchanges/bitso.md | 514 + docs/ccxt/wiki/exchanges/bitstamp.md | 657 + docs/ccxt/wiki/exchanges/bitteam.md | 403 + docs/ccxt/wiki/exchanges/bittrade.md | 628 + docs/ccxt/wiki/exchanges/bitvavo.md | 1122 ++ docs/ccxt/wiki/exchanges/blockchaincom.md | 631 + docs/ccxt/wiki/exchanges/blofin.md | 1068 ++ docs/ccxt/wiki/exchanges/btcalpha.md | 381 + docs/ccxt/wiki/exchanges/btcbox.md | 258 + docs/ccxt/wiki/exchanges/btcmarkets.md | 453 + docs/ccxt/wiki/exchanges/btcturk.md | 287 + docs/ccxt/wiki/exchanges/bybit.md | 2764 ++++ docs/ccxt/wiki/exchanges/cex.md | 897 ++ docs/ccxt/wiki/exchanges/coinbase.md | 1061 ++ docs/ccxt/wiki/exchanges/coinbaseexchange.md | 833 ++ .../wiki/exchanges/coinbaseinternational.md | 626 + docs/ccxt/wiki/exchanges/coincatch.md | 1535 ++ docs/ccxt/wiki/exchanges/coincheck.md | 310 + docs/ccxt/wiki/exchanges/coinex.md | 1631 ++ docs/ccxt/wiki/exchanges/coinmate.md | 373 + docs/ccxt/wiki/exchanges/coinmetro.md | 418 + docs/ccxt/wiki/exchanges/coinone.md | 375 + docs/ccxt/wiki/exchanges/coinsph.md | 571 + docs/ccxt/wiki/exchanges/coinspot.md | 196 + docs/ccxt/wiki/exchanges/cryptocom.md | 1381 ++ docs/ccxt/wiki/exchanges/cryptomus.md | 274 + docs/ccxt/wiki/exchanges/defx.md | 1100 ++ docs/ccxt/wiki/exchanges/delta.md | 757 + docs/ccxt/wiki/exchanges/deribit.md | 1239 ++ docs/ccxt/wiki/exchanges/derive.md | 711 + docs/ccxt/wiki/exchanges/digifinex.md | 1037 ++ docs/ccxt/wiki/exchanges/exmo.md | 968 ++ docs/ccxt/wiki/exchanges/foxbit.md | 600 + docs/ccxt/wiki/exchanges/gate.md | 2367 +++ docs/ccxt/wiki/exchanges/gemini.md | 613 + docs/ccxt/wiki/exchanges/hashkey.md | 1209 ++ docs/ccxt/wiki/exchanges/hibachi.md | 650 + docs/ccxt/wiki/exchanges/hitbtc.md | 1071 ++ docs/ccxt/wiki/exchanges/hollaex.md | 702 + docs/ccxt/wiki/exchanges/htx.md | 1796 +++ docs/ccxt/wiki/exchanges/hyperliquid.md | 1530 ++ .../ccxt/wiki/exchanges/independentreserve.md | 365 + docs/ccxt/wiki/exchanges/indodax.md | 399 + docs/ccxt/wiki/exchanges/kraken().md | 864 ++ docs/ccxt/wiki/exchanges/krakenfutures.md | 631 + docs/ccxt/wiki/exchanges/kucoin.md | 1715 +++ docs/ccxt/wiki/exchanges/kucoinfutures.md | 1351 ++ docs/ccxt/wiki/exchanges/latoken.md | 491 + docs/ccxt/wiki/exchanges/lbank.md | 900 ++ docs/ccxt/wiki/exchanges/luno.md | 522 + docs/ccxt/wiki/exchanges/mercado.md | 299 + docs/ccxt/wiki/exchanges/mexc.md | 1717 +++ docs/ccxt/wiki/exchanges/modetrade.md | 1134 ++ docs/ccxt/wiki/exchanges/ndax.md | 631 + docs/ccxt/wiki/exchanges/novadax.md | 523 + docs/ccxt/wiki/exchanges/oceanex.md | 441 + docs/ccxt/wiki/exchanges/okcoin.md | 787 + docs/ccxt/wiki/exchanges/okx.md | 2788 ++++ docs/ccxt/wiki/exchanges/onetrading.md | 586 + docs/ccxt/wiki/exchanges/oxfun.md | 1144 ++ docs/ccxt/wiki/exchanges/p2b.md | 320 + docs/ccxt/wiki/exchanges/paradex().md | 691 + docs/ccxt/wiki/exchanges/paymium.md | 241 + docs/ccxt/wiki/exchanges/phemex.md | 1127 ++ docs/ccxt/wiki/exchanges/poloniex.md | 834 ++ docs/ccxt/wiki/exchanges/probit.md | 677 + docs/ccxt/wiki/exchanges/timex.md | 466 + docs/ccxt/wiki/exchanges/tokocrypto.md | 483 + docs/ccxt/wiki/exchanges/toobit.md | 1113 ++ docs/ccxt/wiki/exchanges/upbit.md | 909 ++ docs/ccxt/wiki/exchanges/wavesexchange.md | 421 + docs/ccxt/wiki/exchanges/whitebit.md | 1230 ++ docs/ccxt/wiki/exchanges/woo.md | 1560 ++ docs/ccxt/wiki/exchanges/woofipro.md | 1138 ++ docs/ccxt/wiki/exchanges/xt.md | 1046 ++ docs/ccxt/wiki/exchanges/yobit.md | 374 + docs/ccxt/wiki/exchanges/zaif.md | 240 + docs/ccxt/wiki/exchanges/zonda.md | 360 + docs/ccxt/wiki/favicon.ico | Bin 0 -> 7406 bytes docs/ccxt/wiki/helpers.cjs | 47 + docs/ccxt/wiki/index.html | 69 + docs/ccxt/wiki/partials/body.hbs | 29 + docs/ccxt/wiki/partials/deprecated.hbs | 3 + docs/ccxt/wiki/partials/docs.hbs | 6 + docs/ccxt/wiki/partials/header.hbs | 9 + docs/ccxt/wiki/partials/member-index-list.hbs | 6 + docs/ccxt/wiki/partials/members.hbs | 9 + docs/ccxt/wiki/partials/params-table.hbs | 12 + docs/ccxt/wiki/partials/returns.hbs | 12 + docs/ccxt/wiki/spec.hbs | 1 + src/cli/args.ts | 6 +- src/config.ts | 15 + src/exchanges/backpack/adapter.ts | 175 + src/exchanges/backpack/gateway.ts | 504 + src/exchanges/create-adapter.ts | 9 +- tests/exchange-factory.test.ts | 13 + 925 files changed, 165721 insertions(+), 4 deletions(-) create mode 100644 docs/backpack/openapi.json create mode 100644 docs/ccxt/examples/ccxt.pro/html/watchTicker.html create mode 100644 docs/ccxt/examples/ccxt.pro/js/apex-watch.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/binance-fetch-balance-snapshot-watch-balance-updates.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/binance-https-proxy.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols-continuously.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/binance-watch-ticker-many-symbols.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/build-ohlcv-many-symbols.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades-warmup.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/exchange-capabitities.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/exchange-close.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/gateio-swap-watch-many-orderbooks.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/gateio-watch-balance.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/gateio-watch-order-book.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/graceful-shutdown.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/many-exchanges-many-streams.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/okex-create-futures-order.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/okex-watch-balance-and-create-order.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/okx-watch-tickers.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/one-exchange-many-different-streams.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams-2.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/socks-binance-watch-orderbook.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-fetch-many-exchanges-many-ordersbooks.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-ordersbooks.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-symbols.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-many-orderbooks.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-new-trades-only.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-new-trades.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-trades-many-symbols.js create mode 100644 docs/ccxt/examples/ccxt.pro/js/watch-vs-fetch.js create mode 100644 docs/ccxt/examples/ccxt.pro/php/many-exchanges-many-accounts.php create mode 100644 docs/ccxt/examples/ccxt.pro/php/many-exchanges-synchronously.php create mode 100644 docs/ccxt/examples/ccxt.pro/php/one-exchange-many-streams.php create mode 100644 docs/ccxt/examples/ccxt.pro/php/watch-multiple-methods-multiple-exchanges.php create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-create-order-cancel-order.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-fetch-balance-snapshot-watch-balance-updates.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-balance.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-order-book.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-futures.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-reload-markets.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-spot-and-futures.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-watch-many-orderbooks.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-watch-margin-balance.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-watch-ohlcv.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-watch-order-book-individual-updates.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-watch-orderbook-watch-balance.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-watch-orders-being-placed.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/binance-watch-spot-futures-balances-continuously.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ohlcv.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ticker_and_ohlcv.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/bitvavo-watch-order-book.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/build-ohlcv-many-symbols.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/coinbase-watch-all-trades.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/coinbase-watch-trades.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/consume-all-trades.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/gateio-watch-trades.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/intercept-original-ohlcv-updates.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/kucoin-watch-multiple-orderbooks.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-different-streams.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-synchronized.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-throttled.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams-with-keys.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-symbols-watch-trades.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/many-exchanges.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/multiple-exchanges-watch-orderbook-continuously.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/okex-create-swap-order.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance-with-params.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/okx-bbo-tbt.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/on-connected-user-hook.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/one-exchange-different-streams.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/one-exchange-many-streams.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/phemex-cancel-all-orders.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/spot-vs-future-arbitrage-bitmart.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/watch-all-symbols.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/watch-custom-exchange-specific-streams.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/watch-many-exchanges-many-tickers.py create mode 100644 docs/ccxt/examples/ccxt.pro/py/watch-ticker-to-csv.py create mode 100644 docs/ccxt/examples/html/basic-cors-proxy.html create mode 100644 docs/ccxt/examples/html/basic-inheritance.html create mode 100644 docs/ccxt/examples/html/basic-poller.html create mode 100644 docs/ccxt/examples/html/basic-rate-limiting.html create mode 100644 docs/ccxt/examples/html/basic.html create mode 100644 docs/ccxt/examples/html/binance-cors-proxy.html create mode 100644 docs/ccxt/examples/html/bitmex-browser-cors-proxy.js create mode 100644 docs/ccxt/examples/html/bitmex-cors.html create mode 100644 docs/ccxt/examples/html/tradingview-charts.html create mode 100644 docs/ccxt/examples/html/webworker/index.html create mode 100644 docs/ccxt/examples/html/webworker/worker.js create mode 100644 docs/ccxt/examples/js/README.md create mode 100644 docs/ccxt/examples/js/advanced-error-handling.js create mode 100644 docs/ccxt/examples/js/aggregate-orderbook.js create mode 100644 docs/ccxt/examples/js/apex-example.js create mode 100644 docs/ccxt/examples/js/arbitrage-pairs.js create mode 100644 docs/ccxt/examples/js/basic-chart.js create mode 100644 docs/ccxt/examples/js/basic-orderbook-polling.js create mode 100644 docs/ccxt/examples/js/bcc-vs-bch.js create mode 100644 docs/ccxt/examples/js/benchmark.js create mode 100644 docs/ccxt/examples/js/binance-fetch-all-deposits.js create mode 100644 docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-async-await.js create mode 100644 docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.js create mode 100644 docs/ccxt/examples/js/binance-fetchTicker-delivery-vs-future.js create mode 100644 docs/ccxt/examples/js/binance-futures-transfer-from-sub-account-to-master.js create mode 100644 docs/ccxt/examples/js/binance-margin-stop-order.js create mode 100644 docs/ccxt/examples/js/binance-server-time.js create mode 100644 docs/ccxt/examples/js/binance-universal-transfer.js create mode 100644 docs/ccxt/examples/js/bitfinex-fetch-trades.js create mode 100644 docs/ccxt/examples/js/bitfinex2-fetch-trades.js create mode 100644 docs/ccxt/examples/js/bitmex-browser-cors-proxy.js create mode 100644 docs/ccxt/examples/js/bitpanda-fetchMyTrades-reduce.js create mode 100644 docs/ccxt/examples/js/bitrue-fetch-balance.js create mode 100644 docs/ccxt/examples/js/bitstamp-private-api.js create mode 100644 docs/ccxt/examples/js/bitstamp-public-api.js create mode 100644 docs/ccxt/examples/js/bittrex-balance.js create mode 100644 docs/ccxt/examples/js/bittrex-fetch-closed-orders-history.js create mode 100644 docs/ccxt/examples/js/blockchaincom-withdrawal.js create mode 100644 docs/ccxt/examples/js/build-ohlcv-bars.js create mode 100644 docs/ccxt/examples/js/builtin-rate-limiting-rest-poller.js create mode 100644 docs/ccxt/examples/js/bybit-trailing.js create mode 100644 docs/ccxt/examples/js/bybit-updated.cjs create mode 100644 docs/ccxt/examples/js/coinbase-fetch-all-balances.js create mode 100644 docs/ccxt/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.js create mode 100644 docs/ccxt/examples/js/coinex-futures.js create mode 100644 docs/ccxt/examples/js/coinone-fetch-tickers.js create mode 100644 docs/ccxt/examples/js/coinone-markets.js create mode 100644 docs/ccxt/examples/js/compare-two-exchanges-capabilities.js create mode 100644 docs/ccxt/examples/js/cors-proxy.js create mode 100644 docs/ccxt/examples/js/create-order-handle-errors.js create mode 100644 docs/ccxt/examples/js/create-order-position-with-takeprofit-stoploss.js create mode 100644 docs/ccxt/examples/js/create-order-with-retry.js create mode 100644 docs/ccxt/examples/js/create-order-ws-example.js create mode 100644 docs/ccxt/examples/js/create-orders-example.js create mode 100644 docs/ccxt/examples/js/create-trailing-amount-order.js create mode 100644 docs/ccxt/examples/js/create-trailing-percent-order.js create mode 100644 docs/ccxt/examples/js/credentials.json create mode 100644 docs/ccxt/examples/js/custom-proxy-agent-for-js.js create mode 100644 docs/ccxt/examples/js/custom-proxy-url.js create mode 100644 docs/ccxt/examples/js/delta-maintenance-margin-rate-max-leverage.js create mode 100644 docs/ccxt/examples/js/env-variables.js create mode 100644 docs/ccxt/examples/js/error-handling.js create mode 100644 docs/ccxt/examples/js/exchange-capabilities.js create mode 100644 docs/ccxt/examples/js/exchanges-by-volume.js create mode 100644 docs/ccxt/examples/js/exchanges.js create mode 100644 docs/ccxt/examples/js/fetch-all-balances.js create mode 100644 docs/ccxt/examples/js/fetch-all-tickers-to-files-2.js create mode 100644 docs/ccxt/examples/js/fetch-all-tickers-to-files.js create mode 100644 docs/ccxt/examples/js/fetch-balance.js create mode 100644 docs/ccxt/examples/js/fetch-create-deposit-address.js create mode 100644 docs/ccxt/examples/js/fetch-first-ohlcv-timestamp.js create mode 100644 docs/ccxt/examples/js/fetch-from-many-exchanges-simultaneously.js create mode 100644 docs/ccxt/examples/js/fetch-funding-rate-history.js create mode 100644 docs/ccxt/examples/js/fetch-futures/prettier.config.js create mode 100644 docs/ccxt/examples/js/fetch-futures/src/index.js create mode 100644 docs/ccxt/examples/js/fetch-ohlcv-from-to-mark-index-premium.js create mode 100644 docs/ccxt/examples/js/fetch-ohlcv-many-exchanges-continuosly.js create mode 100644 docs/ccxt/examples/js/fetch-ohlcv.js create mode 100644 docs/ccxt/examples/js/fetch-okex-futures.js create mode 100644 docs/ccxt/examples/js/fetch-orders.js create mode 100644 docs/ccxt/examples/js/fetch-ticker-from-multiple-exchanges.js create mode 100644 docs/ccxt/examples/js/fetch-ticker-where-available.js create mode 100644 docs/ccxt/examples/js/fetch-tickers/build/index.js create mode 100644 docs/ccxt/examples/js/fetch-tickers/prettier.config.js create mode 100644 docs/ccxt/examples/js/fetch-tickers/src/index.js create mode 100755 docs/ccxt/examples/js/gateio-create-batch-order.js create mode 100644 docs/ccxt/examples/js/gateio-futures.js create mode 100644 docs/ccxt/examples/js/gateio-open-close-contract.js create mode 100644 docs/ccxt/examples/js/gateio-swaps.js create mode 100644 docs/ccxt/examples/js/gdax-fetch-trades-pagination.js create mode 100644 docs/ccxt/examples/js/hibachi-example.js create mode 100644 docs/ccxt/examples/js/hitbtc2-withdraw.js create mode 100644 docs/ccxt/examples/js/how-to-import-one-exchange-esm.js create mode 100644 docs/ccxt/examples/js/huobi-futures.js create mode 100644 docs/ccxt/examples/js/huobi-open-close-contract.js create mode 100644 docs/ccxt/examples/js/huobi-swaps.js create mode 100644 docs/ccxt/examples/js/huobipro-market-buy-sell-fetch-trading-limits.js create mode 100644 docs/ccxt/examples/js/hybridCJSExample.cjs create mode 100644 docs/ccxt/examples/js/hybridESMExample.js create mode 100644 docs/ccxt/examples/js/idex-fetch-balance.js create mode 100644 docs/ccxt/examples/js/instantiate-all-at-once.js create mode 100644 docs/ccxt/examples/js/instantiate-all-from-json.js create mode 100644 docs/ccxt/examples/js/kraken-create-and-close-position.js create mode 100644 docs/ccxt/examples/js/kraken-fetch-order-trades.js create mode 100644 docs/ccxt/examples/js/kraken-margin-trading.js create mode 100644 docs/ccxt/examples/js/kucoin-rate-limit.js create mode 100644 docs/ccxt/examples/js/latoken-example.js create mode 100644 docs/ccxt/examples/js/live-orderbook.js create mode 100644 docs/ccxt/examples/js/live-ticker.js create mode 100644 docs/ccxt/examples/js/live-tickers.js create mode 100644 docs/ccxt/examples/js/load-all-contracts.js create mode 100644 docs/ccxt/examples/js/load-all-symbols-at-once.js create mode 100644 docs/ccxt/examples/js/load-all-tickers-at-once.js create mode 100644 docs/ccxt/examples/js/load-markets-to-files.js create mode 100644 docs/ccxt/examples/js/looping-over-all-symbols-of-specific-exchanges.js create mode 100644 docs/ccxt/examples/js/looping-over-specific-symbols-of-all-exchanges.js create mode 100644 docs/ccxt/examples/js/margin-loan-borrow-buy-sell-repay.js create mode 100644 docs/ccxt/examples/js/market-status-and-currency-status.js create mode 100644 docs/ccxt/examples/js/ohlcv-console-chart.js create mode 100644 docs/ccxt/examples/js/okex-fetch-closed-orders-archive.js create mode 100644 docs/ccxt/examples/js/okex-transfer.js create mode 100644 docs/ccxt/examples/js/okx-poll-fetch-my-trades.js create mode 100644 docs/ccxt/examples/js/okx-poll-rate-limit.js create mode 100644 docs/ccxt/examples/js/order-book-extra-level-depth-param.js create mode 100644 docs/ccxt/examples/js/phemex-create-order-position-with-takeprofit-stoploss.js create mode 100644 docs/ccxt/examples/js/poll-ohlcv.js create mode 100644 docs/ccxt/examples/js/poloniex-fetch-order-books.js create mode 100644 docs/ccxt/examples/js/poloniex-limits-amount-min.js create mode 100644 docs/ccxt/examples/js/proxy-round-robin.js create mode 100644 docs/ccxt/examples/js/proxy-usage.js create mode 100644 docs/ccxt/examples/js/sample-local-proxy-server-with-cors.js create mode 100644 docs/ccxt/examples/js/search-all-exchanges.js create mode 100644 docs/ccxt/examples/js/shared-load-markets.js create mode 100644 docs/ccxt/examples/js/sort-swap-markets-by-hourly-price-change.js create mode 100644 docs/ccxt/examples/js/symbols.js create mode 100644 docs/ccxt/examples/js/theocean.js create mode 100644 docs/ccxt/examples/js/tickers.js create mode 100644 docs/ccxt/examples/js/validate-paginated-data.js create mode 100644 docs/ccxt/examples/js/watch-OHLCV-For-Symbols.js create mode 100644 docs/ccxt/examples/js/watch-OHLCV.js create mode 100644 docs/ccxt/examples/js/watch-OrderBook-For-Symbols.js create mode 100644 docs/ccxt/examples/js/watch-Trades-For-Symbols.js create mode 100644 docs/ccxt/examples/js/watch-tickers.js create mode 100644 docs/ccxt/examples/js/watchOHLCVForSymbols.js create mode 100644 docs/ccxt/examples/js/watchOrderBookForSymbols.js create mode 100644 docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts create mode 100644 docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts.map create mode 100644 docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.js create mode 100644 docs/ccxt/examples/js/watchPositions.d.ts create mode 100644 docs/ccxt/examples/js/watchPositions.d.ts.map create mode 100644 docs/ccxt/examples/js/watchPositions.js create mode 100644 docs/ccxt/examples/js/watchPositionsForSymbols.d.ts create mode 100644 docs/ccxt/examples/js/watchPositionsForSymbols.d.ts.map create mode 100644 docs/ccxt/examples/js/watchPositionsForSymbols.js create mode 100644 docs/ccxt/examples/js/watchTradesForSymbols.js create mode 100644 docs/ccxt/examples/js/withdraw-from-one-exchange-to-another.js create mode 100644 docs/ccxt/examples/ts/.eslintrc create mode 100644 docs/ccxt/examples/ts/benchmark.ts create mode 100644 docs/ccxt/examples/ts/build-ohlcv-bars.ts create mode 100644 docs/ccxt/examples/ts/compare-two-exchanges-capabilities.ts create mode 100644 docs/ccxt/examples/ts/create-order-position-with-takeprofit-stoploss.ts create mode 100644 docs/ccxt/examples/ts/create-order-ws-example.ts create mode 100644 docs/ccxt/examples/ts/create-orders-example.ts create mode 100644 docs/ccxt/examples/ts/create-trailing-amount-order.ts create mode 100644 docs/ccxt/examples/ts/create-trailing-percent-order.ts create mode 100644 docs/ccxt/examples/ts/custom-proxy-agent-for-js.ts create mode 100644 docs/ccxt/examples/ts/fetch-first-ohlcv-timestamp.ts create mode 100644 docs/ccxt/examples/ts/fetch-futures/.gitignore create mode 100644 docs/ccxt/examples/ts/fetch-futures/package-lock.json create mode 100644 docs/ccxt/examples/ts/fetch-futures/package.json create mode 100644 docs/ccxt/examples/ts/fetch-futures/prettier.config.js create mode 100644 docs/ccxt/examples/ts/fetch-futures/src/index.ts create mode 100644 docs/ccxt/examples/ts/fetch-futures/tsconfig.json create mode 100644 docs/ccxt/examples/ts/fetch-ohlcv-many-exchanges-continuosly.ts create mode 100644 docs/ccxt/examples/ts/fetch-ohlcv.ts create mode 100644 docs/ccxt/examples/ts/fetch-tickers/.gitignore create mode 100644 docs/ccxt/examples/ts/fetch-tickers/package-lock.json create mode 100644 docs/ccxt/examples/ts/fetch-tickers/package.json create mode 100644 docs/ccxt/examples/ts/fetch-tickers/prettier.config.js create mode 100644 docs/ccxt/examples/ts/fetch-tickers/src/index.ts create mode 100644 docs/ccxt/examples/ts/fetch-tickers/tsconfig.json create mode 100644 docs/ccxt/examples/ts/hibachi-example.ts create mode 100644 docs/ccxt/examples/ts/how-to-import-one-exchange-esm.ts create mode 100644 docs/ccxt/examples/ts/kraken-create-and-close-position.ts create mode 100644 docs/ccxt/examples/ts/margin-loan-borrow-buy-sell-repay.ts create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/.eslintrc.json create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/.gitignore create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/README.md create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/next.config.js create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/package-lock.json create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/package.json create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/postcss.config.js create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/public/favicon.ico create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/src/pages/_app.tsx create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/src/pages/_document.tsx create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/src/pages/balance.tsx create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/src/pages/index.tsx create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/src/pages/tickers.tsx create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/src/styles/globals.css create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/tailwind.config.ts create mode 100644 docs/ccxt/examples/ts/nextjs-page-router/tsconfig.json create mode 100644 docs/ccxt/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.ts create mode 100644 docs/ccxt/examples/ts/proxy-usage.ts create mode 100644 docs/ccxt/examples/ts/sample-local-proxy-server-with-cors.ts create mode 100644 docs/ccxt/examples/ts/watch-OHLCV-For-Symbols.ts create mode 100644 docs/ccxt/examples/ts/watch-OHLCV.ts create mode 100644 docs/ccxt/examples/ts/watch-OrderBook-For-Symbols.ts create mode 100644 docs/ccxt/examples/ts/watch-Trades-For-Symbols.ts create mode 100644 docs/ccxt/examples/ts/watch-tickers.ts create mode 100644 docs/ccxt/examples/ts/watchPositions-many-exchanges-continuosly.ts create mode 100644 docs/ccxt/examples/ts/watchPositions.ts create mode 100644 docs/ccxt/examples/ts/watchPositionsForSymbols.ts create mode 100644 docs/ccxt/wiki/.nojekyll create mode 100644 docs/ccxt/wiki/Awesome.md create mode 120000 docs/ccxt/wiki/CHANGELOG.md create mode 100644 docs/ccxt/wiki/CLI.md create mode 120000 docs/ccxt/wiki/CONTRIBUTING.md create mode 100644 docs/ccxt/wiki/Certification.md create mode 100644 docs/ccxt/wiki/Examples.md create mode 100644 docs/ccxt/wiki/Exchange-Markets-By-Country.md create mode 100644 docs/ccxt/wiki/Exchange-Markets.md create mode 100644 docs/ccxt/wiki/FAQ.md create mode 100644 docs/ccxt/wiki/Install.md create mode 100644 docs/ccxt/wiki/Manual.md create mode 100644 docs/ccxt/wiki/README.md create mode 100644 docs/ccxt/wiki/Requirements.md create mode 100644 docs/ccxt/wiki/Stats.md create mode 100644 docs/ccxt/wiki/_coverpage.md create mode 100644 docs/ccxt/wiki/_sidebar.md create mode 100644 docs/ccxt/wiki/basePartials/body.hbs create mode 100644 docs/ccxt/wiki/basePartials/deprecated.hbs create mode 100644 docs/ccxt/wiki/basePartials/docs.hbs create mode 100644 docs/ccxt/wiki/basePartials/header.hbs create mode 100644 docs/ccxt/wiki/basePartials/member-index-list.hbs create mode 100644 docs/ccxt/wiki/basePartials/members.hbs create mode 100644 docs/ccxt/wiki/basePartials/params-table.hbs create mode 100644 docs/ccxt/wiki/basePartials/returns.hbs create mode 100644 docs/ccxt/wiki/baseSpec.md create mode 100644 docs/ccxt/wiki/ccxt.pro.manual.md create mode 100644 docs/ccxt/wiki/ccxt.pro.md create mode 100644 docs/ccxt/wiki/examples/js/README.md create mode 100644 docs/ccxt/wiki/examples/js/advanced-error-handling.md create mode 100644 docs/ccxt/wiki/examples/js/aggregate-orderbook.md create mode 100644 docs/ccxt/wiki/examples/js/apex-example.md create mode 100644 docs/ccxt/wiki/examples/js/arbitrage-pairs.md create mode 100644 docs/ccxt/wiki/examples/js/basic-chart.md create mode 100644 docs/ccxt/wiki/examples/js/basic-orderbook-polling.md create mode 100644 docs/ccxt/wiki/examples/js/bcc-vs-bch.md create mode 100644 docs/ccxt/wiki/examples/js/benchmark.md create mode 100644 docs/ccxt/wiki/examples/js/binance-fetch-all-deposits.md create mode 100644 docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-async-await.md create mode 100644 docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.md create mode 100644 docs/ccxt/wiki/examples/js/binance-fetchTicker-delivery-vs-future.md create mode 100644 docs/ccxt/wiki/examples/js/binance-futures-transfer-from-sub-account-to-master.md create mode 100644 docs/ccxt/wiki/examples/js/binance-margin-stop-order.md create mode 100644 docs/ccxt/wiki/examples/js/binance-server-time.md create mode 100644 docs/ccxt/wiki/examples/js/binance-universal-transfer.md create mode 100644 docs/ccxt/wiki/examples/js/bitfinex-fetch-trades.md create mode 100644 docs/ccxt/wiki/examples/js/bitfinex2-fetch-trades.md create mode 100644 docs/ccxt/wiki/examples/js/bitmex-browser-cors-proxy.md create mode 100644 docs/ccxt/wiki/examples/js/bitpanda-fetchMyTrades-reduce.md create mode 100644 docs/ccxt/wiki/examples/js/bitrue-fetch-balance.md create mode 100644 docs/ccxt/wiki/examples/js/bitstamp-private-api.md create mode 100644 docs/ccxt/wiki/examples/js/bitstamp-public-api.md create mode 100644 docs/ccxt/wiki/examples/js/bittrex-balance.md create mode 100644 docs/ccxt/wiki/examples/js/bittrex-fetch-closed-orders-history.md create mode 100644 docs/ccxt/wiki/examples/js/blockchaincom-withdrawal.md create mode 100644 docs/ccxt/wiki/examples/js/build-ohlcv-bars.md create mode 100644 docs/ccxt/wiki/examples/js/builtin-rate-limiting-rest-poller.md create mode 100644 docs/ccxt/wiki/examples/js/bybit-trailing.md create mode 100644 docs/ccxt/wiki/examples/js/bybit-updated.md create mode 100644 docs/ccxt/wiki/examples/js/coinbase-fetch-all-balances.md create mode 100644 docs/ccxt/wiki/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.md create mode 100644 docs/ccxt/wiki/examples/js/coinex-futures.md create mode 100644 docs/ccxt/wiki/examples/js/coinone-fetch-tickers.md create mode 100644 docs/ccxt/wiki/examples/js/coinone-markets.md create mode 100644 docs/ccxt/wiki/examples/js/compare-two-exchanges-capabilities.md create mode 100644 docs/ccxt/wiki/examples/js/cors-proxy.md create mode 100644 docs/ccxt/wiki/examples/js/create-order-handle-errors.md create mode 100644 docs/ccxt/wiki/examples/js/create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/js/create-order-with-retry.md create mode 100644 docs/ccxt/wiki/examples/js/create-order-ws-example.md create mode 100644 docs/ccxt/wiki/examples/js/create-orders-example.md create mode 100644 docs/ccxt/wiki/examples/js/create-trailing-amount-order.md create mode 100644 docs/ccxt/wiki/examples/js/create-trailing-percent-order.md create mode 100644 docs/ccxt/wiki/examples/js/credentials.md create mode 100644 docs/ccxt/wiki/examples/js/custom-proxy-agent-for-js.md create mode 100644 docs/ccxt/wiki/examples/js/custom-proxy-url.md create mode 100644 docs/ccxt/wiki/examples/js/delta-maintenance-margin-rate-max-leverage.md create mode 100644 docs/ccxt/wiki/examples/js/env-variables.md create mode 100644 docs/ccxt/wiki/examples/js/error-handling.md create mode 100644 docs/ccxt/wiki/examples/js/exchange-capabilities.md create mode 100644 docs/ccxt/wiki/examples/js/exchanges-by-volume.md create mode 100644 docs/ccxt/wiki/examples/js/exchanges.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-all-balances.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files-2.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-balance.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-create-deposit-address.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-first-ohlcv-timestamp.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-from-many-exchanges-simultaneously.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-funding-rate-history.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-ohlcv-from-to-mark-index-premium.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-ohlcv-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-okex-futures.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-orders.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-ticker-from-multiple-exchanges.md create mode 100644 docs/ccxt/wiki/examples/js/fetch-ticker-where-available.md create mode 100644 docs/ccxt/wiki/examples/js/gateio-create-batch-order.md create mode 100644 docs/ccxt/wiki/examples/js/gateio-futures.md create mode 100644 docs/ccxt/wiki/examples/js/gateio-open-close-contract.md create mode 100644 docs/ccxt/wiki/examples/js/gateio-swaps.md create mode 100644 docs/ccxt/wiki/examples/js/gdax-fetch-trades-pagination.md create mode 100644 docs/ccxt/wiki/examples/js/hibachi-example.md create mode 100644 docs/ccxt/wiki/examples/js/hitbtc2-withdraw.md create mode 100644 docs/ccxt/wiki/examples/js/how-to-import-one-exchange-esm.md create mode 100644 docs/ccxt/wiki/examples/js/huobi-futures.md create mode 100644 docs/ccxt/wiki/examples/js/huobi-open-close-contract.md create mode 100644 docs/ccxt/wiki/examples/js/huobi-swaps.md create mode 100644 docs/ccxt/wiki/examples/js/huobipro-market-buy-sell-fetch-trading-limits.md create mode 100644 docs/ccxt/wiki/examples/js/hybridCJSExample.md create mode 100644 docs/ccxt/wiki/examples/js/hybridESMExample.md create mode 100644 docs/ccxt/wiki/examples/js/idex-fetch-balance.md create mode 100644 docs/ccxt/wiki/examples/js/instantiate-all-at-once.md create mode 100644 docs/ccxt/wiki/examples/js/instantiate-all-from-json.md create mode 100644 docs/ccxt/wiki/examples/js/kraken-create-and-close-position.md create mode 100644 docs/ccxt/wiki/examples/js/kraken-fetch-order-trades.md create mode 100644 docs/ccxt/wiki/examples/js/kraken-margin-trading.md create mode 100644 docs/ccxt/wiki/examples/js/kucoin-rate-limit.md create mode 100644 docs/ccxt/wiki/examples/js/latoken-example.md create mode 100644 docs/ccxt/wiki/examples/js/live-orderbook.md create mode 100644 docs/ccxt/wiki/examples/js/live-ticker.md create mode 100644 docs/ccxt/wiki/examples/js/live-tickers.md create mode 100644 docs/ccxt/wiki/examples/js/load-all-contracts.md create mode 100644 docs/ccxt/wiki/examples/js/load-all-symbols-at-once.md create mode 100644 docs/ccxt/wiki/examples/js/load-all-tickers-at-once.md create mode 100644 docs/ccxt/wiki/examples/js/load-markets-to-files.md create mode 100644 docs/ccxt/wiki/examples/js/looping-over-all-symbols-of-specific-exchanges.md create mode 100644 docs/ccxt/wiki/examples/js/looping-over-specific-symbols-of-all-exchanges.md create mode 100644 docs/ccxt/wiki/examples/js/margin-loan-borrow-buy-sell-repay.md create mode 100644 docs/ccxt/wiki/examples/js/market-status-and-currency-status.md create mode 100644 docs/ccxt/wiki/examples/js/ohlcv-console-chart.md create mode 100644 docs/ccxt/wiki/examples/js/okex-fetch-closed-orders-archive.md create mode 100644 docs/ccxt/wiki/examples/js/okex-transfer.md create mode 100644 docs/ccxt/wiki/examples/js/okx-poll-fetch-my-trades.md create mode 100644 docs/ccxt/wiki/examples/js/okx-poll-rate-limit.md create mode 100644 docs/ccxt/wiki/examples/js/order-book-extra-level-depth-param.md create mode 100644 docs/ccxt/wiki/examples/js/phemex-create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/js/poll-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/js/poloniex-fetch-order-books.md create mode 100644 docs/ccxt/wiki/examples/js/poloniex-limits-amount-min.md create mode 100644 docs/ccxt/wiki/examples/js/proxy-round-robin.md create mode 100644 docs/ccxt/wiki/examples/js/proxy-usage.md create mode 100644 docs/ccxt/wiki/examples/js/sample-local-proxy-server-with-cors.md create mode 100644 docs/ccxt/wiki/examples/js/search-all-exchanges.md create mode 100644 docs/ccxt/wiki/examples/js/shared-load-markets.md create mode 100644 docs/ccxt/wiki/examples/js/sort-swap-markets-by-hourly-price-change.md create mode 100644 docs/ccxt/wiki/examples/js/symbols.md create mode 100644 docs/ccxt/wiki/examples/js/theocean.md create mode 100644 docs/ccxt/wiki/examples/js/tickers.md create mode 100644 docs/ccxt/wiki/examples/js/validate-paginated-data.md create mode 100644 docs/ccxt/wiki/examples/js/watch-OHLCV-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/js/watch-OHLCV.md create mode 100644 docs/ccxt/wiki/examples/js/watch-OrderBook-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/js/watch-Trades-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/js/watch-tickers.md create mode 100644 docs/ccxt/wiki/examples/js/watchOHLCVForSymbols.md create mode 100644 docs/ccxt/wiki/examples/js/watchOrderBookForSymbols.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.ts.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositions.d.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositions.d.ts.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositions.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.ts.md create mode 100644 docs/ccxt/wiki/examples/js/watchPositionsForSymbols.md create mode 100644 docs/ccxt/wiki/examples/js/watchTradesForSymbols.md create mode 100644 docs/ccxt/wiki/examples/js/withdraw-from-one-exchange-to-another.md create mode 100644 docs/ccxt/wiki/examples/php/README.md create mode 100644 docs/ccxt/wiki/examples/php/arbitrage-pairs.md create mode 100644 docs/ccxt/wiki/examples/php/async-await-fetch-multiple.md create mode 100644 docs/ccxt/wiki/examples/php/async-await-fetch.md create mode 100644 docs/ccxt/wiki/examples/php/basic-error-handling.md create mode 100644 docs/ccxt/wiki/examples/php/basic-order.md create mode 100644 docs/ccxt/wiki/examples/php/binance-create-order-stop-loss-take-profit.md create mode 100644 docs/ccxt/wiki/examples/php/binance-fetch-all-trades-for-all-traded-symbols.md create mode 100644 docs/ccxt/wiki/examples/php/binance-oco-order.md create mode 100644 docs/ccxt/wiki/examples/php/binance-set-futures-leverage.md create mode 100644 docs/ccxt/wiki/examples/php/binance-spot-trailing.md create mode 100644 docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv-since-limit.md create mode 100644 docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/php/bitfinex2-fetch-trades-since.md create mode 100644 docs/ccxt/wiki/examples/php/bitmex-create-order.md create mode 100644 docs/ccxt/wiki/examples/php/build-ohlcv-bars.md create mode 100644 docs/ccxt/wiki/examples/php/built-in-rate-limiting-poller.md create mode 100644 docs/ccxt/wiki/examples/php/bybit-updated.md create mode 100644 docs/ccxt/wiki/examples/php/bytetrade-create-order.md create mode 100644 docs/ccxt/wiki/examples/php/cache-exchange-instance-reuse.md create mode 100644 docs/ccxt/wiki/examples/php/cancel-order.md create mode 100644 docs/ccxt/wiki/examples/php/cli.md create mode 100644 docs/ccxt/wiki/examples/php/coinbase-fetch-all-balances.md create mode 100644 docs/ccxt/wiki/examples/php/coinbasepro-cursor-pagination.md create mode 100644 docs/ccxt/wiki/examples/php/coinone-markets.md create mode 100644 docs/ccxt/wiki/examples/php/compare-two-exchanges-capabilities.md create mode 100644 docs/ccxt/wiki/examples/php/create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/php/create-order-ws-example.md create mode 100644 docs/ccxt/wiki/examples/php/create-orders-example.md create mode 100644 docs/ccxt/wiki/examples/php/create-trailing-amount-order.md create mode 100644 docs/ccxt/wiki/examples/php/create-trailing-percent-order.md create mode 100644 docs/ccxt/wiki/examples/php/error-handling-message.md create mode 100644 docs/ccxt/wiki/examples/php/exchange-properties.md create mode 100644 docs/ccxt/wiki/examples/php/fetch-balance.md create mode 100644 docs/ccxt/wiki/examples/php/fetch-first-ohlcv-timestamp.md create mode 100644 docs/ccxt/wiki/examples/php/fetch-ohlcv-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/php/fetch-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/php/fetch-order.md create mode 100644 docs/ccxt/wiki/examples/php/fetch-ticker.md create mode 100644 docs/ccxt/wiki/examples/php/fetch-tickers.md create mode 100644 docs/ccxt/wiki/examples/php/gateio-futures.md create mode 100644 docs/ccxt/wiki/examples/php/gateio-swaps.md create mode 100644 docs/ccxt/wiki/examples/php/huobi-fetch-balance.md create mode 100644 docs/ccxt/wiki/examples/php/huobi-futures.md create mode 100644 docs/ccxt/wiki/examples/php/huobi-swaps.md create mode 100644 docs/ccxt/wiki/examples/php/indodax-fetch-balance-create-order-cancel-order.md create mode 100644 docs/ccxt/wiki/examples/php/kraken-create-and-close-position.md create mode 100644 docs/ccxt/wiki/examples/php/kraken-query-ledgers.md create mode 100644 docs/ccxt/wiki/examples/php/kucoin-fetch-all-deposit-addresses.md create mode 100644 docs/ccxt/wiki/examples/php/kucoin-implicit-inner-transfer-v1.md create mode 100644 docs/ccxt/wiki/examples/php/latoken-example.md create mode 100644 docs/ccxt/wiki/examples/php/load-all-at-once-async.md create mode 100644 docs/ccxt/wiki/examples/php/load-all-at-once.md create mode 100644 docs/ccxt/wiki/examples/php/margin-loan-borrow-buy-sell-repay.md create mode 100644 docs/ccxt/wiki/examples/php/method-overload-override.md create mode 100644 docs/ccxt/wiki/examples/php/nonce-override.md create mode 100644 docs/ccxt/wiki/examples/php/order-book-level-depth-extra-param.md create mode 100644 docs/ccxt/wiki/examples/php/phemex-create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/php/proxy-usage.md create mode 100644 docs/ccxt/wiki/examples/php/react-eventloop-with-rate-limiting.md create mode 100644 docs/ccxt/wiki/examples/php/sample-local-proxy-server-with-cors.md create mode 100644 docs/ccxt/wiki/examples/php/shared-markets.md create mode 100644 docs/ccxt/wiki/examples/php/symbols.md create mode 100644 docs/ccxt/wiki/examples/php/trading-view.md create mode 100644 docs/ccxt/wiki/examples/php/watch-OHLCV-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/php/watch-OHLCV.md create mode 100644 docs/ccxt/wiki/examples/php/watch-OrderBook-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/php/watch-Trades-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/php/watch-tickers.md create mode 100644 docs/ccxt/wiki/examples/php/watchOHLCVForSymbols.md create mode 100644 docs/ccxt/wiki/examples/php/watchOrderBookForSymbols.md create mode 100644 docs/ccxt/wiki/examples/php/watchPositions-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/php/watchPositions.md create mode 100644 docs/ccxt/wiki/examples/php/watchPositionsForSymbols.md create mode 100644 docs/ccxt/wiki/examples/php/watchTradesForSymbols.md create mode 100644 docs/ccxt/wiki/examples/py/README.md create mode 100644 docs/ccxt/wiki/examples/py/aiohttp-custom-session-connector.md create mode 100644 docs/ccxt/wiki/examples/py/all-exchanges.md create mode 100644 docs/ccxt/wiki/examples/py/arbitrage-pairs.md create mode 100644 docs/ccxt/wiki/examples/py/asciichart.md create mode 100644 docs/ccxt/wiki/examples/py/async-analyse-augur-v1-vs-v2-exchanges.md create mode 100644 docs/ccxt/wiki/examples/py/async-balance-coinbasepro.md create mode 100644 docs/ccxt/wiki/examples/py/async-balance-gdax.md create mode 100644 docs/ccxt/wiki/examples/py/async-balance.md create mode 100644 docs/ccxt/wiki/examples/py/async-balances.md create mode 100644 docs/ccxt/wiki/examples/py/async-basic-callchain.md create mode 100644 docs/ccxt/wiki/examples/py/async-basic-orderbook.md create mode 100644 docs/ccxt/wiki/examples/py/async-basic-rate-limiter.md create mode 100644 docs/ccxt/wiki/examples/py/async-basic.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-cancel-option-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-create-margin-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-create-option-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-create-trailing-percent-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-options.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-params.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-option-OHLCV.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-option-details.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-option-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-option-orderbook.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-option-position.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-option-ticker.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-fetch-ticker-continuously.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-futures-vs-spot.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-margin-borrow.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-margin-repay.md create mode 100644 docs/ccxt/wiki/examples/py/async-binance-usdm-fetch-continuous-klines-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/py/async-bitfinex-public-get-symbols.md create mode 100644 docs/ccxt/wiki/examples/py/async-bitget-perpetual-futures-swaps.md create mode 100644 docs/ccxt/wiki/examples/py/async-bitstamp-create-limit-buy-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-bitstamp-create-order-cancel-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-bittrex-orderbook.md create mode 100644 docs/ccxt/wiki/examples/py/async-bybit-transfer.md create mode 100644 docs/ccxt/wiki/examples/py/async-fetch-balance.md create mode 100644 docs/ccxt/wiki/examples/py/async-fetch-many-orderbooks-continuously.md create mode 100644 docs/ccxt/wiki/examples/py/async-fetch-ohlcv-indicators-discord-webhook.md create mode 100644 docs/ccxt/wiki/examples/py/async-fetch-ohlcv-multiple-symbols-continuously.md create mode 100644 docs/ccxt/wiki/examples/py/async-fetch-order-book-from-many-exchanges.md create mode 100644 docs/ccxt/wiki/examples/py/async-fetch-ticker.md create mode 100644 docs/ccxt/wiki/examples/py/async-gather-concurrency.md create mode 100644 docs/ccxt/wiki/examples/py/async-gdax-fetch-order-book-continuously.md create mode 100644 docs/ccxt/wiki/examples/py/async-generator-basic.md create mode 100644 docs/ccxt/wiki/examples/py/async-generator-multiple-tickers.md create mode 100644 docs/ccxt/wiki/examples/py/async-generator-ticker-poller.md create mode 100644 docs/ccxt/wiki/examples/py/async-hollaex-sandbox.md create mode 100644 docs/ccxt/wiki/examples/py/async-instantiate-all-at-once.md create mode 100644 docs/ccxt/wiki/examples/py/async-kucoin-rate-limit.md create mode 100644 docs/ccxt/wiki/examples/py/async-macd.md create mode 100644 docs/ccxt/wiki/examples/py/async-market-making-symbols.md create mode 100644 docs/ccxt/wiki/examples/py/async-multiple-accounts.md create mode 100644 docs/ccxt/wiki/examples/py/async-multiple-parallel-calls.md create mode 100644 docs/ccxt/wiki/examples/py/async-okx-create-margin-order.md create mode 100644 docs/ccxt/wiki/examples/py/async-okx-margin-borrow.md create mode 100644 docs/ccxt/wiki/examples/py/async-okx-margin-repay.md create mode 100644 docs/ccxt/wiki/examples/py/async-okx-positional-orders.md create mode 100644 docs/ccxt/wiki/examples/py/async-orderbooks-from-multiple-exchanges-at-once.md create mode 100644 docs/ccxt/wiki/examples/py/async-orderbooks.md create mode 100644 docs/ccxt/wiki/examples/py/async-rtt.md create mode 100644 docs/ccxt/wiki/examples/py/async-theocean-orderbook.md create mode 100644 docs/ccxt/wiki/examples/py/async-theocean-tickers.md create mode 100644 docs/ccxt/wiki/examples/py/async-ticker.md create mode 100644 docs/ccxt/wiki/examples/py/async-tickers-from-many-exchanges-at-once.md create mode 100644 docs/ccxt/wiki/examples/py/async-tickers.md create mode 100644 docs/ccxt/wiki/examples/py/async-with-threads.md create mode 100644 docs/ccxt/wiki/examples/py/async.md create mode 100644 docs/ccxt/wiki/examples/py/balance-coinbasepro.md create mode 100644 docs/ccxt/wiki/examples/py/balance-gdax.md create mode 100644 docs/ccxt/wiki/examples/py/balance-kraken.md create mode 100644 docs/ccxt/wiki/examples/py/balances.md create mode 100644 docs/ccxt/wiki/examples/py/basic-chart.md create mode 100644 docs/ccxt/wiki/examples/py/basic-rate-limiting.md create mode 100644 docs/ccxt/wiki/examples/py/binance-batch-orders.md create mode 100644 docs/ccxt/wiki/examples/py/binance-coin-margined-take-profit.md create mode 100644 docs/ccxt/wiki/examples/py/binance-conditional-orders.md create mode 100644 docs/ccxt/wiki/examples/py/binance-create-oco-order-with-implicit-methods.md create mode 100644 docs/ccxt/wiki/examples/py/binance-ema.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades-paginate-by-id.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-all-trades.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-1.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-2.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-quote-volume.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-to-csv.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fetch-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/py/binance-fiat.md create mode 100644 docs/ccxt/wiki/examples/py/binance-futures-margin.md create mode 100644 docs/ccxt/wiki/examples/py/binance-futures-positions.md create mode 100644 docs/ccxt/wiki/examples/py/binance-futures-set-leverage-implicit-api.md create mode 100644 docs/ccxt/wiki/examples/py/binance-futures-set-leverage.md create mode 100644 docs/ccxt/wiki/examples/py/binance-market-order-quote-usdt.md create mode 100644 docs/ccxt/wiki/examples/py/binance-poll-balance.md create mode 100644 docs/ccxt/wiki/examples/py/binance-poll-positions.md create mode 100644 docs/ccxt/wiki/examples/py/binance-savings-endpoints.md create mode 100644 docs/ccxt/wiki/examples/py/binance-spot-trailing.md create mode 100644 docs/ccxt/wiki/examples/py/binance-stop-loss-take-profit.md create mode 100644 docs/ccxt/wiki/examples/py/binance-test-order.md create mode 100644 docs/ccxt/wiki/examples/py/binance-universal-transfer.md create mode 100644 docs/ccxt/wiki/examples/py/binance-usdm-fetch-continuous-klines-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/py/bitfinex-rate-limiting.md create mode 100644 docs/ccxt/wiki/examples/py/bitget-perpetual-futures-swaps.md create mode 100644 docs/ccxt/wiki/examples/py/bitmex-cancel-orders.md create mode 100644 docs/ccxt/wiki/examples/py/bitmex-create-order.md create mode 100644 docs/ccxt/wiki/examples/py/bitmex-fetch-ohlcv-with-extra-params.md create mode 100644 docs/ccxt/wiki/examples/py/bitmex-ohlcv-convert-5m-to-15m.md create mode 100644 docs/ccxt/wiki/examples/py/bitmex-order-value.md create mode 100644 docs/ccxt/wiki/examples/py/bittrex-fetch-closed-orders-history.md create mode 100644 docs/ccxt/wiki/examples/py/build-ohlcv-bars.md create mode 100644 docs/ccxt/wiki/examples/py/builtin-rate-limiting-long-poller.md create mode 100644 docs/ccxt/wiki/examples/py/bybit-USDC-create-option-order.md create mode 100644 docs/ccxt/wiki/examples/py/bybit-conditional-orders.md create mode 100644 docs/ccxt/wiki/examples/py/bybit-positions.md create mode 100644 docs/ccxt/wiki/examples/py/bybit-trailling.md create mode 100644 docs/ccxt/wiki/examples/py/bybit-updated.md create mode 100644 docs/ccxt/wiki/examples/py/cli.md create mode 100644 docs/ccxt/wiki/examples/py/coinbase-cancel-order.md create mode 100644 docs/ccxt/wiki/examples/py/coinbase-create-order.md create mode 100644 docs/ccxt/wiki/examples/py/coinbase-fetch-OHLCV.md create mode 100644 docs/ccxt/wiki/examples/py/coinbase-fetch-order.md create mode 100644 docs/ccxt/wiki/examples/py/coinbase-fetch-ticker.md create mode 100644 docs/ccxt/wiki/examples/py/coinbase-fetch-trades.md create mode 100644 docs/ccxt/wiki/examples/py/coinbasepro-fetch-my-trades-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/coinex-futures.md create mode 100644 docs/ccxt/wiki/examples/py/coinone-fetch-tickers.md create mode 100644 docs/ccxt/wiki/examples/py/coinone-markets.md create mode 100644 docs/ccxt/wiki/examples/py/compare-two-exchanges-capabilities.md create mode 100644 docs/ccxt/wiki/examples/py/create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/py/create-order-ws-example.md create mode 100644 docs/ccxt/wiki/examples/py/create-orders-example.md create mode 100644 docs/ccxt/wiki/examples/py/create-trailing-amount-order.md create mode 100644 docs/ccxt/wiki/examples/py/create-trailing-percent-order.md create mode 100644 docs/ccxt/wiki/examples/py/exchange-save-load-markets-cache.md create mode 100644 docs/ccxt/wiki/examples/py/exchanges-by-country.md create mode 100644 docs/ccxt/wiki/examples/py/exchanges.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-all-okex-ohclv.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-all-tickers.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-balance-asset-valuation.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-bitfinex-ohlcv-history.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-coinbasepro-ohlcv-sequentially.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-create-deposit-address.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-first-ohlcv-timestamp.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-gdax-ohlcv-sequentially.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ohlcv-cex.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ohlcv-kraken.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ohlcv-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ohlcv-mark-index-price.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ohlcv-on-new-candle.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ohlcv-sequentially.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-okex-futures.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-open-orders.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-order-book-rtt.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-orders.md create mode 100644 docs/ccxt/wiki/examples/py/fetch-ticker-many-exchanges-many-symbols.md create mode 100644 docs/ccxt/wiki/examples/py/fetch_longer_ohlcv_through_multiple_calls_and_save_to_csv.md create mode 100644 docs/ccxt/wiki/examples/py/gateio-fetch-ohlcv-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/gateio-futures.md create mode 100644 docs/ccxt/wiki/examples/py/gateio-open-close-contract.md create mode 100644 docs/ccxt/wiki/examples/py/gateio-swaps.md create mode 100644 docs/ccxt/wiki/examples/py/gdax-fetch-my-trades-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/hitbtc-withdraw.md create mode 100644 docs/ccxt/wiki/examples/py/huobi-futures.md create mode 100644 docs/ccxt/wiki/examples/py/huobi-open-close-contract.md create mode 100644 docs/ccxt/wiki/examples/py/huobi-open-close-position-bbo.md create mode 100644 docs/ccxt/wiki/examples/py/huobi-spot.md create mode 100644 docs/ccxt/wiki/examples/py/huobi-swaps.md create mode 100644 docs/ccxt/wiki/examples/py/instantiate-all-at-once.md create mode 100644 docs/ccxt/wiki/examples/py/kraken-conditional-close-order.md create mode 100644 docs/ccxt/wiki/examples/py/kraken-create-and-close-position.md create mode 100644 docs/ccxt/wiki/examples/py/kraken-fetch-my-trades-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/krakenfutures-basic.md create mode 100644 docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses-by-network.md create mode 100644 docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses.md create mode 100644 docs/ccxt/wiki/examples/py/kucoin-fetch-closed-orders-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/kucoin-rate-limit.md create mode 100644 docs/ccxt/wiki/examples/py/kucoin-withdraw-chain.md create mode 100644 docs/ccxt/wiki/examples/py/kucoinfutures-create-stop-order.md create mode 100644 docs/ccxt/wiki/examples/py/latoken-create-order.md create mode 100644 docs/ccxt/wiki/examples/py/latoken-example.md create mode 100644 docs/ccxt/wiki/examples/py/manual-rate-limiting-long-poller.md create mode 100644 docs/ccxt/wiki/examples/py/margin-leverage-order-kraken.md create mode 100644 docs/ccxt/wiki/examples/py/margin-loan-borrow-buy-sell-repay.md create mode 100644 docs/ccxt/wiki/examples/py/measure-latency.md create mode 100644 docs/ccxt/wiki/examples/py/minimal-2-lines.md create mode 100644 docs/ccxt/wiki/examples/py/multiple-subscriptions-watchXForSymbols.md create mode 100644 docs/ccxt/wiki/examples/py/normalize-sparse-candle-timestamps.md create mode 100644 docs/ccxt/wiki/examples/py/okx-fetch-all-my-trades.md create mode 100644 docs/ccxt/wiki/examples/py/okx-fetch-closed-orders-pagenumber-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/okx-position-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/py/okx-transfer.md create mode 100644 docs/ccxt/wiki/examples/py/order-book-extra-level-depth-param.md create mode 100644 docs/ccxt/wiki/examples/py/phemex-create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/py/phemex-create-stop-order.md create mode 100644 docs/ccxt/wiki/examples/py/phemex-leverage-orders.md create mode 100644 docs/ccxt/wiki/examples/py/phemex-open-cancel-close-positions.md create mode 100644 docs/ccxt/wiki/examples/py/phemex-perpetual-balance.md create mode 100644 docs/ccxt/wiki/examples/py/phemex-positions.md create mode 100644 docs/ccxt/wiki/examples/py/phemex-transfer.md create mode 100644 docs/ccxt/wiki/examples/py/playing_with_ccxt_example.md create mode 100644 docs/ccxt/wiki/examples/py/poloniex-fetch-ohlcv-continuously.md create mode 100644 docs/ccxt/wiki/examples/py/poloniex-fetch-ohlcv-with-pagination.md create mode 100644 docs/ccxt/wiki/examples/py/poloniex-fetch-order-books.md create mode 100644 docs/ccxt/wiki/examples/py/poloniex-fetch-trades-continuously.md create mode 100644 docs/ccxt/wiki/examples/py/poloniex-fetch-trades-with-pagination-to-csv.md create mode 100644 docs/ccxt/wiki/examples/py/poloniex-python2-memleak-test.md create mode 100644 docs/ccxt/wiki/examples/py/poloniex-python3-memleak-test.md create mode 100644 docs/ccxt/wiki/examples/py/proxy-usage.md create mode 100644 docs/ccxt/wiki/examples/py/rsi.md create mode 100644 docs/ccxt/wiki/examples/py/rtt.md create mode 100644 docs/ccxt/wiki/examples/py/sample-local-proxy-server-with-cors.md create mode 100644 docs/ccxt/wiki/examples/py/set_markets_from_exchange.md create mode 100644 docs/ccxt/wiki/examples/py/sign-in.md create mode 100644 docs/ccxt/wiki/examples/py/sort-swap-markets-by-hourly-price-change.md create mode 100644 docs/ccxt/wiki/examples/py/source-ip-address.md create mode 100644 docs/ccxt/wiki/examples/py/symbols.md create mode 100644 docs/ccxt/wiki/examples/py/test-server.md create mode 100644 docs/ccxt/wiki/examples/py/theocean.md create mode 100644 docs/ccxt/wiki/examples/py/tickers.md create mode 100644 docs/ccxt/wiki/examples/py/watch-OHLCV-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/py/watch-OHLCV.md create mode 100644 docs/ccxt/wiki/examples/py/watch-OrderBook-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/py/watch-Trades-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/py/watch-tickers.md create mode 100644 docs/ccxt/wiki/examples/py/watchOHLCVForSymbols.md create mode 100644 docs/ccxt/wiki/examples/py/watchOrderBookForSymbols.md create mode 100644 docs/ccxt/wiki/examples/py/watchPositions-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/py/watchPositions.md create mode 100644 docs/ccxt/wiki/examples/py/watchPositionsForSymbols.md create mode 100644 docs/ccxt/wiki/examples/py/watchTradesForSymbols.md create mode 100644 docs/ccxt/wiki/examples/py/wazirx-create-cancel-orders.md create mode 100644 docs/ccxt/wiki/examples/py/withdraw-from-one-exchange-to-another.md create mode 100644 docs/ccxt/wiki/examples/py/ws_test_load.md create mode 100644 docs/ccxt/wiki/examples/ts/README.md create mode 100644 docs/ccxt/wiki/examples/ts/benchmark.md create mode 100644 docs/ccxt/wiki/examples/ts/build-ohlcv-bars.md create mode 100644 docs/ccxt/wiki/examples/ts/compare-two-exchanges-capabilities.md create mode 100644 docs/ccxt/wiki/examples/ts/create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/ts/create-order-ws-example.md create mode 100644 docs/ccxt/wiki/examples/ts/create-orders-example.md create mode 100644 docs/ccxt/wiki/examples/ts/create-trailing-amount-order.md create mode 100644 docs/ccxt/wiki/examples/ts/create-trailing-percent-order.md create mode 100644 docs/ccxt/wiki/examples/ts/custom-proxy-agent-for-js.md create mode 100644 docs/ccxt/wiki/examples/ts/fetch-first-ohlcv-timestamp.md create mode 100644 docs/ccxt/wiki/examples/ts/fetch-ohlcv-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/ts/fetch-ohlcv.md create mode 100644 docs/ccxt/wiki/examples/ts/hibachi-example.md create mode 100644 docs/ccxt/wiki/examples/ts/how-to-import-one-exchange-esm.md create mode 100644 docs/ccxt/wiki/examples/ts/kraken-create-and-close-position.md create mode 100644 docs/ccxt/wiki/examples/ts/margin-loan-borrow-buy-sell-repay.md create mode 100644 docs/ccxt/wiki/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.md create mode 100644 docs/ccxt/wiki/examples/ts/proxy-usage.md create mode 100644 docs/ccxt/wiki/examples/ts/sample-local-proxy-server-with-cors.md create mode 100644 docs/ccxt/wiki/examples/ts/watch-OHLCV-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/ts/watch-OHLCV.md create mode 100644 docs/ccxt/wiki/examples/ts/watch-OrderBook-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/ts/watch-Trades-For-Symbols.md create mode 100644 docs/ccxt/wiki/examples/ts/watch-tickers.md create mode 100644 docs/ccxt/wiki/examples/ts/watchPositions-many-exchanges-continuosly.md create mode 100644 docs/ccxt/wiki/examples/ts/watchPositions.md create mode 100644 docs/ccxt/wiki/examples/ts/watchPositionsForSymbols.md create mode 100644 docs/ccxt/wiki/exchangePartials/body.hbs create mode 100644 docs/ccxt/wiki/exchangePartials/deprecated.hbs create mode 100644 docs/ccxt/wiki/exchangePartials/docs.hbs create mode 100644 docs/ccxt/wiki/exchangePartials/header.hbs create mode 100644 docs/ccxt/wiki/exchangePartials/member-index-list.hbs create mode 100644 docs/ccxt/wiki/exchangePartials/members.hbs create mode 100644 docs/ccxt/wiki/exchangePartials/params-table.hbs create mode 100644 docs/ccxt/wiki/exchangePartials/returns.hbs create mode 100644 docs/ccxt/wiki/exchanges/.gitkeep create mode 100644 docs/ccxt/wiki/exchanges/alpaca.md create mode 100644 docs/ccxt/wiki/exchanges/apex.md create mode 100644 docs/ccxt/wiki/exchanges/ascendex.md create mode 100644 docs/ccxt/wiki/exchanges/backpack.md create mode 100644 docs/ccxt/wiki/exchanges/bigone.md create mode 100644 docs/ccxt/wiki/exchanges/binance.md create mode 100644 docs/ccxt/wiki/exchanges/bingx.md create mode 100644 docs/ccxt/wiki/exchanges/bit2c.md create mode 100644 docs/ccxt/wiki/exchanges/bitbank.md create mode 100644 docs/ccxt/wiki/exchanges/bitbns.md create mode 100644 docs/ccxt/wiki/exchanges/bitfinex.md create mode 100644 docs/ccxt/wiki/exchanges/bitflyer.md create mode 100644 docs/ccxt/wiki/exchanges/bitget.md create mode 100644 docs/ccxt/wiki/exchanges/bithumb.md create mode 100644 docs/ccxt/wiki/exchanges/bitmart.md create mode 100644 docs/ccxt/wiki/exchanges/bitmex.md create mode 100644 docs/ccxt/wiki/exchanges/bitopro.md create mode 100644 docs/ccxt/wiki/exchanges/bitrue.md create mode 100644 docs/ccxt/wiki/exchanges/bitso.md create mode 100644 docs/ccxt/wiki/exchanges/bitstamp.md create mode 100644 docs/ccxt/wiki/exchanges/bitteam.md create mode 100644 docs/ccxt/wiki/exchanges/bittrade.md create mode 100644 docs/ccxt/wiki/exchanges/bitvavo.md create mode 100644 docs/ccxt/wiki/exchanges/blockchaincom.md create mode 100644 docs/ccxt/wiki/exchanges/blofin.md create mode 100644 docs/ccxt/wiki/exchanges/btcalpha.md create mode 100644 docs/ccxt/wiki/exchanges/btcbox.md create mode 100644 docs/ccxt/wiki/exchanges/btcmarkets.md create mode 100644 docs/ccxt/wiki/exchanges/btcturk.md create mode 100644 docs/ccxt/wiki/exchanges/bybit.md create mode 100644 docs/ccxt/wiki/exchanges/cex.md create mode 100644 docs/ccxt/wiki/exchanges/coinbase.md create mode 100644 docs/ccxt/wiki/exchanges/coinbaseexchange.md create mode 100644 docs/ccxt/wiki/exchanges/coinbaseinternational.md create mode 100644 docs/ccxt/wiki/exchanges/coincatch.md create mode 100644 docs/ccxt/wiki/exchanges/coincheck.md create mode 100644 docs/ccxt/wiki/exchanges/coinex.md create mode 100644 docs/ccxt/wiki/exchanges/coinmate.md create mode 100644 docs/ccxt/wiki/exchanges/coinmetro.md create mode 100644 docs/ccxt/wiki/exchanges/coinone.md create mode 100644 docs/ccxt/wiki/exchanges/coinsph.md create mode 100644 docs/ccxt/wiki/exchanges/coinspot.md create mode 100644 docs/ccxt/wiki/exchanges/cryptocom.md create mode 100644 docs/ccxt/wiki/exchanges/cryptomus.md create mode 100644 docs/ccxt/wiki/exchanges/defx.md create mode 100644 docs/ccxt/wiki/exchanges/delta.md create mode 100644 docs/ccxt/wiki/exchanges/deribit.md create mode 100644 docs/ccxt/wiki/exchanges/derive.md create mode 100644 docs/ccxt/wiki/exchanges/digifinex.md create mode 100644 docs/ccxt/wiki/exchanges/exmo.md create mode 100644 docs/ccxt/wiki/exchanges/foxbit.md create mode 100644 docs/ccxt/wiki/exchanges/gate.md create mode 100644 docs/ccxt/wiki/exchanges/gemini.md create mode 100644 docs/ccxt/wiki/exchanges/hashkey.md create mode 100644 docs/ccxt/wiki/exchanges/hibachi.md create mode 100644 docs/ccxt/wiki/exchanges/hitbtc.md create mode 100644 docs/ccxt/wiki/exchanges/hollaex.md create mode 100644 docs/ccxt/wiki/exchanges/htx.md create mode 100644 docs/ccxt/wiki/exchanges/hyperliquid.md create mode 100644 docs/ccxt/wiki/exchanges/independentreserve.md create mode 100644 docs/ccxt/wiki/exchanges/indodax.md create mode 100644 docs/ccxt/wiki/exchanges/kraken().md create mode 100644 docs/ccxt/wiki/exchanges/krakenfutures.md create mode 100644 docs/ccxt/wiki/exchanges/kucoin.md create mode 100644 docs/ccxt/wiki/exchanges/kucoinfutures.md create mode 100644 docs/ccxt/wiki/exchanges/latoken.md create mode 100644 docs/ccxt/wiki/exchanges/lbank.md create mode 100644 docs/ccxt/wiki/exchanges/luno.md create mode 100644 docs/ccxt/wiki/exchanges/mercado.md create mode 100644 docs/ccxt/wiki/exchanges/mexc.md create mode 100644 docs/ccxt/wiki/exchanges/modetrade.md create mode 100644 docs/ccxt/wiki/exchanges/ndax.md create mode 100644 docs/ccxt/wiki/exchanges/novadax.md create mode 100644 docs/ccxt/wiki/exchanges/oceanex.md create mode 100644 docs/ccxt/wiki/exchanges/okcoin.md create mode 100644 docs/ccxt/wiki/exchanges/okx.md create mode 100644 docs/ccxt/wiki/exchanges/onetrading.md create mode 100644 docs/ccxt/wiki/exchanges/oxfun.md create mode 100644 docs/ccxt/wiki/exchanges/p2b.md create mode 100644 docs/ccxt/wiki/exchanges/paradex().md create mode 100644 docs/ccxt/wiki/exchanges/paymium.md create mode 100644 docs/ccxt/wiki/exchanges/phemex.md create mode 100644 docs/ccxt/wiki/exchanges/poloniex.md create mode 100644 docs/ccxt/wiki/exchanges/probit.md create mode 100644 docs/ccxt/wiki/exchanges/timex.md create mode 100644 docs/ccxt/wiki/exchanges/tokocrypto.md create mode 100644 docs/ccxt/wiki/exchanges/toobit.md create mode 100644 docs/ccxt/wiki/exchanges/upbit.md create mode 100644 docs/ccxt/wiki/exchanges/wavesexchange.md create mode 100644 docs/ccxt/wiki/exchanges/whitebit.md create mode 100644 docs/ccxt/wiki/exchanges/woo.md create mode 100644 docs/ccxt/wiki/exchanges/woofipro.md create mode 100644 docs/ccxt/wiki/exchanges/xt.md create mode 100644 docs/ccxt/wiki/exchanges/yobit.md create mode 100644 docs/ccxt/wiki/exchanges/zaif.md create mode 100644 docs/ccxt/wiki/exchanges/zonda.md create mode 100644 docs/ccxt/wiki/favicon.ico create mode 100644 docs/ccxt/wiki/helpers.cjs create mode 100644 docs/ccxt/wiki/index.html create mode 100644 docs/ccxt/wiki/partials/body.hbs create mode 100644 docs/ccxt/wiki/partials/deprecated.hbs create mode 100644 docs/ccxt/wiki/partials/docs.hbs create mode 100644 docs/ccxt/wiki/partials/header.hbs create mode 100644 docs/ccxt/wiki/partials/member-index-list.hbs create mode 100644 docs/ccxt/wiki/partials/members.hbs create mode 100644 docs/ccxt/wiki/partials/params-table.hbs create mode 100644 docs/ccxt/wiki/partials/returns.hbs create mode 100644 docs/ccxt/wiki/spec.hbs create mode 100644 src/exchanges/backpack/adapter.ts create mode 100644 src/exchanges/backpack/gateway.ts diff --git a/.env.example b/.env.example index 133e3a1..839cb70 100644 --- a/.env.example +++ b/.env.example @@ -61,3 +61,20 @@ LIGHTER_ENV=testnet # mainnet | testnet | staging | dev # LIGHTER_MARKET_ID=1 # Prefer explicit market id when symbols differ # LIGHTER_PRICE_DECIMALS=3 # Manual override for price decimals (optional) # LIGHTER_SIZE_DECIMALS=3 # Manual override for size decimals (optional) + +# Backpack exchange configuration +# Fill these with your Backpack API credentials and preferences + +BACKPACK_API_KEY= +BACKPACK_API_SECRET= +BACKPACK_PASSWORD= +BACKPACK_SUBACCOUNT= + +# Use sandbox environment: "true" to enable, otherwise leave as false +BACKPACK_SANDBOX=false + +# Default trading symbol (falls back to TRADE_SYMBOL or BTCUSDC) +BACKPACK_SYMBOL=BTC_USD_PERP + +# Enable verbose adapter logging: set to "1" or "true" +BACKPACK_DEBUG=false \ No newline at end of file diff --git a/docs/backpack/openapi.json b/docs/backpack/openapi.json new file mode 100644 index 0000000..d1b2d9e --- /dev/null +++ b/docs/backpack/openapi.json @@ -0,0 +1,12447 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Backpack Exchange API", + "description": "\n# Introduction\n\nWelcome to the Backpack Exchange API. This API is for programmatic trade execution. All of the endpoints require requests to be signed with an ED25519 keypair for authentication.\n\nThe API is hosted at `https://api.backpack.exchange/` and the WS API is hosted at `wss://ws.backpack.exchange/`.\n\n# Authentication\n\n\n## Signing requests\n\nSigned requests are required for any API calls that mutate state. Additionally, some read only requests can be performed by signing or via session authentication.\n\nSigned requests require the following additional headers:\n\n- `X-Timestamp` - Unix time in milliseconds that the request was sent.\n- `X-Window` - Time window in milliseconds that the request is valid for, default is `5000` and maximum is `60000`.\n- `X-API-Key` - Base64 encoded verifying key of the ED25519 keypair.\n- `X-Signature` - Base64 encoded signature generated according to the instructions below.\n\nTo generate a signature perform the following:\n\n1) The key/values of the request body or query parameters should be ordered alphabetically and then turned into query string format.\n\n2) Append the header values for the timestamp and receive window to the above generated string in the format `×tamp=&window=`. If no `X-Window` header is passed the default value of `5000` still needs to be added to the signing string.\n\nEach request also has an instruction type, valid instructions are:\n\n```\naccountQuery\nbalanceQuery\nborrowLendExecute\nborrowHistoryQueryAll\ncollateralQuery\ndepositAddressQuery\ndepositQueryAll\nfillHistoryQueryAll\nfundingHistoryQueryAll\ninterestHistoryQueryAll\norderCancel\norderCancelAll\norderExecute\norderHistoryQueryAll\norderQuery\norderQueryAll\npnlHistoryQueryAll\npositionQuery\nquoteSubmit\nstrategyCancel\nstrategyCancelAll\nstrategyCreate\nstrategyHistoryQueryAll\nstrategyQuery\nstrategyQueryAll\nwithdraw\nwithdrawalQueryAll\n```\n\nThe correct instruction type should be prefixed to the signing string. The instruction types for each request are documented alongside the request.\n\nFor example, an API request to cancel an order with the following body:\n\n```json\n{\n \"orderId\": 28\n \"symbol\": \"BTC_USDT\",\n}\n```\n\nWould require the following to be signed:\n\n```text\ninstruction=orderCancel&orderId=28&symbol=BTC_USDT×tamp=1614550000000&window=5000\n```\n\nRegarding batch order execution (`POST /orders`), for each order in the batch, the order parameters should be ordered alphabetically and then turned into query string format. The orderExecute instruction should then be prefixed to that string.\nThe query strings for the orders should be concatenated with `&` and the timestamp and window appended at the end.\n\nFor example, an API request for an order execution batch with the following body:\n\n```json\n[\n {\n \"symbol\": \"SOL_USDC_PERP\",\n \"side\": \"Bid\",\n \"orderType\": \"Limit\",\n \"price\": \"141\",\n \"quantity\": \"12\"\n },\n {\n \"symbol\": \"SOL_USDC_PERP\",\n \"side\": \"Bid\",\n \"orderType\": \"Limit\",\n \"price\": \"140\",\n \"quantity\": \"11\"\n }\n]\n```\n\nWould require the following to be signed:\n\n```text\ninstruction=orderExecute&orderType=Limit&price=141&quantity=12&side=Bid&symbol=SOL_USDC_PERP&instruction=orderExecute&orderType=Limit&price=140&quantity=11&side=Bid&symbol=SOL_USDC_PERP×tamp=1750793021519&window=5000\n```\n\nIf the API endpoint requires query parameters instead of a request body, the same procedure should be used on the query parameters. If the API endpoint does not have a request body or query parameters, only the timestamp and receive window need to be signed.\n\nThis message should be signed using the private key of the ED25519 keypair that corresponds to the public key in the `X-API-Key` header. The signature should then be base64 encoded and submitted in the `X-Signature` header.\n\n\n

\n\n---\n\n# Changelog\n\n## 2025-09-02\n\n- The `/depth` endpoint now returns a limit of 5,000 price levels on each side of the book.\n\n## 2025-09-01\n\n- The `cumulativeInterest` response field is being removed from the `/position`endpoint.\n- Estimated liquidation price or `l` is being removed from the position update stream. It will remain as a placeholder\n and be set to 0. It will be removed in the future, so client's should not rely on its presence.\n- Liquidation price can be queried for a single position using the Positions API `/position` for example\n `/position?symbol=BTC_USDC_PERP`.\n\n## 2025-08-07\n\n- `/history/pnl` has been removed.\n\n## 2025-06-08\n\n- The order id format is changing, it is no longer a byte shifted timestamp. It is no longer possible to derive the\n order timestamp from the order id. This change will take place at Monday June 9th, 01:00 UTC.\n\n## 2025-04-22\n\n- The `/fills` endpoint now returns all fills for the account, including fills from system orders as well as client\n orders. System orders include liquidations, ADLs and collateral conversions. Previously, by default, it only returned\n fills from client orders. This behavior can be achieved by setting the `fillType` parameter to `User`.\n\n## 2025-04-08\n\n- Added funding rate lower and upper bounds to `/markets` and `/market` endpoints.\n\n## 2025-03-26\n\n- Add open interest stream `openInterest.`.\n- Added the option to query `/history/borrowLend/positions` with a signed request using the instruction\n `borrowPositionHistoryQueryAll`.\n\n## 2025-03-19\n\n- The leverage filter has been removed from `/markets` and `/market` endpoints.\n- Added `/openInterest` now takes `symbol` as an optional parameter. When not set, all markets are returned.\n- `/openInterests` has been deprecated.\n- Add stop loss and take profit fields to `/orders/execute`.\n- Add `I` field to the order update stream (related order id).\n- Add `a` and `b` fields to the order update stream (take profit trigger price and stop loss trigger price).\n\n## 2025-02-28\n\n- Added `clientId` to fill history.\n\n## 2025-02-11\n\n- An `O` field has been added to the order update stream. It denotes the origin of the update. The possible values are:\n - `USER`: The origin of the update was due to order entry by the user.\n - `LIQUIDATION_AUTOCLOSE`: The origin of the update was due to a liquidation by the liquidation engine.\n - `ADL_AUTOCLOSE`: The origin of the update was due to an ADL (auto-deleveraging) event.\n - `COLLATERAL_CONVERSION`: The origin of the update was due to a collateral conversion to settle debt on the\n account.\n - `SETTLEMENT_AUTOCLOSE`: The origin of the update was due to the settlement of a position on a dated market.\n - `BACKSTOP_LIQUIDITY_PROVIDER`: The origin of the update was due to a backstop liquidity provider facilitating a\n liquidation.\n\n## 2025-02-07\n\n- Added `r` to denote a reduce only order on the order updates stream.\n- Added `reduceOnly` to the get orders endpoint.\n\n## 2025-02-03\n\n- Added `openInterestLimit` to the markets endpoint. Applicable to futures markets only.\n- Added `orderModified` event to the order update stream. A resting reduce only order's quantity can be decreased in\n order to prevent position side reversal.\n\n## 2025-01-09\n\n- Added `marketType` to the markets endpoint.\n- Added an optional `marketType` filter to the fills and the orders endpoints.\n\n## 2024-12-03\n\n- Add order expiry reason to order update stream.\n- Add `cumulativeInterest` to borrow lend position.\n\n## 2024-12-02\n\n- Add borrow lend history per position endpoint.\n\n## 2024-11-10\n\n- Add `timestamp` field denoting the system time in unix-epoch microseconds to the depth endpoint.\n\n## 2024-10-15\n\n- Convert all error responses to JSON and add a error code.\n\n## 2024-05-14\n\n- Add `executedQuantity` and `executedQuoteQuantity` to order history endpoint.\n\n## 2024-05-03\n\n- Add single market order update stream `account.orderUpdate.`.\n\n## 2024-05-02\n\n- Add optional `from` and `to` timestamp to get withdrawals endpoint.\n\n## 2024-05-01\n\n- Add optional `from` and `to` timestamp to get deposits endpoint.\n\n## 2024-03-14\n\n- Add optional `orderId` filter to order history endpoint.\n- Add optional `from` and `to` timestamp to order fills endpoint.\n\n## 2024-02-28\n\n- Return the withdrawal in request withdrawal response.\n\n## 2024-02-24\n\n- An additional field `t` was added to the private order update stream. It is the `trade_id` of the fill that generated\n the order update.\n- Added a maximum value for the `X-Window` header of `60000`.\n\n## 2024-01-16\n\n### Breaking\n\n- A new websocket API is available at `wss://ws.backpack.exchange`. Please see the documentation. The previous API\n remains on the same endpoint and will be deprecated after a migration period. The new API changes the following:\n - Subscription endpoint is now `wss://ws.backpack.exchange` instead of `wss://ws.backpack.exchange/stream`.\n - Can subscribe and unsubscribe to/from multiple streams by passing more than one in the `params` field.\n - Signature should now be sent in a separate `signature` field.\n - Signature instruction changed from `accountQuery` to `subscribe`.\n - Event and engine timestamps are now in `microseconds` instead of `milliseconds`.\n - Add engine timestamp to `bookTicker`, `depth`, and `order` streams.\n - Add quote asset volume to ticker stream.\n - Add sequential trade id to trade stream.\n - Rename the event type in the depth stream from `depthEvent` to `depth`.\n - Change the format of streams from `@` to `.` or `kline..` for\n K-lines.\n - Flatten the K-Line in the K-line stream so its not nested.\n\n## 2024-01-11\n\n### Breaking\n\n- Replaced `identifier` field on deposits with `transaction_hash` and `provider_id`.\n This aims to provide clearer representation of the field, particularly for fiat deposits.\n- Removed duplicate `pending` values from the `WithdrawalStatus` and `DepositStatus` spec enum.\n\n\n

\n\n---\n ", + "version": "1.0", + "x-logo": { + "url": "https://raw.githubusercontent.com/backpack-exchange/bpx-openapi/refs/heads/master/assets/backpack.png" + } + }, + "servers": [ + { + "url": "https://api.backpack.exchange" + } + ], + "tags": [ + { + "name": "Account", + "description": "Account settings and limits." + }, + { + "name": "Assets", + "description": "Assets and collateral data." + }, + { + "name": "Borrow Lend", + "description": "Borrowing and lending." + }, + { + "name": "Borrow Lend Markets", + "description": "Borrowing and lending." + }, + { + "name": "Capital", + "description": "Capital management." + }, + { + "name": "Funding", + "description": "Futures funding." + }, + { + "name": "Futures", + "description": "Futures data." + }, + { + "name": "History", + "description": "Historical account data." + }, + { + "name": "Markets", + "description": "Public market data." + }, + { + "name": "Order", + "description": "Order management." + }, + { + "name": "Position", + "description": "Account position summary." + }, + { + "name": "Request For Quote", + "description": "Request For Quote." + }, + { + "name": "Strategy", + "description": "Strategies." + }, + { + "name": "Streams", + "description": "# Usage\n\n## Subscribing\n\nTo use the websocket API, connect to\n`wss://ws.backpack.exchange`.\n\nTo subscribe to a stream with the name `stream` send a text frame\nover the websocket connection with the following JSON payload:\n\n```\n{\n \"method\": \"SUBSCRIBE\",\n \"params\": [\"stream\"]\n}\n```\n\nSimilarly, to unsubscribe from a stream with the name `stream`:\n\n```\n{\n \"method\": \"UNSUBSCRIBE\",\n \"params\": [\"stream\"]\n}\n```\n\nYou can subscribe or unsubscribe from multiple streams if you include\nmore than one in the params field.\n\nAll data from streams is wrapped in a JSON object of the following form:\n\n```\n{\n \"stream\": \"\",\n \"data\": \"\"\n}\n```\n\nThe following command can be used to test subscribing to a stream:\n```\n(sleep 1; \\\necho '{\"method\":\"SUBSCRIBE\",\"params\":[\"depth.SOL_USDC\"]}';\\\ncat) |\\\nwscat -c wss://ws.backpack.exchange\n```\nThe payloads for each stream time are outlined below.\n\n## Timing\n\nTimestamps are in microseconds (except for the K-line start and end\ntimes). The event timestamp is the time the event was emitted from\nthe websocket server, and the engine timestamp is the time the event\nwas generated by the matching engine.\n\nIf a message aggregates more than one event (for example, a depth\nmessage), the engine timestamp will be the timestamp of the last\nmatching engine event.\n\n## Keeping the connection alive\n\nTo keep the connection alive, a `Ping` frame will be sent from the\nserver every 60s, and a `Pong` is expected to be received from the\nclient. If a `Pong` is not received within 120s, a `Close` frame will be\nsent and the connection will be closed.\n\nIf the server is shutting down, a `Close` frame will be sent and then a\ngrace period of 30s will be given before the connection is closed. The\nclient should reconnect after receiving the `Close` frame. The client\nwill be reconnected to a server that is not shutting down.\n\n# Private\n\nSubscribing to a private stream requires a valid signature generated\nfrom an ED25519 keypair. For stream subscriptions, the signature\nshould be of the form:\n\n```text\ninstruction=subscribe×tamp=1614550000000&window=5000\n```\n\nWhere the timestamp and window are in milliseconds.\n\nPrivate streams are prefixed with `account.` and require signature data\nto be submitted in the subscribe parameters. The verifying key and\nsignature should be base64 encoded.\n\n```\n{\n \"method\": \"SUBSCRIBE\",\n \"params\": [\"stream\"],\n \"signature\": [\"\", \"\", \"\", \"\"]\n}\n````\n\n## Order update\n\nOn any mutation to an order the order will be pushed to the order update\nstream. The event type of the order update will be one of the\nfollowing:\n\n- `orderAccepted`\n- `orderCancelled`\n- `orderExpired`\n- `orderFill`\n- `orderModified`\n- `triggerPlaced`\n- `triggerFailed`\n\nAn `orderModified` update will be received when a resting reduce only\norder's quantity is decreased in order to prevent position side\nreversal.\n\n### Stream Name Format\n- For all markets: `account.orderUpdate`\n- For single market: `account.orderUpdate.`\n\n```\n{\n \"e\": \"orderAccepted\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USD\", // Symbol\n \"c\": 123, // Client order ID\n \"S\": \"Bid\", // Side\n \"o\": \"LIMIT\", // Order type\n \"f\": \"GTC\", // Time in force\n \"q\": \"32123\", // Quantity\n \"Q\": \"32123\", // Quantity in quote\n \"p\": \"20\", // Price\n \"P\": \"21\", // Trigger price\n \"B\": \"LastPrice\", // Trigger by\n \"a\": \"30\", // Take profit trigger price\n \"b\": \"10\", // Stop loss trigger price\n \"d\": \"MarkPrice\", // Take profit trigger by\n \"g\": \"IndexPrice\", // Stop loss trigger by\n \"Y\": \"10\", // Trigger quantity\n \"X\": \"Filled\", // Order state\n \"R\": \"PRICE_BAND\", // Order expiry reason\n \"i\": \"1111343026172067\" // Order ID\n \"t\": 567, // Trade ID\n \"l\": \"1.23\", // Fill quantity\n \"z\": \"321\", // Executed quantity\n \"Z\": \"123\", // Executed quantity in quote\n \"L\": \"20\", // Fill price\n \"m\": true, // Whether the order was maker\n \"n\": \"23\", // Fee\n \"N\": \"USD\", // Fee symbol\n \"V\": \"RejectTaker\", // Self trade prevention\n \"T\": 1694687692989999, // Engine timestamp in microseconds\n \"O\": \"USER\" // Origin of the update\n \"I\": \"1111343026156135\" // Related order ID\n \"H\": 6023471188 // Strategy ID\n \"y\": true // Post only\n}\n```\n\nThere are several possible values for the `O` field (origin of the\nupdate):\n- `USER`: The origin of the update was due to order entry by the user.\n- `LIQUIDATION_AUTOCLOSE`: The origin of the update was due to a\nliquidation by the liquidation engine.\n- `ADL_AUTOCLOSE`: The origin of the update was due to an ADL\n(auto-deleveraging) event.\n- `COLLATERAL_CONVERSION`: The origin of the update was due to a\ncollateral conversion to settle debt on the account.\n- `SETTLEMENT_AUTOCLOSE`: The origin of the update was due to the\nsettlement of a position on a dated market.\n- `BACKSTOP_LIQUIDITY_PROVIDER`: The origin of the update was due to a\nbackstop liquidity provider facilitating a liquidation.\n\nSome fields are conditional on the order settings or event type:\n\n- `c` - Only present if the order has a client order ID.\n- `q` - Only present if the order has a quantity set.\n- `Q` - Only present if the order is reverse market order.\n- `p` - Only present if the order is a limit order.\n- `P` - Only present if the order is a trigger order.\n- `B` - Only present if the order is a trigger order.\n- `a` - Only present if the order has a take profit trigger price set.\n- `b` - Only present if the order has a stop loss trigger price set.\n- `d` - Only present if the order has a take profit trigger price set.\n- `g` - Only present if the order has a stop loss trigger price set.\n- `Y` - Only present if the order is a trigger order.\n- `R` - Only present if the event is a `orderExpired` event.\n- `t` - Only present if the event is a `orderFill` event.\n- `l` - Only present if the event is a `orderFill` event.\n- `L` - Only present if the event is a `orderFill` event.\n- `m` - Only present if the event is a `orderFill` event.\n- `n` - Only present if the event is a `orderFill` event.\n- `N` - Only present if the event is a `orderFill` event.\n\n## Position update\n\nOn any mutation to a position the position will be pushed to the\nposition update stream. The event type of the position update will\nbe one of the following:\n\n- `positionAdjusted`\n- `positionOpened`\n- `positionClosed`\n\nOn subscription, a message will be sent to the client with the current\nopen positions, if any. The `e` field will not be present in the\nmessage.\n\n### Stream Name Format\n- For all markets: `account.positionUpdate`\n- For single market: `account.positionUpdate.`\n\n```\n{\n \"e\": \"positionOpened\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USDC_PERP\", // Symbol\n \"b\": 123, // Break event price\n \"B\": 122, // Entry price\n \"f\": 0.5, // Initial margin fraction\n \"M\": 122, // Mark price\n \"m\": 0.01, // Maintenance margin fraction\n \"q\": 5, // Net quantity\n \"Q\": 6, // Net exposure quantity\n \"n\": 732 , // Net exposure notional\n \"i\": \"1111343026172067\" // Position ID\n \"p\": \"-1\", // PnL realized\n \"P\": \"0\", // PnL unrealized\n \"T\": 1694687692989999 // Engine timestamp in microseconds\n}\n```\n\nThe net quantity field will be positive if the position is long and\nnegative if the position is short.\n\nThe net exposure quantity field includes exposure from the open\nposition, as well as any open orders.\n\n## RFQ Update\n\nThis WebSocket stream provides real-time updates on RFQs (Request for\nQuotes) that are relevant to makers. Events are pushed to this\nstream whenever there is a significant state change in an RFQ or its\nassociated quotes, allowing makers to monitor and respond to RFQs as\nthey progress through various states.\n\n### Event Types\n\nFor RFQs that submitted by other requesters.\n- `rfqActive`: Indicates that an RFQ is active and open for quotes.\n\nFor RFQs that submitted by your account.\n- `rfqAccepted`: Indicates that an RFQ has been accepted and is no\n- `rfqRefreshed`: Indicates that an RFQ has been refreshed, is active\nand open for quotes.\n- `rfqCancelled`: Indicates that an RFQ has been cancelled or expired.\n- `rfqCandidate`: RFQ has received a new best quote.\n- `rfqFilled`: Indicates that an RFQ has been fully filled with a quote.\n\nFor Quotes submitted by your account.\n- `quoteAccepted`: Indicates that a quote submitted by the maker has\nbeen accepted.\n- `quoteCancelled`: Indicates that a quote has been cancelled due to\nquote submission, RFQ being filled, refreshed, cancelled, or expired.\n\n### Quote Submission and RFQ Timing\n\nMakers should submit quotes before the **submission time** (`w` field)\nis reached, as indicated in each `rfqActive` event. An RFQ remains\nactive until the **expiration time** (`W` field). If no quote is\naccepted or the RFQ is not cancelled, makers may continue to submit\nquotes until expiration.\n\nRFQs can periodically request new quotes by issuing additional\n`rfqActive` events. Each new `rfqActive` event will have the same\nRFQ ID (`R` field) but updated values for **submission time** and\n**expiration time**, allowing makers to participate in extended or\nrenewed quoting periods for ongoing RFQs.\n\n### Stream Name Format\n- For all markets: `account.rfqUpdate`\n- For single market: `account.rfqUpdate.`\n\n### Example Messages\n\n**RFQ Accepted** (sent to requester)\n```\n{\n \"e\": \"rfqAccepted\", // Event type\n \"E\": 1730225420369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"q\": \"10\", // Quantity (if quantity in base asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"New\", // RFQ status\n \"T\": 1730225420368765 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Active** (broadcast to all rfq listeners)\n```\n{\n \"e\": \"rfqActive\", // Event type\n \"E\": 1730225420369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"q\": \"10\", // Quantity (optional) (if quantity in base asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"New\", // RFQ status\n \"T\": 1730225420368765 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Refreshed** (sent to requester)\n```\n{\n \"e\": \"rfqRefreshed\", // Event type\n \"E\": 1730225450369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"q\": \"10\", // Quantity (optional) (if quantity in base asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"New\", // RFQ status\n \"T\": 1730225450368765 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Cancelled** (sent to taker only)\n```\n{\n \"e\": \"rfqCancelled\", // Event type\n \"E\": 1730225460369829, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"Q\": \"150\", // Quote quantity (optional) (if quantity in quote asset)\n \"w\": 1730225480368, // Submission time in milliseconds\n \"W\": 1730225540368, // Expiry time in milliseconds\n \"X\": \"Cancelled\", // RFQ status\n \"T\": 1730225460368765 // Engine timestamp in microseconds\n}\n```\n\n**Quote Accepted** (sent to quoter)\n```\n{\n \"e\": \"quoteAccepted\", // Event type\n \"E\": 1730225434631394, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client Quote ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"X\": \"New\", // Quote status\n \"T\": 1730225434629778 // Engine timestamp in microseconds\n}\n```\n\n**Quote Cancelled** (sent to quoter)\n```\n{\n \"e\": \"quoteCancelled\", // Event type\n \"E\": 1730225583761963, // Event time in microseconds\n \"R\": 113392061354344448, // RFQ ID\n \"u\": 113392062870847488, // Quote ID\n \"C\": \"123\", // Client Quote ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"X\": \"Cancelled\", // Quote status\n \"T\": 1730225583753811 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Candidate** (sent to requester with quote details)\n```\n{\n \"e\": \"rfqCandidate\", // Event type\n \"E\": 1730225490648996, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"q\": \"10\", // RFQ quantity (in base asset)\n \"Q\": \"150\", // RFQ quote quantity (in quote asset)\n \"p\": \"15.50\", // Taker price (quote price + fee)\n \"X\": \"New\", // RFQ status\n \"T\": 1730225490647080 // Engine timestamp in microseconds\n}\n```\n\n**RFQ Filled** (sent to both requester and quoter)\n```\n// To requester\n{\n \"e\": \"rfqFilled\", // Event type\n \"E\": 1730225497648996, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client RFQ ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"S\": \"Bid\", // RFQ side\n \"Q\": \"150\", // RFQ quote quantity (optional) (if quantity in quote asset)\n \"p\": \"15.50\", // Taker price (quote price + fee)\n \"X\": \"Filled\", // RFQ status\n \"T\": 1730225497647080 // Engine timestamp in microseconds\n}\n\n// To quoter\n{\n \"e\": \"rfqFilled\", // Event type\n \"E\": 1730225497648996, // Event time in microseconds\n \"R\": 113392053149171712, // RFQ ID\n \"u\": 113392054083780608, // Quote ID\n \"C\": \"123\", // Client Quote ID\n \"s\": \"SOL_USDC_RFQ\", // Symbol\n \"p\": \"15.00\", // Price\n \"X\": \"Filled\", // Quote status\n \"T\": 1730225497647080 // Engine timestamp in microseconds\n}\n```\n\n### Field Descriptions\n\n- `e` - Event type (e.g., `rfqActive`, `rfqAccepted`, `rfqRefreshed`,\n`rfqCancelled`, `quoteAccepted`, `quoteCancelled`, `rfqCandidate`,\n`rfqFilled`).\n- `E` - Event time in microseconds.\n- `R` - RFQ ID, identifying the request for quote.\n- `u` - Quote ID, identifying the specific quote.\n- `C` - Client ID (either Client RFQ ID or Client Quote ID depending on\ncontext).\n- `s` - Symbol the RFQ is for.\n- `S` - Side of the RFQ, either \"Bid\" or \"Ask\".\n- `q` - Quantity for the RFQ (in base asset, if quantity in base asset).\n- `Q` - Quote quantity for the RFQ (in quote asset, if quantity in quote\nasset).\n- `p` - Price associated with the quote/fill event.\n- `w` - Submission time for the RFQ in milliseconds.\n- `W` - Expiry time for the RFQ in milliseconds.\n- `X` - Order status (e.g., `New`, `Cancelled`, `Filled`).\n- `T` - Engine timestamp in microseconds.\n\nSome fields are conditional and may be present only in specific events.\n\n# Public\n\n## Book ticker\n\nStream name format: `bookTicker.`\n```\n{\n \"e\": \"bookTicker\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"a\": \"18.70\", // Inside ask price\n \"A\": \"1.000\", // Inside ask quantity\n \"b\": \"18.67\", // Inside bid price\n \"B\": \"2.000\", // Inside bid quantity\n \"u\": \"111063070525358080\", // Update ID of event\n \"T\": 1694687965940999 // Engine timestamp in microseconds\n}\n```\n\n## Depth\n\nContains incremental depth updates. Each depth update has the absolute\nvalue of the depths at the given levels, and only changes when the\ndepth has changed.\n\nTo obtain an initial snapshot of the depth, the client should query the\n[REST API](https://docs.backpack.exchange/#tag/Markets/operation/get_depth).\n\nThe depth stream will push updates as quickly as possible, but under\nload it may aggregate more than one update into a single event. In\nthis case the `U` and `u` fields will not be the same. The `U` field\nis the first update ID in the event, and the `u` field is the final\nupdate ID in the event.\n\nThere are alternative depth streams that aggregates updates into a\nsingle message over a 200ms, 600ms or 1000ms period instead of pushing\nupdates in realtime. This is useful for reducing network traffic.\n\nUpdates are sequential, so `U` will always be `u + 1` from the previous\nmessage. If this is not the case, the client should assume that the\ndepth has been invalidated and requery the REST API.\n\nStream name format: `depth.` (realtime)\nStream name format: `depth.200ms.` (aggregated)\nStream name format: `depth.600ms.` (aggregated)\nStream name format: `depth.1000ms.` (aggregated)\n```\n{\n \"e\": \"depth\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"a\": [ // Asks\n [\n \"18.70\",\n \"0.000\"\n ]\n ],\n \"b\": [ // Bids\n [\n \"18.67\",\n \"0.832\"\n ],\n [\n \"18.68\",\n \"0.000\"\n ]\n ],\n \"U\": 94978271, // First update ID in event\n \"u\": 94978271, // Last update ID in event\n \"T\": 1694687965940999 // Engine timestamp in microseconds\n}\n```\n\n## K-Line\n\nStream name format: `kline..`\n\n```\n{\n \"e\": \"kline\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USD\", // Symbol\n \"t\": 123400000, // K-Line start time in seconds\n \"T\": 123460000, // K-Line close time in seconds\n \"o\": \"18.75\", // Open price\n \"c\": \"19.25\", // Close price\n \"h\": \"19.80\", // High price\n \"l\": \"18.50\", // Low price\n \"v\": \"32123\", // Base asset volume\n \"n\": 93828, // Number of trades\n \"X\": false // Is this k-line closed?\n}\n```\n\n## Liquidation\n\nContains updates for liquidation events for all liquidation types.\n\nStream name format: `liquidation`\n\n```\n{\n \"e\": \"liquidation\", // Event type\n \"E\": 1694688638091000, // Event time in microseconds\n \"q\": \"10\", // Quantity\n \"p\": \"18.70\", // Price\n \"S\": \"Bid\", // Side\n \"s\": \"SOL_USDC\", // Symbol\n \"T\": 567, // Engine timestamp in microseconds\n}\n```\n\n## Mark price\n\nStream name format: `markPrice.`\n\n```\n{\n \"e\": \"markPrice\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"p\": \"18.70\", // Mark price\n \"f\": \"1.70\", // Estimated funding rate\n \"i\": \"19.70\", // Index price\n \"n\": 1694687965941000, // Next funding timestamp in microseconds\n}\n```\n\n## Ticker\n\nThe ticker stream pushes 24hr rolling statistics for a single symbol\nevery second.\n\nStream name format: `ticker.`\n\n```\n{\n \"e\": \"ticker\", // Event type\n \"E\": 1694687692980000, // Event time in microseconds\n \"s\": \"SOL_USD\", // Symbol\n \"o\": \"18.75\", // First price\n \"c\": \"19.24\", // Last price\n \"h\": \"19.80\", // High price\n \"l\": \"18.50\", // Low price\n \"v\": \"32123\", // Base asset volume\n \"V\": \"928190\", // Quote asset volume\n \"n\": 93828 // Number of trades\n}\n```\n## Open interest\n\nOpen interest updates are pushed to the openInterest stream every 60\nseconds.\n\nStream name format: `openInterest.`\n```\n{\n \"e\": \"openInterest\", // Event type\n \"E\": 1694687965941000, // Event time in microseconds\n \"s\": \"SOL_USDC_PERP\", // Symbol\n \"o\": \"100\", // Open interest in contracts\n}\n```\n\n## Trade\n\nContains public trade data for a single symbol. The trade ID is a\nsequential number specific to the symbol. This stream includes updates\nfor trades executed as a result of liquidations.\n\nStream name format: `trade.`\n```\n{\n \"e\": \"trade\", // Event type\n \"E\": 1694688638091000, // Event time in microseconds\n \"s\": \"SOL_USDC\", // Symbol\n \"p\": \"18.68\", // Price\n \"q\": \"0.122\", // Quantity\n \"b\": \"111063114377265150\", // Buyer order ID\n \"a\": \"111063114585735170\", // Seller order ID\n \"t\": 12345, // Trade ID\n \"T\": 1694688638089000, // Engine timestamp in microseconds\n \"m\": true // Is the buyer the maker?\n}\n```" + }, + { + "name": "System", + "description": "Exchange system status." + }, + { + "name": "Trades", + "description": "Public trade data." + } + ], + "paths": { + "/api/v1/account": { + "get": { + "tags": [ + "Account" + ], + "summary": "Get account.", + "description": "**Instruction:** `accountQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/AccountSummary" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_account" + }, + "patch": { + "tags": [ + "Account" + ], + "summary": "Update account.", + "description": "Update account settings.\n\n**Instruction:** `accountUpdate`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UpdateAccountSettingsRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "update_account_settings" + } + }, + "/api/v1/account/convertDust": { + "post": { + "tags": [ + "Account" + ], + "summary": "Convert a dust balance on an account.", + "description": "Converts a dust balance to USDC. The balance (including lend) must be\nless than the minimum quantity tradable on the spot order book.\n\n**Instruction:** `convertDust`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/AccountConvertDustPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "convert_dust" + } + }, + "/api/v1/account/limits/borrow": { + "get": { + "tags": [ + "Account" + ], + "summary": "Get max borrow quantity.", + "description": "Retrieves the maxmimum quantity an account can borrow\nfor a given asset based on the accounts existing exposure\nand margin requirements\n\n**Instruction:** `maxBorrowQuantity`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "The asset to borrow.", + "required": true, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/MaxBorrowQuantity" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "Service unavailable.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_max_borrow_quantity" + } + }, + "/api/v1/account/limits/order": { + "get": { + "tags": [ + "Account" + ], + "summary": "Get max order quantity.", + "description": "Retrieves the maxmimum quantity an account can trade\nfor a given symbol based on the account's balances, existing exposure\nand margin requirements.\n\n**Instruction:** `maxOrderQuantity`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "The market symbol to trade.", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "side", + "schema": { + "$ref": "#/components/schemas/Side" + }, + "in": "query", + "description": "The side of the order.", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "price", + "schema": { + "type": "string", + "format": "decimal" + }, + "in": "query", + "description": "The limit price of the order. Not included for market orders.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "reduceOnly", + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "Whether the order is reduce only.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "autoBorrow", + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "Whether the order uses auto borrow.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "autoBorrowRepay", + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "Whether the order uses auto borrow repay.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "autoLendRedeem", + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "Whether the order uses auto lend redeem.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/MaxOrderQuantity" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_max_order_quantity" + } + }, + "/api/v1/account/limits/withdrawal": { + "get": { + "tags": [ + "Account" + ], + "summary": "Get max withdrawal quantity.", + "description": "Retrieves the maxmimum quantity an account can withdraw\nfor a given asset based on the accounts existing exposure\nand margin requirements\nThe response will include the maximum quantity that can be withdrawn\nand whether the withdrawal is with auto borrow or auto lend redeem\nenabled.\n\n**Instruction:** `maxWithdrawalQuantity`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "The asset to withdraw.", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "autoBorrow", + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "Whether the withdrawal is with auto borrow.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "autoLendRedeem", + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "Whether the withdrawal is with auto lend redeem.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/MaxWithdrawalQuantity" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_max_withdrawal_quantity" + } + }, + "/api/v1/assets": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get assets.", + "description": "Get all supported assets.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarketAsset" + } + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_assets" + } + }, + "/api/v1/collateral": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get collateral.", + "description": "Get collateral parameters for assets.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CollateralSummary" + } + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_collateral_parameters" + } + }, + "/api/v1/borrowLend/positions": { + "get": { + "tags": [ + "Borrow Lend" + ], + "summary": "Get borrow lend positions.", + "description": "Retrieves all the open borrow lending positions for the account.\n\n**Instruction:** `borrowLendPositionQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BorrowLendPositionWithMargin" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_borrow_lend_positions" + } + }, + "/api/v1/borrowLend": { + "post": { + "tags": [ + "Borrow Lend" + ], + "summary": "Execute borrow lend.", + "description": "**Instruction:** `borrowLendExecute`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/BorrowLendExecutePayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "execute_borrow_lend" + } + }, + "/api/v1/borrowLend/position/liquidationPrice": { + "get": { + "tags": [ + "Borrow Lend" + ], + "summary": "Get an estimated liquidation price for potential borrow lend position.", + "description": "Retrieves the estimated liquidation price for a potential borrow lend\nposition.", + "parameters": [ + { + "name": "subaccountId", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "query", + "description": "Optional subaccount.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "borrow", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Standard base64 encoded json of [`BorrowLendExecutePayload`]", + "required": true, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/PositionEstimatedLiquidationPrice" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_borrow_lend_estimated_liquidation_price" + } + }, + "/api/v1/borrowLend/markets": { + "get": { + "tags": [ + "Borrow Lend Markets" + ], + "summary": "Get borrow lend markets.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BorrowLendMarket" + } + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_borrow_lend_markets" + } + }, + "/api/v1/borrowLend/markets/history": { + "get": { + "tags": [ + "Borrow Lend Markets" + ], + "summary": "Get borrow lend market history.", + "parameters": [ + { + "name": "interval", + "schema": { + "$ref": "#/components/schemas/BorrowLendMarketHistoryInterval" + }, + "in": "query", + "description": "Filter for an interval.", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol to query. If not set, all markets are returned.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BorrowLendHistory" + } + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_borrow_lend_markets_history" + } + }, + "/api/v1/capital": { + "get": { + "tags": [ + "Capital" + ], + "summary": "Get balances.", + "description": "Retrieves account balances and the state of the balances (locked or\navailable).\n\nLocked assets are those that are currently in an open order.\n\n**Instruction:** `balanceQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Balance" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_balances" + } + }, + "/api/v1/capital/collateral": { + "get": { + "tags": [ + "Capital" + ], + "summary": "Get collateral.", + "description": "Retrieves collateral information for an account.\n\n**Instruction:** `collateralQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "subaccountId", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "query", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/MarginAccountSummary" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_collateral" + } + }, + "/wapi/v1/capital/deposits": { + "get": { + "tags": [ + "Capital" + ], + "summary": "Get deposits.", + "description": "Retrieves deposit history.\n\n**Instruction:** `depositQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "from", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "Filter to minimum time (milliseconds).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "to", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "Filter to maximum time (milliseconds).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Deposit" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_deposits" + } + }, + "/wapi/v1/capital/deposit/address": { + "get": { + "tags": [ + "Capital" + ], + "summary": "Get deposit address.", + "description": "Retrieves the user specific deposit address if the user were to deposit\non the specified blockchain.\n\n**Instruction:** `depositAddressQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "blockchain", + "schema": { + "$ref": "#/components/schemas/Blockchain" + }, + "in": "query", + "description": "Blockchain symbol to get a deposit address for.", + "required": true, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/DepositAddress" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "409": { + "description": "Conflict", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_deposit_address" + } + }, + "/api/v1/markets": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get markets.", + "description": "Retrieves all the markets that are supported by the exchange.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Market" + } + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_markets" + } + }, + "/api/v1/market": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get market.", + "description": "Retrieves a market supported by the exchange.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "required": true, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/Market" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_market" + } + }, + "/api/v1/ticker": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get ticker.", + "description": "Retrieves summarised statistics for the last 24 hours for the given\nmarket symbol.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "interval", + "schema": { + "$ref": "#/components/schemas/TickerInterval" + }, + "in": "query", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/Ticker" + } + } + } + }, + "204": { + "description": "Not found." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_ticker" + } + }, + "/api/v1/tickers": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get tickers.", + "description": "Retrieves summarised statistics for the last 24 hours for all market\nsymbols.", + "parameters": [ + { + "name": "interval", + "schema": { + "$ref": "#/components/schemas/TickerInterval" + }, + "in": "query", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Ticker" + } + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_tickers" + } + }, + "/api/v1/depth": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get depth.", + "description": "Retrieves the order book depth for a given market symbol.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "required": true, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/Depth" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_depth" + } + }, + "/api/v1/klines": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get K-lines.", + "description": "Get K-Lines for the given market symbol, optionally providing a\n`startTime` and `endTime`. If no `endTime` is provided, the current time\nwill be used.\n\nThe `priceType` parameter can be used to specify the price type of the\nkline. If not provided, the default is `LastPrice`.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol for the kline query, e.g. SOL_USDC.", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "interval", + "schema": { + "$ref": "#/components/schemas/KlineInterval" + }, + "in": "query", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "startTime", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "UTC timestamp in seconds.", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "endTime", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "UTC timestamp in seconds. Set to the current time if not provided.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "priceType", + "schema": { + "$ref": "#/components/schemas/KlinePriceType" + }, + "in": "query", + "description": "The price type of the K-line.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Kline" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_klines" + } + }, + "/api/v1/markPrices": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get all mark prices.", + "description": "Retrieves mark price, index price and the funding rate for the current\ninterval for all symbols, or the symbol specified.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarkPrice" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_mark_prices" + } + }, + "/api/v1/openInterest": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get open interest.", + "description": "Retrieves the current open interest for the given market.\nIf no market is provided, then all markets are returned.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OpenInterest" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_open_interest" + } + }, + "/api/v1/fundingRates": { + "get": { + "tags": [ + "Markets" + ], + "summary": "Get funding interval rates.", + "description": "Funding interval rate history for futures.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol to query", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `10000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset for pagination. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FundingIntervalRate" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_funding_interval_rates" + } + }, + "/api/v1/order": { + "get": { + "tags": [ + "Order" + ], + "summary": "Get open order.", + "description": "Retrieves an open order from the order book. This only returns the order\nif it is resting on the order book (i.e. has not been completely filled,\nexpired, or cancelled).\n\nOne of `orderId` or `clientId` must be specified. If both are specified\nthen the request will be rejected.\n\n**Instruction:** `orderQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "clientId", + "schema": { + "type": "integer", + "format": "uint32" + }, + "in": "query", + "description": "Client ID of the order.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "orderId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "ID of the order.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol for the order.", + "required": true, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/OrderType" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "404": { + "description": "Order not found.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_order" + }, + "post": { + "tags": [ + "Order" + ], + "summary": "Execute order.", + "description": "Submits an order to the matching engine for execution.\n\n**Instruction:** `orderExecute`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-BROKER-ID", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "header", + "description": "Broker ID of the order", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-Broker-Id", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "header", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/OrderExecutePayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Order executed.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/OrderType" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "execute_order" + }, + "delete": { + "tags": [ + "Order" + ], + "summary": "Cancel open order.", + "description": "Cancels an open order from the order book.\n\nOne of `orderId` or `clientId` must be specified. If both are specified\nthen the request will be rejected.\n\n**Instruction:** `orderCancel`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/OrderCancelPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Order cancelled.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/OrderType" + } + } + } + }, + "202": { + "description": "Request accepted but not yet executed." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "cancel_order" + } + }, + "/api/v1/orders": { + "post": { + "tags": [ + "Order" + ], + "summary": "Execute orders.", + "description": "Submits a set of orders to the matching engine for execution in a batch.\n\n**Batch commands instruction:** `orderExecute`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-Broker-Id", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "header", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderExecutePayload" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Batch orders executed.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BatchCommandOrderResult" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "execute_order_batch" + }, + "get": { + "tags": [ + "Order" + ], + "summary": "Get open orders.", + "description": "Retrieves all open orders. If a symbol is provided, only open orders for\nthat market will be returned, otherwise all open orders are\nreturned.\n\n**Instruction:** `orderQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "marketType", + "schema": { + "$ref": "#/components/schemas/MarketType" + }, + "in": "query", + "description": "The market for the orders (SPOT or PERP).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "The symbol of the market for the orders.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderType" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_open_orders" + }, + "delete": { + "tags": [ + "Order" + ], + "summary": "Cancel open orders.", + "description": "Cancels all open orders on the specified market.\n\n**Instruction:** `orderCancelAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/OrderCancelAllPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderType" + } + } + } + } + }, + "202": { + "description": "Request accepted but not yet executed." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "cancel_open_orders" + } + }, + "/api/v1/position": { + "get": { + "tags": [ + "Futures" + ], + "summary": "Get open positions.", + "description": "Retrieves account position summary.\n\n**Instruction:** `positionQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter for a single position by symbol.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FuturePositionWithMargin" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "404": { + "description": "Position not found.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_positions" + } + }, + "/api/v1/rfq": { + "post": { + "tags": [ + "Request For Quote" + ], + "summary": "Submit RFQ.", + "description": "Submit a Request for Quote (RFQ). The RFQ will be available for\na specified time window for makers to respond to.\n\n**Instruction:** `rfqSubmit`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/RequestForQuotePayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Accepted.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/RequestForQuote" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "submit_rfq" + } + }, + "/api/v1/rfq/accept": { + "post": { + "tags": [ + "Request For Quote" + ], + "summary": "Accept quote.", + "description": "Accept a specific quote from a maker in response to an RFQ.\n\n**Instruction:** `quoteAccept`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/QuoteAcceptPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Accepted.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/RequestForQuote" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "accept_quote" + } + }, + "/api/v1/rfq/refresh": { + "post": { + "tags": [ + "Request For Quote" + ], + "summary": "Refresh RFQ.", + "description": "Refresh a RFQ, extending the time window it is available for.\n\n**Instruction:** `rfqRefresh`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/RequestForQuoteRefreshPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Accepted.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/RequestForQuote" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "refresh_rfq" + } + }, + "/api/v1/rfq/cancel": { + "post": { + "tags": [ + "Request For Quote" + ], + "summary": "Cancel RFQ.", + "description": "**Instruction:** `rfqCancel`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/RequestForQuoteCancelPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Accepted.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/RequestForQuote" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "cancel_rfq" + } + }, + "/api/v1/rfq/quote": { + "post": { + "tags": [ + "Request For Quote" + ], + "summary": "Submit quote.", + "description": "Submit a quote in response to an RFQ. If valid, the quote may be\naccepted within the specified time window.\n\n**Instruction:** `quoteSubmit`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/QuotePayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Accepted.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/Quote" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "submit_quote" + } + }, + "/api/v1/strategy": { + "get": { + "tags": [ + "Strategy" + ], + "summary": "Get open strategy.", + "description": "Retrieves an open strategy from the engine. This only returns the\nstrategy if it is active (i.e. has not been completely filled,\ncancelled by the user, or cancelled by the system).\n\nOne of `strategyId` or `clientStrategyId` must be specified.\n\n**Instruction:** `strategyQuery`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "clientStrategyId", + "schema": { + "type": "integer", + "format": "uint32" + }, + "in": "query", + "description": "Client ID of the strategy.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "strategyId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "ID of the strategy.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol for the strategy.", + "required": true, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/StrategyType" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "404": { + "description": "Strategy not found.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_strategy" + }, + "post": { + "tags": [ + "Strategy" + ], + "summary": "Create strategy.", + "description": "Submits a strategy to the engine for processing.\n\n**Instruction:** `strategyCreate`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-Broker-Id", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "header", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/StrategyCreatePayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Strategy created.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/StrategyType" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "strategy_create" + }, + "delete": { + "tags": [ + "Strategy" + ], + "summary": "Cancel open strategy.", + "description": "Cancels an open strategy currently being run.\n\nOne of `strategyId` or `clientStrategyId` must be specified.\n\n**Instruction:** `strategyCancel`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/StrategyCancelPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Strategy cancelled.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/StrategyType" + } + } + } + }, + "202": { + "description": "Request accepted but not yet executed." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "cancel_strategy" + } + }, + "/api/v1/strategies": { + "get": { + "tags": [ + "Strategy" + ], + "summary": "Get open strategies.", + "description": "Retrieves all open strategies. If a symbol is provided, only open\nstrategies for that market will be returned, otherwise all open\nstrategies are returned.\n\n**Instruction:** `strategyQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "marketType", + "schema": { + "$ref": "#/components/schemas/MarketType" + }, + "in": "query", + "description": "The market for the strategies (SPOT or PERP).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "strategyType", + "schema": { + "$ref": "#/components/schemas/StrategyTypeEnum" + }, + "in": "query", + "description": "The strategy type.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "The symbol of the market for the strategies.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StrategyType" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_open_strategies" + }, + "delete": { + "tags": [ + "Strategy" + ], + "summary": "Cancel open strategies.", + "description": "Cancels all open strategies on the specified market.\n\n**Instruction:** `strategyCancelAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/StrategyCancelAllPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StrategyType" + } + } + } + } + }, + "202": { + "description": "Request accepted but not yet executed." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "cancel_open_strategies" + } + }, + "/api/v1/status": { + "get": { + "tags": [ + "System" + ], + "summary": "Status.", + "description": "Get the system status, and the status message, if any.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/StatusAndMessage" + } + } + } + } + }, + "operationId": "get_status" + } + }, + "/api/v1/ping": { + "get": { + "tags": [ + "System" + ], + "summary": "Ping.", + "description": "Responds with `pong`.", + "responses": { + "200": { + "description": "", + "content": { + "text/plain; charset=utf-8": { + "schema": { + "type": "string" + } + } + } + } + }, + "operationId": "ping" + } + }, + "/api/v1/time": { + "get": { + "tags": [ + "System" + ], + "summary": "Get system time.", + "description": "Retrieves the current system time.", + "responses": { + "200": { + "description": "", + "content": { + "text/plain; charset=utf-8": { + "schema": { + "type": "string" + } + } + } + } + }, + "operationId": "get_time" + } + }, + "/api/v1/trades": { + "get": { + "tags": [ + "Trades" + ], + "summary": "Get recent trades.", + "description": "Retrieve the most recent trades for a symbol. This is public data and\nis not specific to any account.\n\nThe maximum available recent trades is `1000`. If you need more than\n`1000` trades use the historical trades endpoint.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol to query fills for.", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "query", + "description": "Limit the number of fills returned. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Trade" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_recent_trades" + } + }, + "/api/v1/trades/history": { + "get": { + "tags": [ + "Trades" + ], + "summary": "Get historical trades.", + "description": "Retrieves all historical trades for the given symbol. This is public\ntrade data and is not specific to any account.", + "parameters": [ + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Limit the number of trades returned. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Trade" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_historical_trades" + } + }, + "/api/v1/wallets": { + "get": { + "tags": [ + "System" + ], + "summary": "Get wallets.", + "description": "Returns all configured blockchain wallets and their addresses.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WalletResponse" + } + } + } + } + } + }, + "operationId": "get_wallets" + } + }, + "/wapi/v1/capital/withdrawals": { + "get": { + "tags": [ + "Capital" + ], + "summary": "Get withdrawals.", + "description": "Retrieves withdrawal history.\n\n**Instruction:** `withdrawalQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "from", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "Filter to minimum time (milliseconds).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "to", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "Filter to maximum time (milliseconds).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Withdrawal" + } + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_withdrawals" + }, + "post": { + "tags": [ + "Capital" + ], + "summary": "Request withdrawal.", + "description": "Requests a withdrawal from the exchange.\n\nThe `twoFactorToken` field is required if the withdrawal address is not\nan address that is configured in the address book to not require\n2FA. These addresses can be configured [here](https://backpack.exchange/settings/withdrawal-addresses?twoFactorWithdrawalAddress=true).\n\n**Instruction:** `withdraw`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": true, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": true, + "deprecated": false, + "explode": true + } + ], + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/AccountWithdrawalPayload" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/Withdrawal" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "429": { + "description": "Too many requests.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "503": { + "description": "System under maintenance.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "request_withdrawal" + } + }, + "/wapi/v1/capital/withdrawals/delay": { + "get": { + "summary": "Get withdrawal delay.", + "description": "A configurable hourly delay can be applied to withdrawals to non\nwhitelisted addresses.", + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WithdrawalDelay" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "404": { + "description": "" + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_withdrawal_delay" + }, + "post": { + "summary": "Create withdrawal delay.", + "description": "A configurable hourly delay can be applied to withdrawals to non\nwhitelisted addresses.", + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/CreateWithdrawalDelayRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success." + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "409": { + "description": "Withdrawal delay already exists.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "create_withdrawal_delay" + }, + "patch": { + "summary": "Update the withdrawal delay.", + "description": "A configurable hourly delay can be applied to withdrawals to non\nwhitelisted addresses.\n\nUpdates are only applied after the current delay ends.", + "requestBody": { + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/UpdateWithdrawalDelayRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/WithdrawalDelay" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "404": { + "description": "" + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "update_withdrawal_delay" + } + }, + "/wapi/v1/history/borrowLend": { + "get": { + "tags": [ + "History" + ], + "summary": "Get borrow history.", + "description": "History of borrow and lend operations for the account.\n\n**Instruction:** `borrowHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "type", + "schema": { + "$ref": "#/components/schemas/BorrowLendEventType" + }, + "in": "query", + "description": "Filter to history for either borrows or lends.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sources", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to return history for a particular source. Can be a single\nsource, or multiple sources separated by commas.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "positionId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to return history for a borrow lend position.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset for pagination. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BorrowLendMovement" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_borrow_lend_history" + } + }, + "/wapi/v1/history/interest": { + "get": { + "tags": [ + "History" + ], + "summary": "Get interest history.", + "description": "History of the interest payments for borrows and lends for the account.\n\n**Instruction:** `interestHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "asset", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Asset to query. If not set, all assets are returned.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol to query. If not set, all markets are returned. If a\nfutures symbol is supplied, then interest payments on unrealized pnl\nwill be returned. Spot market symbols refer to interest payments on\nregular borrow lend positions.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "positionId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to return history for a borrow lend position.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset for pagination. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "source", + "schema": { + "$ref": "#/components/schemas/InterestPaymentSource" + }, + "in": "query", + "description": "Filter to return interest payments of a particular source. Borrow\ninterest payments through two mechanisms: borrow lend\npositions; interest paid on unrealized pnl.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InterestPayment" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_interest_history" + } + }, + "/wapi/v1/history/borrowLend/positions": { + "get": { + "tags": [ + "History" + ], + "summary": "Get borrow position history.", + "description": "History of borrow and lend positions for the account.\n\n**Instruction:** `borrowPositionHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "side", + "schema": { + "$ref": "#/components/schemas/BorrowLendSide" + }, + "in": "query", + "description": "Return only borrows or only lends.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "state", + "schema": { + "$ref": "#/components/schemas/BorrowLendPositionState" + }, + "in": "query", + "description": "Return only open positions or closed positions.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset for pagination. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BorrowLendPositionRow" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_borrow_lend_position_history" + } + }, + "/wapi/v1/history/dust": { + "get": { + "tags": [ + "History" + ], + "summary": "Get dust conversion history.", + "description": "Retrieves the dust conversion history for the user.\n\n**Instruction:** `dustHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "id", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "Filter to a given dust conversion id.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DustConversion" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_dust_history" + } + }, + "/wapi/v1/history/fills": { + "get": { + "tags": [ + "History" + ], + "summary": "Get fill history.", + "description": "Retrieves historical fills, with optional filtering for a specific order\nor symbol.\n\n**Instruction:** `fillHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "orderId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given order.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "strategyId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given strategy.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "from", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "Filter to minimum time (milliseconds).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "to", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "query", + "description": "Filter to maximum time (milliseconds).", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "fillType", + "schema": { + "$ref": "#/components/schemas/FillType" + }, + "in": "query", + "description": "Filter to return fills for different fill types", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "marketType", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarketType" + } + }, + "in": "query", + "description": "Market type.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderFill" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_fills" + } + }, + "/wapi/v1/history/funding": { + "get": { + "tags": [ + "History" + ], + "summary": "Get funding payments.", + "description": "Users funding payment history for futures.\n\n**Instruction:** `fundingHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "subaccountId", + "schema": { + "type": "integer", + "format": "uint16" + }, + "in": "query", + "description": "Filter for a subaccount.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Market symbol to query. If not set, all markets are returned.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset for pagination. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FundingPayment" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_funding_payments" + } + }, + "/wapi/v1/history/orders": { + "get": { + "tags": [ + "History" + ], + "summary": "Get order history.", + "description": "Retrieves the order history for the user. This includes orders that have\nbeen filled and are no longer on the book. It may include orders\nthat are on the book, but the `/orders` endpoint contains more up to\ndate data.\n\n**Instruction:** `orderHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "orderId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given order.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "strategyId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given strategy.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "marketType", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarketType" + } + }, + "in": "query", + "description": "Market type.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Order" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_order_history" + } + }, + "/wapi/v1/history/rfq": { + "get": { + "tags": [ + "History" + ], + "summary": "Get rfq history.", + "description": "Retrieves the rfq history for the user. This includes RFQs that have\nbeen filled or expired.\n\n**Instruction:** `rfqHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "rfqId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given rfq.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "status", + "schema": { + "$ref": "#/components/schemas/OrderStatus" + }, + "in": "query", + "description": "Filter to the given status.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "side", + "schema": { + "$ref": "#/components/schemas/Side" + }, + "in": "query", + "description": "Filter to the given side.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RequestForQuoteHistorical" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_rfq_history" + } + }, + "/wapi/v1/history/quote": { + "get": { + "tags": [ + "History" + ], + "summary": "Get quote history.", + "description": "Retrieves the quote history for the user. This includes quotes that have\nbeen filled or expired.\n\n**Instruction:** `quoteHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "quoteId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given quote.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "status", + "schema": { + "$ref": "#/components/schemas/OrderStatus" + }, + "in": "query", + "description": "Filter to the given status.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/QuoteHistorical" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_quote_history" + } + }, + "/wapi/v1/history/settlement": { + "get": { + "tags": [ + "History" + ], + "summary": "Get settlement history.", + "description": "History of settlement operations for the account.\n\n**Instruction:** `settlementHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset for pagination. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "source", + "schema": { + "$ref": "#/components/schemas/SettlementSourceFilter" + }, + "in": "query", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Settlement" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_settlement_history" + } + }, + "/wapi/v1/history/strategies": { + "get": { + "tags": [ + "History" + ], + "summary": "Get strategy history.", + "description": "Retrieves the strategy history for the user. This returns strategies\nthat are no longer active as they have either been\ncompleted, cancelled by the user or cancelled by the system.\n\n**Instruction:** `strategyHistoryQueryAll`", + "parameters": [ + { + "name": "X-API-KEY", + "schema": { + "type": "string" + }, + "in": "header", + "description": "API key", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-SIGNATURE", + "schema": { + "type": "string" + }, + "in": "header", + "description": "Signature of the request", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-TIMESTAMP", + "schema": { + "type": "integer", + "format": "int64" + }, + "in": "header", + "description": "Timestamp of the request in milliseconds", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "X-WINDOW", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "header", + "description": "Time the request is valid for in milliseconds (default `5000`, maximum `60000`)", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "strategyId", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given strategy.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "symbol", + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter to the given symbol.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "limit", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Maximum number to return. Default `100`, maximum `1000`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "offset", + "schema": { + "type": "integer", + "format": "uint64" + }, + "in": "query", + "description": "Offset. Default `0`.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "marketType", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MarketType" + } + }, + "in": "query", + "description": "Market type.", + "required": false, + "deprecated": false, + "explode": true + }, + { + "name": "sortDirection", + "schema": { + "$ref": "#/components/schemas/SortDirection" + }, + "in": "query", + "description": "Sort direction.", + "required": false, + "deprecated": false, + "explode": true + } + ], + "responses": { + "200": { + "description": "Success.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Strategy" + } + } + } + }, + "headers": { + "ACCESS-CONTROL-EXPOSE-HEADERS": { + "required": true, + "deprecated": false, + "schema": { + "type": "string" + } + }, + "X-PAGE-COUNT": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-CURRENT-PAGE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-PAGE-SIZE": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + }, + "X-TOTAL": { + "required": true, + "deprecated": false, + "schema": { + "type": "integer", + "format": "uint64" + } + } + } + }, + "400": { + "description": "Bad request.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + }, + "500": { + "description": "Internal server error.", + "content": { + "application/json; charset=utf-8": { + "schema": { + "$ref": "#/components/schemas/ApiErrorResponse" + } + } + } + } + }, + "operationId": "get_strategies_history" + } + } + }, + "components": { + "schemas": { + "AccountConvertDustPayload": { + "type": "object", + "title": "AccountConvertDustPayload", + "properties": { + "symbol": { + "description": "The asset symbol to convert dust for.\nIf omitted, all dust balances will be converted.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "The asset symbol to convert dust for.\nIf omitted, all dust balances will be converted." + } + ] + } + } + }, + "AccountSummary": { + "type": "object", + "title": "AccountSummary", + "required": [ + "autoBorrowSettlements", + "autoLend", + "autoRealizePnl", + "autoRepayBorrows", + "borrowLimit", + "futuresMakerFee", + "futuresTakerFee", + "leverageLimit", + "limitOrders", + "liquidating", + "positionLimit", + "spotMakerFee", + "spotTakerFee", + "triggerOrders" + ], + "properties": { + "autoBorrowSettlements": { + "type": "boolean", + "description": "If true, then tries to borrow during collateral reconciliation." + }, + "autoLend": { + "type": "boolean", + "description": "If true, then tries to automatically lend with available balance." + }, + "autoRealizePnl": { + "type": "boolean", + "description": "Determines if the account should have continuous PnL realization." + }, + "autoRepayBorrows": { + "type": "boolean", + "description": "If true, then tries to automatically repay borrows with available\nbalance." + }, + "borrowLimit": { + "type": "string", + "format": "decimal", + "description": "Borrow limit." + }, + "futuresMakerFee": { + "type": "string", + "format": "decimal", + "description": "Futures maker fee in basis points. Negative if a rebate exists." + }, + "futuresTakerFee": { + "type": "string", + "format": "decimal", + "description": "Futures taker fee in basis points." + }, + "leverageLimit": { + "type": "string", + "format": "decimal", + "description": "Leverage limit of the account." + }, + "limitOrders": { + "type": "integer", + "format": "uint64", + "description": "Number of open limit orders." + }, + "liquidating": { + "type": "boolean", + "description": "Whether the account is liquidating." + }, + "positionLimit": { + "type": "string", + "format": "decimal", + "description": "Position limit." + }, + "spotMakerFee": { + "type": "string", + "format": "decimal", + "description": "Spot maker fee in basis points. Negative if a rebate exists." + }, + "spotTakerFee": { + "type": "string", + "format": "decimal", + "description": "Spot taker fee in basis points." + }, + "triggerOrders": { + "type": "integer", + "format": "uint64", + "description": "Number of open trigger orders." + } + } + }, + "AccountWithdrawalPayload": { + "type": "object", + "title": "AccountWithdrawalPayload", + "required": [ + "address", + "blockchain", + "quantity", + "symbol" + ], + "properties": { + "address": { + "type": "string", + "description": "Address to withdraw to." + }, + "blockchain": { + "description": "Blockchain to withdraw on.", + "allOf": [ + { + "$ref": "#/components/schemas/Blockchain" + }, + { + "description": "Blockchain to withdraw on." + } + ] + }, + "clientId": { + "type": "string", + "description": "Custom client id.", + "maxLength": 255 + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to withdraw." + }, + "symbol": { + "description": "Symbol of the asset to withdraw.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "Symbol of the asset to withdraw." + } + ] + }, + "twoFactorToken": { + "type": "string", + "description": "Issued two factor token." + }, + "autoBorrow": { + "type": "boolean", + "description": "Auto borrow to withdraw if required." + }, + "autoLendRedeem": { + "type": "boolean", + "description": "Auto redeem a lend if required." + } + } + }, + "ApiErrorCode": { + "type": "string", + "enum": [ + "ACCOUNT_LIQUIDATING", + "BORROW_LIMIT", + "BORROW_REQUIRES_LEND_REDEEM", + "FORBIDDEN", + "INSUFFICIENT_FUNDS", + "INSUFFICIENT_MARGIN", + "INSUFFICIENT_SUPPLY", + "INVALID_ASSET", + "INVALID_CLIENT_REQUEST", + "INVALID_MARKET", + "INVALID_ORDER", + "INVALID_PRICE", + "INVALID_POSITION_ID", + "INVALID_QUANTITY", + "INVALID_RANGE", + "INVALID_SIGNATURE", + "INVALID_SOURCE", + "INVALID_SYMBOL", + "INVALID_TWO_FACTOR_CODE", + "LEND_LIMIT", + "LEND_REQUIRES_BORROW_REPAY", + "MAINTENANCE", + "MAX_LEVERAGE_REACHED", + "NOT_IMPLEMENTED", + "ORDER_LIMIT", + "POSITION_LIMIT", + "PRECONDITION_FAILED", + "RESOURCE_NOT_FOUND", + "SERVER_ERROR", + "TIMEOUT", + "TOO_MANY_REQUESTS", + "TRADING_PAUSED", + "UNAUTHORIZED" + ] + }, + "ApiErrorResponse": { + "type": "object", + "title": "ApiErrorResponse", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "$ref": "#/components/schemas/ApiErrorCode" + }, + "message": { + "type": "string" + } + } + }, + "Asset": { + "type": "string", + "enum": [ + "BTC", + "ETH", + "SOL", + "USDC", + "USDT", + "PYTH", + "JTO", + "BONK", + "HNT", + "MOBILE", + "WIF", + "JUP", + "RENDER", + "WEN", + "W", + "TNSR", + "PRCL", + "SHARK", + "KMNO", + "MEW", + "BOME", + "RAY", + "HONEY", + "SHFL", + "BODEN", + "IO", + "DRIFT", + "PEPE", + "SHIB", + "LINK", + "UNI", + "ONDO", + "FTM", + "MATIC", + "STRK", + "BLUR", + "WLD", + "GALA", + "NYAN", + "HLG", + "MON", + "ZKJ", + "MANEKI", + "HABIBI", + "UNA", + "ZRO", + "ZEX", + "AAVE", + "LDO", + "MOTHER", + "CLOUD", + "MAX", + "POL", + "TRUMPWIN", + "HARRISWIN", + "MOODENG", + "DBR", + "GOAT", + "ACT", + "DOGE", + "BCH", + "LTC", + "APE", + "ENA", + "ME", + "EIGEN", + "CHILLGUY", + "PENGU", + "EUR", + "SONIC", + "J", + "TRUMP", + "MELANIA", + "ANIME", + "XRP", + "SUI", + "VINE", + "ADA", + "MOVE", + "BERA", + "IP", + "HYPE", + "BNB", + "KAITO", + "kPEPE", + "kBONK", + "kSHIB", + "AVAX", + "S", + "POINTS", + "ROAM", + "AI16Z", + "LAYER", + "FARTCOIN", + "NEAR", + "PNUT", + "ARB", + "DOT", + "APT", + "OP", + "PYUSD", + "HUMA", + "WAL", + "DEEP", + "CETUS", + "SEND", + "BLUE", + "NS", + "HAEDAL", + "JPY", + "TAO", + "VIRTUAL", + "TIA", + "TRX", + "FRAG", + "PUMP", + "WCT", + "ES", + "SEI", + "CRV", + "TON", + "HBAR", + "XLM", + "ZORA", + "WLFI", + "BPEUR", + "SWTCH", + "LINEA", + "XPL", + "BARD", + "FLOCK", + "AVNT", + "PENDLE", + "AERO", + "ASTER", + "GLXY", + "0G", + "2Z", + "FORD", + "ZEUS", + "APEX", + "EDEN", + "FF", + "ORDER", + "MNT", + "ZEC", + "PAXG", + "MORPHO", + "ATH" + ] + }, + "Balance": { + "type": "object", + "title": "Balance", + "required": [ + "available", + "locked", + "staked" + ], + "properties": { + "available": { + "type": "string", + "format": "decimal", + "description": "Funds available for use." + }, + "locked": { + "type": "string", + "format": "decimal", + "description": "Funds that are locked because they are in an order that has not been\nexecuted." + }, + "staked": { + "type": "string", + "format": "decimal", + "description": "Funds that are staked." + } + } + }, + "BatchCommandOrderResult": { + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/BatchCommandOrderResult_OrderType" + }, + { + "$ref": "#/components/schemas/BatchCommandOrderResult_ApiErrorResponse" + } + ], + "discriminator": { + "propertyName": "operation", + "mapping": { + "Ok": "#/components/schemas/BatchCommandOrderResult_OrderType", + "Err": "#/components/schemas/BatchCommandOrderResult_ApiErrorResponse" + } + } + }, + "BatchCommandOrderResult_ApiErrorResponse": { + "allOf": [ + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "Err" + ], + "example": "Err" + } + } + }, + { + "$ref": "#/components/schemas/ApiErrorResponse" + } + ] + }, + "BatchCommandOrderResult_OrderType": { + "allOf": [ + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "Ok" + ], + "example": "Ok" + } + } + }, + { + "$ref": "#/components/schemas/OrderType" + } + ] + }, + "Blockchain": { + "type": "string", + "enum": [ + "0G", + "Aptos", + "Arbitrum", + "Avalanche", + "Base", + "Berachain", + "Bitcoin", + "BitcoinCash", + "Bsc", + "Cardano", + "Dogecoin", + "Eclipse", + "EqualsMoney", + "Ethereum", + "HyperEVM", + "Hyperliquid", + "Linea", + "Litecoin", + "Optimism", + "Plasma", + "Polygon", + "Sei", + "Sui", + "Solana", + "Story", + "Tron", + "XRP" + ] + }, + "BorrowLendBookState": { + "type": "string", + "description": "Borrow lend book state", + "enum": [ + "Open", + "Closed", + "RepayOnly" + ] + }, + "BorrowLendEventType": { + "type": "string", + "enum": [ + "Borrow", + "BorrowRepay", + "Lend", + "LendRedeem" + ] + }, + "BorrowLendExecutePayload": { + "type": "object", + "title": "BorrowLendExecutePayload", + "required": [ + "quantity", + "side", + "symbol" + ], + "properties": { + "quantity": { + "type": "string", + "format": "decimal", + "description": "The quantity of the asset to repay." + }, + "side": { + "description": "Side of the borrow lend.", + "allOf": [ + { + "$ref": "#/components/schemas/BorrowLendSide" + }, + { + "description": "Side of the borrow lend." + } + ] + }, + "symbol": { + "description": "The asset to repay.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "The asset to repay." + } + ] + } + } + }, + "BorrowLendHistory": { + "type": "object", + "title": "BorrowLendHistory", + "required": [ + "borrowInterestRate", + "borrowedQuantity", + "lendInterestRate", + "lentQuantity", + "timestamp", + "utilization" + ], + "properties": { + "borrowInterestRate": { + "type": "string", + "format": "decimal", + "description": "The rate borrowers pay." + }, + "borrowedQuantity": { + "type": "string", + "format": "decimal", + "description": "The amount of assets borrowed from the pool." + }, + "lendInterestRate": { + "type": "string", + "format": "decimal", + "description": "The APY rate lenders receive." + }, + "lentQuantity": { + "type": "string", + "format": "decimal", + "description": "The amount of assets lent to the pool." + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp of the summary." + }, + "utilization": { + "type": "string", + "format": "decimal", + "description": "Utilisation." + } + } + }, + "BorrowLendMarket": { + "type": "object", + "title": "BorrowLendMarket", + "description": "Borrow Lending market summary.", + "required": [ + "state", + "assetMarkPrice", + "borrowInterestRate", + "borrowedQuantity", + "fee", + "lendInterestRate", + "lentQuantity", + "maxUtilization", + "openBorrowLendLimit", + "optimalUtilization", + "symbol", + "timestamp", + "throttleUtilizationThreshold", + "throttleUtilizationBound", + "throttleUpdateFraction", + "utilization", + "stepSize" + ], + "properties": { + "state": { + "description": "State of the borrow lend market.", + "allOf": [ + { + "$ref": "#/components/schemas/BorrowLendBookState" + }, + { + "description": "State of the borrow lend market." + } + ] + }, + "assetMarkPrice": { + "type": "string", + "format": "decimal", + "description": "Mark price of spot instrument." + }, + "borrowInterestRate": { + "type": "string", + "format": "decimal", + "description": "The rate borrowers pay." + }, + "borrowedQuantity": { + "type": "string", + "format": "decimal", + "description": "The amount of assets borrowed from the pool." + }, + "fee": { + "type": "string", + "format": "decimal", + "description": "The fee that the exchange takes on borrow lend yield." + }, + "lendInterestRate": { + "type": "string", + "format": "decimal", + "description": "The APY rate lenders receive." + }, + "lentQuantity": { + "type": "string", + "format": "decimal", + "description": "The amount of assets lent to the pool." + }, + "maxUtilization": { + "type": "string", + "format": "decimal", + "description": "The max amount of utilization that can be used by borrowing or redeeming\nlend, irrespsective of the throttle." + }, + "openBorrowLendLimit": { + "type": "string", + "format": "decimal", + "description": "Can't increase borrows or lends pass this threshold. It's possible\nthis is less than the outstanding amount. If that's the case, then\nit simply prevents new borrow or lends from being created." + }, + "optimalUtilization": { + "type": "string", + "format": "decimal", + "description": "The optimal utilization rate for the interest rate model." + }, + "symbol": { + "description": "Uniquely identifies the token.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "Uniquely identifies the token." + } + ] + }, + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp of the summary." + }, + "throttleUtilizationThreshold": { + "type": "string", + "format": "decimal", + "description": "The threshold that triggers borrow throttling." + }, + "throttleUtilizationBound": { + "type": "string", + "format": "decimal", + "description": "The max utilization threshold for any given timestep. Any borrow\nor lend redemption should fail if it puts utilization above this\n(with the exception of liquidations)." + }, + "throttleUpdateFraction": { + "type": "string", + "format": "decimal", + "description": "Hyper-param determining the max utilization can increase during any\ntimestep." + }, + "utilization": { + "type": "string", + "format": "decimal", + "description": "Utilisation." + }, + "stepSize": { + "type": "string", + "format": "decimal", + "description": "Step Size." + } + } + }, + "BorrowLendMarketHistoryInterval": { + "type": "string", + "enum": [ + "1d", + "1w", + "1month", + "1year" + ] + }, + "BorrowLendMovement": { + "type": "object", + "title": "BorrowLendMovement", + "required": [ + "eventType", + "positionId", + "quantity", + "source", + "symbol", + "timestamp" + ], + "properties": { + "eventType": { + "description": "Type of event.", + "allOf": [ + { + "$ref": "#/components/schemas/BorrowLendEventType" + }, + { + "description": "Type of event." + } + ] + }, + "positionId": { + "type": "string", + "description": "ID of the borrow lend position the event is associated with." + }, + "positionQuantity": { + "type": "string", + "format": "decimal", + "description": "Running total quantity of borrow lend position." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the borrow lend event." + }, + "source": { + "description": "Source of the borrow lend event.", + "allOf": [ + { + "$ref": "#/components/schemas/BorrowLendSource" + }, + { + "description": "Source of the borrow lend event." + } + ] + }, + "symbol": { + "type": "string", + "description": "Symbol of the asset the borrow lend is for." + }, + "timestamp": { + "type": "string", + "format": "naive-date-time", + "description": "The timestamp of the borrow lend event (UTC)." + }, + "spotMarginOrderId": { + "type": "string", + "description": "The order id associated with the borrow lend event created through spot\nmargin." + } + } + }, + "BorrowLendPositionRow": { + "type": "object", + "title": "BorrowLendPositionRow", + "required": [ + "positionId", + "quantity", + "symbol", + "source", + "cumulativeInterest", + "avgInterestRate", + "side", + "createdAt" + ], + "properties": { + "positionId": { + "type": "string", + "description": "ID of the borrow lend position the event is associated with." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the borrow lend event." + }, + "symbol": { + "type": "string", + "description": "Symbol of the asset the borrow lend is for." + }, + "source": { + "description": "Initial source of position.", + "allOf": [ + { + "$ref": "#/components/schemas/BorrowLendSource" + }, + { + "description": "Initial source of position." + } + ] + }, + "cumulativeInterest": { + "type": "string", + "format": "decimal", + "description": "Cumulative interest payments quantity." + }, + "avgInterestRate": { + "type": "string", + "format": "decimal", + "description": "Average interest rate over the time this position was open." + }, + "side": { + "description": "Borrow or lend.", + "allOf": [ + { + "$ref": "#/components/schemas/BorrowLendSide" + }, + { + "description": "Borrow or lend." + } + ] + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "The timestamp the borrow lend event was created at (UTC)." + } + } + }, + "BorrowLendPositionState": { + "type": "string", + "enum": [ + "Open", + "Closed" + ] + }, + "BorrowLendPositionWithMargin": { + "type": "object", + "title": "BorrowLendPositionWithMargin", + "required": [ + "cumulativeInterest", + "id", + "imf", + "imfFunction", + "netQuantity", + "markPrice", + "mmf", + "mmfFunction", + "netExposureQuantity", + "netExposureNotional", + "symbol" + ], + "properties": { + "cumulativeInterest": { + "type": "string", + "format": "decimal", + "description": "Cumulative interest payments quantity." + }, + "id": { + "type": "string", + "description": "Uniquely identifies the position." + }, + "imf": { + "type": "string", + "format": "decimal", + "description": "Initial margin fraction for this position." + }, + "imfFunction": { + "description": "IMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "IMF function." + } + ] + }, + "netQuantity": { + "type": "string", + "format": "decimal", + "description": "Net quantity of the position, positive if long, negative if short." + }, + "markPrice": { + "type": "string", + "format": "decimal", + "description": "Mark price of the underlying asset." + }, + "mmf": { + "type": "string", + "format": "decimal", + "description": "Maintenance margin fraction for this position." + }, + "mmfFunction": { + "description": "MMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "MMF function." + } + ] + }, + "netExposureQuantity": { + "type": "string", + "format": "decimal", + "description": "Net exposure of the position, positive if long, negative if short. Lends\nhave no exposure." + }, + "netExposureNotional": { + "type": "string", + "format": "decimal", + "description": "Notional value of the position." + }, + "symbol": { + "description": "Symbol of the underlying asset.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "Symbol of the underlying asset." + } + ] + } + } + }, + "BorrowLendSide": { + "type": "string", + "enum": [ + "Borrow", + "Lend" + ] + }, + "BorrowLendSource": { + "type": "string", + "enum": [ + "AdlProvider", + "AutoBorrowRepay", + "AutoLend", + "BackstopProvider", + "DustConversion", + "Interest", + "Liquidation", + "LiquidationAdl", + "LiquidationBackstop", + "Manual", + "Reconciliation", + "SpotMargin", + "Withdrawal" + ] + }, + "CancelOrderTypeEnum": { + "type": "string", + "enum": [ + "RestingLimitOrder", + "ConditionalOrder" + ] + }, + "Collateral": { + "type": "object", + "title": "Collateral", + "required": [ + "symbol", + "assetMarkPrice", + "totalQuantity", + "balanceNotional", + "collateralWeight", + "collateralValue", + "openOrderQuantity", + "lendQuantity", + "availableQuantity" + ], + "properties": { + "symbol": { + "type": "string", + "description": "Spot asset of the collateral." + }, + "assetMarkPrice": { + "type": "string", + "format": "decimal", + "description": "Mark price of spot instrument" + }, + "totalQuantity": { + "type": "string", + "format": "decimal", + "description": "Pre haircut quantity of the asset." + }, + "balanceNotional": { + "type": "string", + "format": "decimal", + "description": "Balance of spot instrument in USDC.\nThis is calculated as `index_price * balance`." + }, + "collateralWeight": { + "type": "string", + "format": "decimal", + "description": "Collateral weight of spot instrument, applied as a haircut." + }, + "collateralValue": { + "type": "string", + "format": "decimal", + "description": "Collateral Value (or adjusted equity).\nThis is calculated as `index_price * balance * collateral_weight`." + }, + "openOrderQuantity": { + "type": "string", + "format": "decimal", + "description": "The amount added to collateral from open orders." + }, + "lendQuantity": { + "type": "string", + "format": "decimal", + "description": "The amount added to collateral from lending." + }, + "availableQuantity": { + "type": "string", + "format": "decimal", + "description": "The amount of freely available assets." + } + } + }, + "CollateralFunction": { + "type": "object", + "title": "CollateralFunction", + "required": [ + "weight", + "kind" + ], + "properties": { + "weight": { + "type": "string", + "format": "decimal" + }, + "kind": { + "$ref": "#/components/schemas/CollateralFunctionKind" + } + } + }, + "CollateralFunctionKind": { + "type": "object", + "anyOf": [ + { + "$ref": "#/components/schemas/CollateralFunctionKind_IdentityFunction" + }, + { + "$ref": "#/components/schemas/CollateralFunctionKind_InverseSqrtFunction" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "identity": "#/components/schemas/CollateralFunctionKind_IdentityFunction", + "inverseSqrt": "#/components/schemas/CollateralFunctionKind_InverseSqrtFunction" + } + } + }, + "CollateralFunctionKind_IdentityFunction": { + "allOf": [ + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "identity" + ], + "example": "identity" + } + } + }, + { + "$ref": "#/components/schemas/IdentityFunction" + } + ] + }, + "CollateralFunctionKind_InverseSqrtFunction": { + "allOf": [ + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "inverseSqrt" + ], + "example": "inverseSqrt" + } + } + }, + { + "$ref": "#/components/schemas/InverseSqrtFunction" + } + ] + }, + "CollateralSummary": { + "type": "object", + "title": "CollateralSummary", + "required": [ + "symbol", + "imfFunction", + "mmfFunction", + "haircutFunction" + ], + "properties": { + "symbol": { + "type": "string", + "description": "Symbol of the collateral." + }, + "imfFunction": { + "description": "IMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "IMF function." + } + ] + }, + "mmfFunction": { + "description": "MMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "MMF function." + } + ] + }, + "haircutFunction": { + "description": "Calculates the haircut for collateral value.", + "allOf": [ + { + "$ref": "#/components/schemas/CollateralFunction" + }, + { + "description": "Calculates the haircut for collateral value." + } + ] + } + } + }, + "CreateWithdrawalDelayRequest": { + "type": "object", + "title": "CreateWithdrawalDelayRequest", + "required": [ + "withdrawalDelayHours", + "twoFactorToken" + ], + "properties": { + "withdrawalDelayHours": { + "type": "integer", + "format": "uint32", + "description": "The delay applied to withdrawals being processed, in hours." + }, + "twoFactorToken": { + "type": "string", + "description": "Issued two factor token." + } + } + }, + "Deposit": { + "type": "object", + "title": "Deposit", + "required": [ + "id", + "source", + "status", + "symbol", + "quantity", + "createdAt" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32", + "description": "Unique id of the deposit." + }, + "toAddress": { + "type": "string", + "description": "Deposit address." + }, + "fromAddress": { + "type": "string", + "description": "Source address." + }, + "source": { + "description": "Source of the deposit, blockchain or a payment processor.", + "allOf": [ + { + "$ref": "#/components/schemas/DepositSource" + }, + { + "description": "Source of the deposit, blockchain or a payment processor." + } + ] + }, + "status": { + "description": "Status of the deposit.", + "allOf": [ + { + "$ref": "#/components/schemas/DepositStatus" + }, + { + "description": "Status of the deposit." + } + ] + }, + "transactionHash": { + "type": "string", + "description": "Transaction hash of the blockchain transfer." + }, + "symbol": { + "description": "Symbol of the asset to be deposited.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "Symbol of the asset to be deposited." + } + ] + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to be deposited." + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "When the deposit was created." + }, + "fiatAmount": { + "type": "number", + "format": "double", + "description": "Amount in fiat currency." + }, + "fiatCurrency": { + "description": "Currency of the fiat amount.", + "allOf": [ + { + "$ref": "#/components/schemas/FiatAsset" + }, + { + "description": "Currency of the fiat amount." + } + ] + }, + "institutionBic": { + "type": "string", + "description": "Institution BIC." + }, + "platformMemo": { + "type": "string", + "description": "An optional memo that may be provided by the platform." + } + } + }, + "DepositAddress": { + "type": "object", + "title": "DepositAddress", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string", + "description": "Address." + } + } + }, + "DepositSource": { + "type": "string", + "enum": [ + "administrator", + "0G", + "aptos", + "arbitrum", + "avalanche", + "base", + "berachain", + "bitcoin", + "bitcoinCash", + "bsc", + "cardano", + "dogecoin", + "eclipse", + "ethereum", + "hyperEVM", + "hyperliquid", + "linea", + "litecoin", + "polygon", + "optimism", + "plasma", + "sei", + "sui", + "solana", + "story", + "tron", + "xRP", + "equalsMoney", + "banxa", + "internal" + ] + }, + "DepositStatus": { + "type": "string", + "enum": [ + "cancelled", + "confirmed", + "declined", + "expired", + "initiated", + "ownershipVerificationRequired", + "pending", + "refunded", + "senderVerificationCompleted", + "senderVerificationRequired" + ] + }, + "Depth": { + "type": "object", + "title": "Depth", + "required": [ + "asks", + "bids", + "lastUpdateId", + "timestamp" + ], + "properties": { + "asks": { + "type": "array", + "description": "Asks on the order book.", + "items": { + "type": "array", + "items": { + "type": "string", + "format": "decimal" + }, + "maxLength": 2, + "minLength": 2 + } + }, + "bids": { + "type": "array", + "description": "Bids on the order book.", + "items": { + "type": "array", + "items": { + "type": "string", + "format": "decimal" + }, + "maxLength": 2, + "minLength": 2 + } + }, + "lastUpdateId": { + "type": "string", + "description": "Update ID that caused the last change to the order book depth." + }, + "timestamp": { + "type": "integer", + "format": "int64", + "description": "Matching engine timestamp in microseconds." + } + }, + "example": { + "asks": [ + [ + "21.9", + "500.123" + ], + [ + "22.1", + "2321.11" + ] + ], + "bids": [ + [ + "20.12", + "255.123" + ], + [ + "20.5", + "499.555" + ] + ], + "lastUpdateId": "1684026955123", + "timestamp": 1684026955123 + } + }, + "DustConversion": { + "type": "object", + "title": "DustConversion", + "required": [ + "id", + "quantity", + "symbol", + "usdcReceived", + "timestamp" + ], + "properties": { + "id": { + "type": "integer", + "format": "uint64", + "description": "The ID of the dust conversion." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Dust quantity." + }, + "symbol": { + "type": "string", + "description": "Symbol." + }, + "usdcReceived": { + "type": "string", + "format": "decimal", + "description": "USDC received." + }, + "timestamp": { + "type": "string", + "format": "naive-date-time", + "description": "Timestamp." + } + } + }, + "EqualsMoneyWithdrawalState": { + "type": "string", + "enum": [ + "initialized", + "pending", + "fulfilling", + "processing", + "complete", + "declined", + "cancelled", + "review", + "awaitingDocuments", + "awaitingComplianceQuestions", + "refundedInternal", + "refundedExternal" + ] + }, + "FiatAsset": { + "type": "string", + "enum": [ + "AED", + "AUD", + "BGN", + "BHD", + "CAD", + "CHF", + "CNH", + "CNY", + "CZK", + "DKK", + "EUR", + "GBP", + "HKD", + "HUF", + "ILS", + "JOD", + "JPY", + "KES", + "KWD", + "MUR", + "MXN", + "NOK", + "NZD", + "OMR", + "PLN", + "QAR", + "RON", + "SAR", + "SEK", + "SGD", + "THB", + "TND", + "TRY", + "USD", + "ZAR", + "ZMW" + ] + }, + "FillType": { + "type": "string", + "enum": [ + "User", + "BookLiquidation", + "Adl", + "Backstop", + "Liquidation", + "AllLiquidation", + "CollateralConversion", + "CollateralConversionAndSpotLiquidation" + ] + }, + "FundingIntervalRate": { + "type": "object", + "title": "FundingIntervalRate", + "required": [ + "symbol", + "intervalEndTimestamp", + "fundingRate" + ], + "properties": { + "symbol": { + "type": "string", + "description": "The symbol of the market associated to the funding interval." + }, + "intervalEndTimestamp": { + "type": "string", + "format": "naive-date-time", + "description": "The end of the funding interval." + }, + "fundingRate": { + "type": "string", + "format": "decimal", + "description": "The funding rate for the interval." + } + } + }, + "FundingPayment": { + "type": "object", + "title": "FundingPayment", + "required": [ + "userId", + "symbol", + "quantity", + "intervalEndTimestamp", + "fundingRate" + ], + "properties": { + "userId": { + "type": "integer", + "format": "int32", + "description": "User id of the account the payment is associated with." + }, + "subaccountId": { + "type": "integer", + "format": "uint16", + "description": "Id of the subaccount the payment is associated with, if any." + }, + "symbol": { + "type": "string", + "description": "The symbol of the market the payment is associated with." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the payment. Positive if received, negative if paid." + }, + "intervalEndTimestamp": { + "type": "string", + "format": "naive-date-time", + "description": "The end of the funding interval for the payment." + }, + "fundingRate": { + "type": "string", + "format": "decimal", + "description": "The funding rate for the payment." + } + } + }, + "FuturePositionWithMargin": { + "type": "object", + "title": "FuturePositionWithMargin", + "required": [ + "breakEvenPrice", + "entryPrice", + "estLiquidationPrice", + "imf", + "imfFunction", + "markPrice", + "mmf", + "mmfFunction", + "netCost", + "netQuantity", + "netExposureQuantity", + "netExposureNotional", + "pnlRealized", + "pnlUnrealized", + "cumulativeFundingPayment", + "symbol", + "userId", + "positionId", + "cumulativeInterest" + ], + "properties": { + "breakEvenPrice": { + "type": "string", + "format": "decimal", + "description": "Break-even price for this position." + }, + "entryPrice": { + "type": "string", + "format": "decimal", + "description": "Entry price for this position." + }, + "estLiquidationPrice": { + "type": "string", + "format": "decimal", + "description": "Estimated liquidation price for this position." + }, + "imf": { + "type": "string", + "format": "decimal", + "description": "Initial margin fraction for this position." + }, + "imfFunction": { + "description": "IMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "IMF function." + } + ] + }, + "markPrice": { + "type": "string", + "format": "decimal", + "description": "Mark price for this position's market." + }, + "mmf": { + "type": "string", + "format": "decimal", + "description": "Maintenance margin fraction for this position." + }, + "mmfFunction": { + "description": "MMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "MMF function." + } + ] + }, + "netCost": { + "type": "string", + "format": "decimal", + "description": "Positive if long. Negative if short.\n\nThe net cost to enter into the position,i.e., price*quantity for\nall positions adjusting this position." + }, + "netQuantity": { + "type": "string", + "format": "decimal", + "description": "Positive if long. Negative if short." + }, + "netExposureQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of this futures position including worst case open positions." + }, + "netExposureNotional": { + "type": "string", + "format": "decimal", + "description": "Notional value of the futures position including worst case open\npositions." + }, + "pnlRealized": { + "type": "string", + "format": "decimal", + "description": "Aggregates the amount of pnl realized on this position since opening." + }, + "pnlUnrealized": { + "type": "string", + "format": "decimal", + "description": "Unrealized profit and loss for this position." + }, + "cumulativeFundingPayment": { + "type": "string", + "format": "decimal", + "description": "Cumulative funding payment for this position." + }, + "subaccountId": { + "type": "integer", + "format": "uint16", + "description": "ID of the user subaccount that the position is for." + }, + "symbol": { + "type": "string", + "description": "Future to which this position belongs." + }, + "userId": { + "type": "integer", + "format": "int32", + "description": "Id of the user." + }, + "positionId": { + "type": "string", + "description": "Id of the position." + }, + "cumulativeInterest": { + "type": "string", + "format": "decimal", + "description": "Cumulative interest paid for this position's unrealized pnl." + } + } + }, + "IdentityFunction": { + "type": "object", + "title": "IdentityFunction" + }, + "InterestPayment": { + "type": "object", + "title": "InterestPayment", + "required": [ + "paymentType", + "interestRate", + "interval", + "marketSymbol", + "positionId", + "quantity", + "symbol", + "timestamp" + ], + "properties": { + "paymentType": { + "description": "Type of payment.", + "allOf": [ + { + "$ref": "#/components/schemas/PaymentType" + }, + { + "description": "Type of payment." + } + ] + }, + "interestRate": { + "type": "string", + "format": "decimal", + "description": "The rate of interest." + }, + "interval": { + "type": "integer", + "format": "uint64", + "description": "The interval duration of the payment." + }, + "marketSymbol": { + "type": "string", + "description": "The market symbol for which the interest payment can be attributed. For\ninterest payments corresponding to borrow lend positions, this is\nthe spot market symbol. For interest payments corresponding to\nunrealized pnl on futures markets, this will be the futures market\nsymbol." + }, + "positionId": { + "type": "string", + "description": "ID of the borrow lend position the interest payment is for." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Amount of the payment." + }, + "symbol": { + "description": "The symbol of the market asset the payment is associated with.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "The symbol of the market asset the payment is associated with." + } + ] + }, + "timestamp": { + "type": "string", + "format": "naive-date-time", + "description": "The timestamp for the borrow lending interest payment (UTC)." + } + } + }, + "InterestPaymentSource": { + "type": "string", + "enum": [ + "UnrealizedPnl", + "BorrowLend" + ] + }, + "InverseSqrtFunction": { + "type": "object", + "title": "InverseSqrtFunction", + "required": [ + "base", + "positiveCurvePenalty" + ], + "properties": { + "base": { + "type": "string", + "format": "decimal" + }, + "positiveCurvePenalty": { + "type": "string", + "format": "decimal" + } + } + }, + "Kline": { + "type": "object", + "title": "Kline", + "required": [ + "start", + "end", + "volume", + "quoteVolume", + "trades" + ], + "properties": { + "start": { + "type": "string", + "description": "Start time." + }, + "end": { + "type": "string", + "description": "End time." + }, + "open": { + "type": "string", + "description": "Open price." + }, + "high": { + "type": "string", + "description": "High price." + }, + "low": { + "type": "string", + "description": "Low price." + }, + "close": { + "type": "string", + "description": "Close price." + }, + "volume": { + "type": "string", + "description": "Volume in base asset." + }, + "quoteVolume": { + "type": "string", + "description": "Volume in quote asset." + }, + "trades": { + "type": "string", + "description": "Number of trades during the K-line." + } + } + }, + "KlineInterval": { + "type": "string", + "enum": [ + "1m", + "3m", + "5m", + "15m", + "30m", + "1h", + "2h", + "4h", + "6h", + "8h", + "12h", + "1d", + "3d", + "1w", + "1month" + ] + }, + "KlinePriceType": { + "type": "string", + "enum": [ + "Last", + "Index", + "Mark" + ] + }, + "LimitOrder": { + "type": "object", + "title": "LimitOrder", + "required": [ + "id", + "createdAt", + "executedQuantity", + "executedQuoteQuantity", + "postOnly", + "price", + "quantity", + "selfTradePrevention", + "status", + "side", + "symbol", + "timeInForce" + ], + "properties": { + "id": { + "type": "string", + "description": "ID of the order." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom order ID." + }, + "createdAt": { + "type": "integer", + "format": "int64", + "description": "Time the order was created." + }, + "executedQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity that has been filled." + }, + "executedQuoteQuantity": { + "type": "string", + "format": "decimal", + "description": "The quantity of the quote asset that has been filled." + }, + "postOnly": { + "type": "boolean", + "description": "Whether the order is post only or not" + }, + "price": { + "type": "string", + "format": "decimal", + "description": "The limit price. The order book will only match this order with\nother orders at this price or better." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to fill." + }, + "reduceOnly": { + "type": "boolean", + "description": "True if reducing a futures position." + }, + "selfTradePrevention": { + "description": "Action to take in the event the user crosses themselves in the\norder book. Default is `RejectTaker`.", + "allOf": [ + { + "$ref": "#/components/schemas/SelfTradePrevention" + }, + { + "description": "Action to take in the event the user crosses themselves in the\norder book. Default is `RejectTaker`." + } + ] + }, + "status": { + "description": "Status of the order.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderStatus" + }, + { + "description": "Status of the order." + } + ] + }, + "stopLossTriggerPrice": { + "type": "string", + "description": "Stop loss price (price the stop loss order will be triggered at)." + }, + "stopLossLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Stop loss limit price. If set the stop loss will be a limit order,\notherwise it will be a market order." + }, + "stopLossTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the stop loss order." + }, + "side": { + "description": "The order side. It will be matched against the resting orders on the\nother side of the order book.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "The order side. It will be matched against the resting orders on the\nother side of the order book." + } + ] + }, + "symbol": { + "type": "string", + "description": "Market symbol." + }, + "takeProfitTriggerPrice": { + "type": "string", + "description": "Take profit price (price the take profit order will be triggered at)." + }, + "takeProfitLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Take profit limit price. If set the take profit will be a limit order,\notherwise it will be a market order." + }, + "takeProfitTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the take profit order." + }, + "timeInForce": { + "description": "How long the order is good for.", + "allOf": [ + { + "$ref": "#/components/schemas/TimeInForce" + }, + { + "description": "How long the order is good for." + } + ] + }, + "triggerBy": { + "type": "string", + "description": "Reference price that should trigger the order." + }, + "triggerPrice": { + "type": "string", + "description": "Price the order should trigger at, if any." + }, + "triggerQuantity": { + "type": "string", + "description": "Quantity for trigger orders." + }, + "triggeredAt": { + "type": "integer", + "format": "int64" + }, + "relatedOrderId": { + "type": "string", + "description": "The ID of the related order. This may refer to a parent order or,\nfor a trigger order, the order this trigger is for." + }, + "strategyId": { + "type": "string", + "description": "Strategy ID of the order, if any." + } + } + }, + "MarginAccountSummary": { + "type": "object", + "title": "MarginAccountSummary", + "required": [ + "assetsValue", + "borrowLiability", + "collateral", + "imf", + "unsettledEquity", + "liabilitiesValue", + "mmf", + "netEquity", + "netEquityAvailable", + "netEquityLocked", + "netExposureFutures", + "pnlUnrealized" + ], + "properties": { + "assetsValue": { + "type": "string", + "format": "decimal", + "description": "Notional value of assets" + }, + "borrowLiability": { + "type": "string", + "format": "decimal", + "description": "Total borrow notional." + }, + "collateral": { + "type": "array", + "description": "Collateral held for a given spot asset.", + "items": { + "$ref": "#/components/schemas/Collateral" + } + }, + "imf": { + "type": "string", + "format": "decimal", + "description": "Initial margin fraction." + }, + "unsettledEquity": { + "type": "string", + "format": "decimal", + "description": "Unsettled claim on the liquidity fund." + }, + "liabilitiesValue": { + "type": "string", + "format": "decimal", + "description": "Notional value of liabilities" + }, + "marginFraction": { + "type": "string", + "format": "decimal", + "description": "Margin fraction." + }, + "mmf": { + "type": "string", + "format": "decimal", + "description": "Maintenance margin fraction." + }, + "netEquity": { + "type": "string", + "format": "decimal", + "description": "Net equity." + }, + "netEquityAvailable": { + "type": "string", + "format": "decimal", + "description": "Net equity available." + }, + "netEquityLocked": { + "type": "string", + "format": "decimal", + "description": "Net equity Locked." + }, + "netExposureFutures": { + "type": "string", + "format": "decimal", + "description": "Total exposure of positions as well potential open positions." + }, + "pnlUnrealized": { + "type": "string", + "format": "decimal", + "description": "Unrealised PnL." + } + } + }, + "MarkPrice": { + "type": "object", + "title": "MarkPrice", + "required": [ + "fundingRate", + "indexPrice", + "markPrice", + "nextFundingTimestamp", + "symbol" + ], + "properties": { + "fundingRate": { + "type": "string", + "format": "decimal", + "description": "The funding rate for the current interval." + }, + "indexPrice": { + "type": "string", + "format": "decimal", + "description": "The index price for the market." + }, + "markPrice": { + "type": "string", + "format": "decimal", + "description": "The mark price for the market." + }, + "nextFundingTimestamp": { + "type": "integer", + "format": "int64", + "description": "The end time of the current interval and start time of next interval.\nFunding payments will be distributed at this time." + }, + "symbol": { + "type": "string", + "description": "The symbol of the market." + } + } + }, + "Market": { + "type": "object", + "title": "Market", + "required": [ + "symbol", + "baseSymbol", + "quoteSymbol", + "marketType", + "filters", + "orderBookState", + "createdAt", + "visible" + ], + "properties": { + "symbol": { + "type": "string", + "description": "Symbol of the market, e.g. `ETH_USDC`" + }, + "baseSymbol": { + "description": "The base asset of the market.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "The base asset of the market." + } + ] + }, + "quoteSymbol": { + "description": "The quote asset of the market.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "The quote asset of the market." + } + ] + }, + "marketType": { + "description": "The type of the market.", + "allOf": [ + { + "$ref": "#/components/schemas/MarketType" + }, + { + "description": "The type of the market." + } + ] + }, + "filters": { + "description": "Price, lot and leverage rules.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderBookFilters" + }, + { + "description": "Price, lot and leverage rules." + } + ] + }, + "imfFunction": { + "description": "IMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "IMF function." + } + ] + }, + "mmfFunction": { + "description": "MMF function.", + "allOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction" + }, + { + "description": "MMF function." + } + ] + }, + "fundingInterval": { + "type": "integer", + "format": "uint64", + "description": "Funding interval for perpetuals in milliseconds." + }, + "fundingRateUpperBound": { + "type": "string", + "format": "decimal", + "description": "Funding rate upper bound for perpetual markets. In basis points. E.g. 10\n= 10bps" + }, + "fundingRateLowerBound": { + "type": "string", + "format": "decimal", + "description": "Funding rate lower bound for perpetual markets. In basis points. E.g.\n-10 = -10bps" + }, + "openInterestLimit": { + "type": "string", + "format": "decimal", + "description": "Maximum open interest limit for the market if the market is a future." + }, + "orderBookState": { + "description": "The order book state.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderBookState" + }, + { + "description": "The order book state." + } + ] + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "Market created at time." + }, + "visible": { + "type": "boolean", + "description": "Market currently visible." + } + } + }, + "MarketAsset": { + "type": "object", + "title": "MarketAsset", + "required": [ + "symbol", + "displayName", + "tokens" + ], + "properties": { + "symbol": { + "description": "Symbol of the asset, e.g. ETH.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "Symbol of the asset, e.g. ETH." + } + ] + }, + "displayName": { + "type": "string", + "description": "Display name of the asset." + }, + "coingeckoId": { + "type": "string", + "description": "Coingecko ID of the asset." + }, + "tokens": { + "type": "array", + "description": "Token on each blockchain the asset is available on.", + "items": { + "$ref": "#/components/schemas/Token" + } + } + } + }, + "MarketOrder": { + "type": "object", + "title": "MarketOrder", + "required": [ + "id", + "createdAt", + "executedQuantity", + "executedQuoteQuantity", + "timeInForce", + "selfTradePrevention", + "side", + "status", + "symbol" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique ID of this order." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom order ID." + }, + "createdAt": { + "type": "integer", + "format": "int64", + "description": "Time the order was created." + }, + "executedQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity that has been filled." + }, + "executedQuoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the quote asset that has been filled." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to fill." + }, + "quoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the quote asset to fill." + }, + "reduceOnly": { + "type": "boolean", + "description": "True if reducing a futures position." + }, + "timeInForce": { + "description": "How long the order is good for.", + "allOf": [ + { + "$ref": "#/components/schemas/TimeInForce" + }, + { + "description": "How long the order is good for." + } + ] + }, + "selfTradePrevention": { + "description": "Action to take in the event the user crosses themselves in the\norder book. Default is `RejectTaker`.", + "allOf": [ + { + "$ref": "#/components/schemas/SelfTradePrevention" + }, + { + "description": "Action to take in the event the user crosses themselves in the\norder book. Default is `RejectTaker`." + } + ] + }, + "side": { + "description": "The order side. It will be matched against the resting orders on the\nother side of the order book.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "The order side. It will be matched against the resting orders on the\nother side of the order book." + } + ] + }, + "status": { + "description": "Status of the order.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderStatus" + }, + { + "description": "Status of the order." + } + ] + }, + "stopLossTriggerPrice": { + "type": "string", + "description": "Stop loss price (price the stop loss order will be triggered at)." + }, + "stopLossLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Stop loss limit price. If set the stop loss will be a limit order,\notherwise it will be a market order." + }, + "stopLossTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the stop loss order." + }, + "symbol": { + "type": "string", + "description": "Market symbol." + }, + "takeProfitTriggerPrice": { + "type": "string", + "description": "Take profit price (price the take profit order will be triggered at)." + }, + "takeProfitLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Take profit limit price. If set the take profit will be a limit order,\notherwise it will be a market order." + }, + "takeProfitTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the take profit order." + }, + "triggerBy": { + "type": "string", + "description": "Reference price that should trigger the order." + }, + "triggerPrice": { + "type": "string", + "description": "Price the order should trigger at, if any." + }, + "triggerQuantity": { + "type": "string", + "description": "Quantity for trigger orders." + }, + "triggeredAt": { + "type": "integer", + "format": "int64" + }, + "relatedOrderId": { + "type": "string", + "description": "The ID of the related order. This may refer to a parent order or,\nfor a trigger order, the order this trigger is for." + }, + "strategyId": { + "type": "string", + "description": "Strategy ID of the order, if any." + }, + "slippageTolerance": { + "type": "string", + "format": "decimal", + "description": "Slippage tolerance allowed for the order." + }, + "slippageToleranceType": { + "description": "Slippage tolerance type", + "allOf": [ + { + "$ref": "#/components/schemas/SlippageToleranceType" + }, + { + "description": "Slippage tolerance type" + } + ] + } + } + }, + "MarketType": { + "type": "string", + "enum": [ + "SPOT", + "PERP", + "IPERP", + "DATED", + "PREDICTION", + "RFQ" + ] + }, + "MaxBorrowQuantity": { + "type": "object", + "title": "MaxBorrowQuantity", + "required": [ + "maxBorrowQuantity", + "symbol" + ], + "properties": { + "maxBorrowQuantity": { + "type": "string", + "format": "decimal" + }, + "symbol": { + "type": "string" + } + } + }, + "MaxOrderQuantity": { + "type": "object", + "title": "MaxOrderQuantity", + "required": [ + "maxOrderQuantity", + "side", + "symbol" + ], + "properties": { + "autoBorrow": { + "type": "boolean" + }, + "autoBorrowRepay": { + "type": "boolean" + }, + "autoLendRedeem": { + "type": "boolean" + }, + "maxOrderQuantity": { + "type": "string", + "format": "decimal" + }, + "price": { + "type": "string", + "format": "decimal" + }, + "side": { + "type": "string" + }, + "symbol": { + "type": "string" + }, + "reduceOnly": { + "type": "boolean" + } + } + }, + "MaxWithdrawalQuantity": { + "type": "object", + "title": "MaxWithdrawalQuantity", + "required": [ + "maxWithdrawalQuantity", + "symbol" + ], + "properties": { + "autoBorrow": { + "type": "boolean" + }, + "autoLendRedeem": { + "type": "boolean" + }, + "maxWithdrawalQuantity": { + "type": "string", + "format": "decimal" + }, + "symbol": { + "type": "string" + } + } + }, + "OpenInterest": { + "type": "object", + "title": "OpenInterest", + "required": [ + "symbol", + "timestamp" + ], + "properties": { + "symbol": { + "type": "string", + "description": "The symbol of the market." + }, + "openInterest": { + "type": "string", + "format": "decimal", + "description": "The open interest." + }, + "timestamp": { + "type": "integer", + "format": "int64", + "description": "Timestamp." + } + } + }, + "Order": { + "type": "object", + "title": "Order", + "required": [ + "id", + "createdAt", + "orderType", + "selfTradePrevention", + "status", + "side", + "symbol", + "timeInForce" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique ID of the order." + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "Time the order was created." + }, + "executedQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the order that has been filled." + }, + "executedQuoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the order that has been filled in the quote asset." + }, + "expiryReason": { + "description": "Order expiry reason.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderExpiryReason" + }, + { + "description": "Order expiry reason." + } + ] + }, + "orderType": { + "description": "Type of order.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderTypeEnum" + }, + { + "description": "Type of order." + } + ] + }, + "postOnly": { + "type": "boolean", + "description": "Whether the order is post only or not." + }, + "price": { + "type": "string", + "format": "decimal", + "description": "Price that the order was submitted at (if `orderType` is `Limit`)" + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the order." + }, + "quoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the order in quote the quote asset." + }, + "selfTradePrevention": { + "description": "Self trade prevention setting of the order. Default is `RejectTaker`.", + "allOf": [ + { + "$ref": "#/components/schemas/SelfTradePrevention" + }, + { + "description": "Self trade prevention setting of the order. Default is `RejectTaker`." + } + ] + }, + "status": { + "description": "Status of the order.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderStatus" + }, + { + "description": "Status of the order." + } + ] + }, + "side": { + "description": "Side of the order.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "Side of the order." + } + ] + }, + "stopLossTriggerPrice": { + "type": "string", + "description": "Stop loss price (price the stop loss order will be triggered at)." + }, + "stopLossLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Stop loss limit price. If set the stop loss will be a limit order,\notherwise it will be a market order." + }, + "stopLossTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the stop loss order." + }, + "symbol": { + "type": "string", + "description": "Market symbol of the order." + }, + "takeProfitTriggerPrice": { + "type": "string", + "description": "Take profit price (price the take profit order will be triggered at)." + }, + "takeProfitLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Take profit limit price. If set the take profit will be a limit order,\notherwise it will be a market order." + }, + "takeProfitTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the take profit order." + }, + "timeInForce": { + "description": "Time in force of the order.", + "allOf": [ + { + "$ref": "#/components/schemas/TimeInForce" + }, + { + "description": "Time in force of the order." + } + ] + }, + "triggerBy": { + "type": "string", + "description": "Reference price that should trigger the order." + }, + "triggerPrice": { + "type": "string", + "description": "Price the order was set to trigger at." + }, + "triggerQuantity": { + "type": "string", + "description": "Trigger quantity." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom order ID." + }, + "systemOrderType": { + "description": "The type of system order, if applicable.", + "allOf": [ + { + "$ref": "#/components/schemas/SystemOrderType" + }, + { + "description": "The type of system order, if applicable." + } + ] + }, + "strategyId": { + "type": "string", + "description": "Strategy ID of the order, if any." + }, + "slippageTolerance": { + "type": "string", + "format": "decimal", + "description": "Slippage tolerance allowed for the order." + }, + "slippageToleranceType": { + "description": "Slippage tolerance type", + "allOf": [ + { + "$ref": "#/components/schemas/SlippageToleranceType" + }, + { + "description": "Slippage tolerance type" + } + ] + } + } + }, + "OrderBookFilters": { + "type": "object", + "title": "OrderBookFilters", + "required": [ + "price", + "quantity" + ], + "properties": { + "price": { + "description": "Defines the price rules for the order book.", + "allOf": [ + { + "$ref": "#/components/schemas/PriceFilter" + }, + { + "description": "Defines the price rules for the order book." + } + ] + }, + "quantity": { + "description": "Defines the quantity rules for the order book.", + "allOf": [ + { + "$ref": "#/components/schemas/QuantityFilter" + }, + { + "description": "Defines the quantity rules for the order book." + } + ] + } + } + }, + "OrderBookState": { + "type": "string", + "enum": [ + "Open", + "Closed", + "CancelOnly", + "LimitOnly", + "PostOnly" + ] + }, + "OrderCancelAllPayload": { + "type": "object", + "title": "OrderCancelAllPayload", + "required": [ + "symbol" + ], + "properties": { + "symbol": { + "type": "string", + "description": "Market to cancel orders for." + }, + "orderType": { + "description": "Type of orders to cancel.", + "allOf": [ + { + "$ref": "#/components/schemas/CancelOrderTypeEnum" + }, + { + "description": "Type of orders to cancel." + } + ] + } + } + }, + "OrderCancelPayload": { + "type": "object", + "title": "OrderCancelPayload", + "required": [ + "symbol" + ], + "properties": { + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Client ID of the order." + }, + "orderId": { + "type": "string", + "description": "ID of the order." + }, + "symbol": { + "type": "string", + "description": "Market the order exists on." + } + } + }, + "OrderExecutePayload": { + "type": "object", + "title": "OrderExecutePayload", + "required": [ + "orderType", + "side", + "symbol" + ], + "properties": { + "autoLend": { + "type": "boolean", + "description": "If true then the order can lend. Spot margin only." + }, + "autoLendRedeem": { + "type": "boolean", + "description": "If true then the order can redeem a lend if required. Spot margin only." + }, + "autoBorrow": { + "type": "boolean", + "description": "If true then the order can borrow. Spot margin only." + }, + "autoBorrowRepay": { + "type": "boolean", + "description": "If true then the order can repay a borrow. Spot margin only." + }, + "brokerId": { + "type": "integer", + "format": "uint16", + "description": "Broker ID of the order." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom order id." + }, + "orderType": { + "description": "Order type, market or limit.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderTypeEnum" + }, + { + "description": "Order type, market or limit." + } + ] + }, + "postOnly": { + "type": "boolean", + "description": "Only post liquidity, do not take liquidity." + }, + "price": { + "type": "string", + "format": "decimal", + "description": "The order price if this is a limit order." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "The order quantity. Market orders must specify either a `quantity` or\n`quoteQuantity`. All other order types must specify a `quantity`." + }, + "quoteQuantity": { + "type": "string", + "format": "decimal", + "description": "The maximum amount of the quote asset to spend (Ask) or receive (Bid)\nfor market orders. This is used for reverse market orders. The\norder book will execute a `quantity` as close as possible to the\nnotional value of `quoteQuantity`." + }, + "reduceOnly": { + "type": "boolean", + "description": "If true then the order can only reduce the positon. Futures only." + }, + "selfTradePrevention": { + "description": "Action to take if the user crosses themselves in the order book.", + "allOf": [ + { + "$ref": "#/components/schemas/SelfTradePrevention" + }, + { + "description": "Action to take if the user crosses themselves in the order book." + } + ] + }, + "side": { + "description": "Order will be matched against the resting orders on the other side of\nthe order book.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "Order will be matched against the resting orders on the other side of\nthe order book." + } + ] + }, + "stopLossLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Stop loss limit price. If set the stop loss will be a limit order." + }, + "stopLossTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the stop loss order." + }, + "stopLossTriggerPrice": { + "type": "string", + "description": "Stop loss price (price the stop loss order will be triggered at)." + }, + "symbol": { + "type": "string", + "description": "The market for the order." + }, + "takeProfitLimitPrice": { + "type": "string", + "format": "decimal", + "description": "Take profit limit price. If set the take profit will be a limit order," + }, + "takeProfitTriggerBy": { + "type": "string", + "description": "Reference price that should trigger the take profit order." + }, + "takeProfitTriggerPrice": { + "type": "string", + "description": "Take profit price (price the take profit order will be triggered at)." + }, + "timeInForce": { + "description": "How long the order is good for.", + "allOf": [ + { + "$ref": "#/components/schemas/TimeInForce" + }, + { + "description": "How long the order is good for." + } + ] + }, + "triggerBy": { + "type": "string", + "description": "Trigger by." + }, + "triggerPrice": { + "type": "string", + "description": "Trigger price if this is a conditional order." + }, + "triggerQuantity": { + "type": "string", + "description": "Trigger quantity type if this is a trigger order." + }, + "slippageTolerance": { + "type": "string", + "format": "decimal", + "description": "Slippage tolerance allowed for the order." + }, + "slippageToleranceType": { + "description": "Slippage tolerance type.", + "allOf": [ + { + "$ref": "#/components/schemas/SlippageToleranceType" + }, + { + "description": "Slippage tolerance type." + } + ] + } + } + }, + "OrderExpiryReason": { + "type": "string", + "enum": [ + "AccountTradingSuspended", + "BorrowRequiresLendRedeem", + "FillOrKill", + "InsufficientBorrowableQuantity", + "InsufficientFunds", + "InsufficientLiquidity", + "InvalidPrice", + "InvalidQuantity", + "ImmediateOrCancel", + "InsufficientMargin", + "Liquidation", + "NegativeEquity", + "PostOnlyMode", + "PostOnlyTaker", + "PriceOutOfBounds", + "ReduceOnlyNotReduced", + "SelfTradePrevention", + "StopWithoutPosition", + "PriceImpact", + "Unknown", + "UserPermissions", + "MaxStopOrdersPerPosition", + "PositionLimit", + "SlippageToleranceExceeded" + ] + }, + "OrderFill": { + "type": "object", + "title": "OrderFill", + "required": [ + "fee", + "feeSymbol", + "isMaker", + "orderId", + "price", + "quantity", + "side", + "symbol", + "timestamp" + ], + "properties": { + "clientId": { + "type": "string", + "description": "Client id of the order." + }, + "fee": { + "type": "string", + "format": "decimal", + "description": "The fee charged on the fill." + }, + "feeSymbol": { + "type": "string", + "description": "The asset that is charged as a fee." + }, + "isMaker": { + "type": "boolean", + "description": "Whether the fill was made by the maker." + }, + "orderId": { + "type": "string", + "description": "The order ID of the fill." + }, + "price": { + "type": "string", + "format": "decimal", + "description": "The price of the fill." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "The quantity of the fill." + }, + "side": { + "description": "The side of the fill.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "The side of the fill." + } + ] + }, + "symbol": { + "type": "string", + "description": "The market symbol of the fill." + }, + "systemOrderType": { + "description": "The type of system order that triggered the fill.", + "allOf": [ + { + "$ref": "#/components/schemas/SystemOrderType" + }, + { + "description": "The type of system order that triggered the fill." + } + ] + }, + "timestamp": { + "type": "string", + "format": "naive-date-time", + "description": "The timestamp of the fill (UTC)." + }, + "tradeId": { + "type": "integer", + "format": "int64", + "description": "The trade ID of the fill." + } + } + }, + "OrderStatus": { + "type": "string", + "enum": [ + "Cancelled", + "Expired", + "Filled", + "New", + "PartiallyFilled", + "TriggerPending", + "TriggerFailed" + ] + }, + "OrderType": { + "type": "object", + "anyOf": [ + { + "$ref": "#/components/schemas/OrderType_MarketOrder" + }, + { + "$ref": "#/components/schemas/OrderType_LimitOrder" + } + ], + "discriminator": { + "propertyName": "orderType", + "mapping": { + "Market": "#/components/schemas/OrderType_MarketOrder", + "Limit": "#/components/schemas/OrderType_LimitOrder" + } + } + }, + "OrderTypeEnum": { + "type": "string", + "enum": [ + "Market", + "Limit" + ] + }, + "OrderType_LimitOrder": { + "allOf": [ + { + "type": "object", + "required": [ + "orderType" + ], + "properties": { + "orderType": { + "type": "string", + "enum": [ + "Limit" + ], + "example": "Limit" + } + } + }, + { + "$ref": "#/components/schemas/LimitOrder" + } + ] + }, + "OrderType_MarketOrder": { + "allOf": [ + { + "type": "object", + "required": [ + "orderType" + ], + "properties": { + "orderType": { + "type": "string", + "enum": [ + "Market" + ], + "example": "Market" + } + } + }, + { + "$ref": "#/components/schemas/MarketOrder" + } + ] + }, + "PaymentType": { + "type": "string", + "enum": [ + "EntryFee", + "Borrow", + "Lend", + "UnrealizedPositivePnl", + "UnrealizedNegativePnl" + ] + }, + "PositionEstimatedLiquidationPrice": { + "type": "object", + "title": "PositionEstimatedLiquidationPrice", + "required": [ + "liquidationPrice", + "markPrice" + ], + "properties": { + "liquidationPrice": { + "type": "string", + "format": "decimal" + }, + "markPrice": { + "type": "string", + "format": "decimal" + } + } + }, + "PositionImfFunction": { + "type": "object", + "anyOf": [ + { + "$ref": "#/components/schemas/PositionImfFunction_SqrtFunction" + } + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "sqrt": "#/components/schemas/PositionImfFunction_SqrtFunction" + } + } + }, + "PositionImfFunction_SqrtFunction": { + "allOf": [ + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "sqrt" + ], + "example": "sqrt" + } + } + }, + { + "$ref": "#/components/schemas/SqrtFunction" + } + ] + }, + "PriceBandMarkPrice": { + "type": "object", + "title": "PriceBandMarkPrice", + "required": [ + "maxMultiplier", + "minMultiplier" + ], + "properties": { + "maxMultiplier": { + "type": "string", + "format": "decimal", + "description": "Maximum allowed multiplier move from mean price." + }, + "minMultiplier": { + "type": "string", + "format": "decimal", + "description": "Minimum allowed multiplier move from mean price." + } + } + }, + "PriceBandMeanPremium": { + "type": "object", + "title": "PriceBandMeanPremium", + "required": [ + "tolerancePct" + ], + "properties": { + "tolerancePct": { + "type": "string", + "format": "decimal", + "description": "Maximum allowed deviation from the mean premium. E.g. if\n`tolerance_pct` is 0.05 (5%), and the mean premium is 5%, then\norders will be prevented from being placed if the premium exceeds 10%." + } + } + }, + "PriceFilter": { + "type": "object", + "title": "PriceFilter", + "required": [ + "minPrice", + "tickSize" + ], + "properties": { + "minPrice": { + "type": "string", + "format": "decimal", + "description": "Minimum price the order book will allow." + }, + "maxPrice": { + "type": "string", + "format": "decimal", + "description": "Maximum price the order book will allow." + }, + "tickSize": { + "type": "string", + "format": "decimal", + "description": "Price increment." + }, + "maxMultiplier": { + "type": "string", + "format": "decimal", + "description": "Maximum allowed multiplier from last active price." + }, + "minMultiplier": { + "type": "string", + "format": "decimal", + "description": "Minimum allowed multiplier from last active price." + }, + "maxImpactMultiplier": { + "type": "string", + "format": "decimal", + "description": "Maximum allowed impact multiplier from best offer. This\ndetermines how far above the best ask a market buy can penetrate." + }, + "minImpactMultiplier": { + "type": "string", + "format": "decimal", + "description": "Minimum allowed impact multiplier from best bid. This\ndetermines how far below the best bid a market sell can penetrate." + }, + "meanMarkPriceBand": { + "description": "Futures price band. Used to determine how far the price is allowed to\ndeviate from the mean mark price.", + "allOf": [ + { + "$ref": "#/components/schemas/PriceBandMarkPrice" + }, + { + "description": "Futures price band. Used to determine how far the price is allowed to\ndeviate from the mean mark price." + } + ] + }, + "meanPremiumBand": { + "description": "Futures price band. Used to determine how far the premium is allowed to\ndeviate from the mean premium.", + "allOf": [ + { + "$ref": "#/components/schemas/PriceBandMeanPremium" + }, + { + "description": "Futures price band. Used to determine how far the premium is allowed to\ndeviate from the mean premium." + } + ] + }, + "borrowEntryFeeMaxMultiplier": { + "type": "string", + "format": "decimal", + "description": "Maximum allowed multiplier move from last active price without incurring\nan entry fee for spot margin." + }, + "borrowEntryFeeMinMultiplier": { + "type": "string", + "format": "decimal", + "description": "Minimum allowed multiplier move from last active price without incurring\nan entry fee for spot margin." + } + } + }, + "QuantityFilter": { + "type": "object", + "title": "QuantityFilter", + "required": [ + "minQuantity", + "stepSize" + ], + "properties": { + "minQuantity": { + "type": "string", + "format": "decimal", + "description": "Minimum quantity the order book will allow.\n\nFor futures, this will be the threshold at which a position gets closed\nand so it should be as close as possible, preferably equal, to the\n`step_size`." + }, + "maxQuantity": { + "type": "string", + "format": "decimal", + "description": "Maximum quantity the order book will allow." + }, + "stepSize": { + "type": "string", + "format": "decimal", + "description": "Quantity increment." + } + } + }, + "Quote": { + "type": "object", + "title": "Quote", + "required": [ + "rfqId", + "quoteId", + "bidPrice", + "askPrice", + "status", + "createdAt" + ], + "properties": { + "rfqId": { + "type": "string", + "description": "Unique RFQ order ID, assigned by the matching engine." + }, + "quoteId": { + "type": "string", + "description": "Unique RFQ quote ID, assigned by the matching engine." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ quote ID, assigned by the maker (optionally)." + }, + "bidPrice": { + "type": "string", + "format": "decimal", + "description": "Quote bid price." + }, + "askPrice": { + "type": "string", + "format": "decimal", + "description": "Quote ask price." + }, + "status": { + "description": "Status.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderStatus" + }, + { + "description": "Status." + } + ] + }, + "createdAt": { + "type": "integer", + "format": "int64", + "description": "Time the quote was created." + } + } + }, + "QuoteAcceptPayload": { + "type": "object", + "title": "QuoteAcceptPayload", + "required": [ + "quoteId" + ], + "properties": { + "rfqId": { + "type": "string", + "description": "RFQ ID." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ ID." + }, + "quoteId": { + "type": "string", + "description": "RFQ quote ID." + } + } + }, + "QuoteHistorical": { + "type": "object", + "title": "QuoteHistorical", + "required": [ + "userId", + "rfqId", + "quoteId", + "bidPrice", + "askPrice", + "status", + "createdAt" + ], + "properties": { + "userId": { + "type": "integer", + "format": "int32", + "description": "User ID." + }, + "subaccountId": { + "type": "integer", + "format": "int32", + "description": "Subaccount ID." + }, + "rfqId": { + "type": "string", + "description": "Unique RFQ order ID, assigned by the matching engine." + }, + "quoteId": { + "type": "string", + "description": "Unique RFQ quote ID, assigned by the matching engine." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ quote ID, assigned by the maker (optionally)." + }, + "bidPrice": { + "type": "string", + "format": "decimal", + "description": "Quote bid price." + }, + "askPrice": { + "type": "string", + "format": "decimal", + "description": "Quote ask price." + }, + "status": { + "description": "Status.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderStatus" + }, + { + "description": "Status." + } + ] + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "Time the quote was created." + } + } + }, + "QuotePayload": { + "type": "object", + "title": "QuotePayload", + "required": [ + "rfqId", + "bidPrice", + "askPrice" + ], + "properties": { + "rfqId": { + "type": "string", + "description": "RFQ ID." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ quote ID." + }, + "bidPrice": { + "type": "string", + "format": "decimal", + "description": "Bid price." + }, + "askPrice": { + "type": "string", + "format": "decimal", + "description": "Ask price." + } + } + }, + "RequestForQuote": { + "type": "object", + "title": "RequestForQuote", + "required": [ + "rfqId", + "symbol", + "side", + "submissionTime", + "expiryTime", + "status", + "executionMode", + "createdAt" + ], + "properties": { + "rfqId": { + "type": "string", + "description": "Unique RFQ order ID, assigned by the matching engine." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ order ID, assigned by the user (optionally)." + }, + "symbol": { + "type": "string", + "description": "Market symbol." + }, + "side": { + "description": "Side.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "Side." + } + ] + }, + "price": { + "type": "string", + "format": "decimal", + "description": "RFQ price.\nPrice of the RFQ. Only when execution mode is `Immediate`." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to fill (in base asset)." + }, + "quoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to fill (in quote asset)." + }, + "submissionTime": { + "type": "integer", + "format": "int64", + "description": "Time (milliseconds since epoch) by which quotes must be submitted for\nthe RFQ." + }, + "systemOrderType": { + "description": "The type of system order, only when RFQ was initiated by the system.", + "allOf": [ + { + "$ref": "#/components/schemas/SystemOrderType" + }, + { + "description": "The type of system order, only when RFQ was initiated by the system." + } + ] + }, + "expiryTime": { + "type": "integer", + "format": "int64", + "description": "Time (milliseconds since epoch) by which the RFQ expires if no match." + }, + "status": { + "description": "Status.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderStatus" + }, + { + "description": "Status." + } + ] + }, + "executionMode": { + "description": "RFQ execution mode.", + "allOf": [ + { + "$ref": "#/components/schemas/RfqExecutionMode" + }, + { + "description": "RFQ execution mode." + } + ] + }, + "createdAt": { + "type": "integer", + "format": "int64", + "description": "Time the RFQ was created." + } + } + }, + "RequestForQuoteCancelPayload": { + "type": "object", + "title": "RequestForQuoteCancelPayload", + "properties": { + "rfqId": { + "type": "string", + "description": "RFQ ID." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ ID." + } + } + }, + "RequestForQuoteHistorical": { + "type": "object", + "title": "RequestForQuoteHistorical", + "required": [ + "userId", + "rfqId", + "symbol", + "side", + "submissionTime", + "expiryTime", + "status", + "executionMode", + "createdAt" + ], + "properties": { + "userId": { + "type": "integer", + "format": "int32", + "description": "User ID." + }, + "subaccountId": { + "type": "integer", + "format": "int32", + "description": "Subaccount ID." + }, + "rfqId": { + "type": "string", + "description": "Unique RFQ order ID, assigned by the matching engine." + }, + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ order ID, assigned by the user (optionally)." + }, + "symbol": { + "type": "string", + "description": "Market symbol." + }, + "side": { + "description": "Side.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "Side." + } + ] + }, + "price": { + "type": "string", + "format": "decimal", + "description": "RFQ price.\nPrice of the RFQ. Only when execution mode is `Immediate`." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to fill (in base asset)." + }, + "quoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to fill (in quote asset)." + }, + "submissionTime": { + "type": "string", + "format": "naive-date-time", + "description": "Time by which quotes must be submitted for\nthe RFQ." + }, + "expiryTime": { + "type": "string", + "format": "naive-date-time", + "description": "Time by which the RFQ expires if no match." + }, + "status": { + "description": "Status.", + "allOf": [ + { + "$ref": "#/components/schemas/OrderStatus" + }, + { + "description": "Status." + } + ] + }, + "executionMode": { + "description": "RFQ execution mode.", + "allOf": [ + { + "$ref": "#/components/schemas/RfqExecutionMode" + }, + { + "description": "RFQ execution mode." + } + ] + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "Time the RFQ was created." + } + } + }, + "RequestForQuotePayload": { + "type": "object", + "title": "RequestForQuotePayload", + "required": [ + "symbol", + "side" + ], + "properties": { + "clientId": { + "type": "integer", + "format": "uint32", + "description": "Custom RFQ ID." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "RFQ quantity (in base asset)." + }, + "quoteQuantity": { + "type": "string", + "format": "decimal", + "description": "RFQ quote quantity (in quote asset)." + }, + "price": { + "type": "string", + "format": "decimal", + "description": "RFQ price. Only when execution mode is `Immediate`." + }, + "symbol": { + "type": "string", + "description": "RFQ symbol." + }, + "side": { + "description": "Side of the order.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "Side of the order." + } + ] + }, + "executionMode": { + "description": "Execution mode. Defaults to `AwaitAccept` when not provided.", + "allOf": [ + { + "$ref": "#/components/schemas/RfqExecutionMode" + }, + { + "description": "Execution mode. Defaults to `AwaitAccept` when not provided." + } + ] + } + } + }, + "RequestForQuoteRefreshPayload": { + "type": "object", + "title": "RequestForQuoteRefreshPayload", + "required": [ + "rfqId" + ], + "properties": { + "rfqId": { + "type": "string", + "description": "RFQ ID. An RFQ can only be refreshed using the RFQ ID." + } + } + }, + "RfqExecutionMode": { + "type": "string", + "enum": [ + "AwaitAccept", + "Immediate" + ] + }, + "ScheduledStrategy": { + "type": "object", + "title": "ScheduledStrategy", + "required": [ + "id", + "createdAt", + "executedQuantity", + "executedQuoteQuantity", + "quantity", + "selfTradePrevention", + "status", + "side", + "symbol", + "timeInForce", + "duration", + "interval" + ], + "properties": { + "id": { + "type": "string", + "description": "ID of the strategy." + }, + "clientStrategyId": { + "type": "integer", + "format": "uint32", + "description": "Custom client strategy ID." + }, + "createdAt": { + "type": "integer", + "format": "int64", + "description": "Time the strategey was created." + }, + "executedQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity that has been filled." + }, + "executedQuoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quote quantity that has been filled." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity to fill." + }, + "reduceOnly": { + "type": "boolean", + "description": "True if reducing a futures position." + }, + "selfTradePrevention": { + "description": "Action to take in the event the user crosses themselves in the\norder book.", + "allOf": [ + { + "$ref": "#/components/schemas/SelfTradePrevention" + }, + { + "description": "Action to take in the event the user crosses themselves in the\norder book." + } + ] + }, + "status": { + "description": "Status of the strategy.", + "allOf": [ + { + "$ref": "#/components/schemas/StrategyStatus" + }, + { + "description": "Status of the strategy." + } + ] + }, + "side": { + "description": "The strategy side. The strategy's orders will be matched against the\nresting orders on the other side of the order book.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "The strategy side. The strategy's orders will be matched against the\nresting orders on the other side of the order book." + } + ] + }, + "symbol": { + "type": "string", + "description": "Market symbol." + }, + "timeInForce": { + "description": "How long the strategy's orders is good for.", + "allOf": [ + { + "$ref": "#/components/schemas/TimeInForce" + }, + { + "description": "How long the strategy's orders is good for." + } + ] + }, + "duration": { + "type": "integer", + "format": "uint64", + "description": "Duration of the strategy in milliseconds." + }, + "interval": { + "type": "integer", + "format": "uint64", + "description": "Interval of the strategy in milliseconds." + }, + "randomizedIntervalQuantity": { + "type": "boolean", + "description": "Determines whether the strategy will execute a randomized interval\nquantity." + }, + "slippageTolerance": { + "type": "string", + "format": "decimal", + "description": "Slippage tolerance allowed for the order." + }, + "slippageToleranceType": { + "description": "Slippage tolerance type", + "allOf": [ + { + "$ref": "#/components/schemas/SlippageToleranceType" + }, + { + "description": "Slippage tolerance type" + } + ] + } + } + }, + "SelfTradePrevention": { + "type": "string", + "enum": [ + "RejectTaker", + "RejectMaker", + "RejectBoth" + ] + }, + "Settlement": { + "type": "object", + "title": "Settlement", + "required": [ + "quantity", + "source", + "timestamp", + "userId" + ], + "properties": { + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the settlement." + }, + "source": { + "description": "Source of the settlement.", + "allOf": [ + { + "$ref": "#/components/schemas/SettlementSource" + }, + { + "description": "Source of the settlement." + } + ] + }, + "subaccountId": { + "type": "integer", + "format": "int32", + "description": "ID of the subaccount the event is associated with, if any." + }, + "timestamp": { + "type": "string", + "format": "naive-date-time", + "description": "The timestamp of the settlement (UTC)." + }, + "userId": { + "type": "integer", + "format": "int32", + "description": "User ID of the account the movement is associated with." + } + } + }, + "SettlementSource": { + "type": "string", + "enum": [ + "TradingFees", + "TradingFeesSystem", + "FundingPayment", + "CulledBorrowInterest", + "CulledRealizePnlAuto", + "CulledRealizePnlBookUtilisation", + "CulledRealizePnlAccountThreshold", + "CulledRealizePnlSystemThreshold", + "RealizePnl", + "BackstopProviderLiquidation", + "BackstopAdlLiquidation", + "BackstopLiquidityFundProceeds" + ] + }, + "SettlementSourceFilter": { + "type": "string", + "enum": [ + "BackstopLiquidation", + "CulledBorrowInterest", + "CulledRealizePnl", + "CulledRealizePnlBookUtilization", + "FundingPayment", + "RealizePnl", + "TradingFees", + "TradingFeesSystem" + ] + }, + "Side": { + "type": "string", + "enum": [ + "Bid", + "Ask" + ] + }, + "SlippageToleranceType": { + "type": "string", + "enum": [ + "TickSize", + "Percent" + ] + }, + "SortDirection": { + "type": "string", + "enum": [ + "Asc", + "Desc" + ] + }, + "SqrtFunction": { + "type": "object", + "title": "SqrtFunction", + "required": [ + "base", + "factor" + ], + "properties": { + "base": { + "type": "string", + "format": "decimal" + }, + "factor": { + "type": "string", + "format": "decimal" + } + } + }, + "Status": { + "type": "string", + "enum": [ + "Ok", + "Maintenance" + ] + }, + "StatusAndMessage": { + "type": "object", + "title": "StatusAndMessage", + "required": [ + "status" + ], + "properties": { + "status": { + "description": "Status of the system.", + "allOf": [ + { + "$ref": "#/components/schemas/Status" + }, + { + "description": "Status of the system." + } + ] + }, + "message": { + "type": "string", + "description": "Status message, if any." + } + } + }, + "Strategy": { + "type": "object", + "title": "Strategy", + "required": [ + "id", + "createdAt", + "strategyType", + "selfTradePrevention", + "status", + "side", + "symbol", + "timeInForce", + "duration", + "interval", + "randomizedIntervalQuantity" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique ID of the strategy." + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "Time the strategy was created." + }, + "executedQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the strategy that has been filled." + }, + "executedQuoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quote quantity of the strategy that has been filled." + }, + "cancelReason": { + "description": "Strategy cancel reason.", + "allOf": [ + { + "$ref": "#/components/schemas/StrategyCrankCancelReason" + }, + { + "description": "Strategy cancel reason." + } + ] + }, + "strategyType": { + "description": "Type of strategy.", + "allOf": [ + { + "$ref": "#/components/schemas/StrategyTypeEnum" + }, + { + "description": "Type of strategy." + } + ] + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the strategy." + }, + "selfTradePrevention": { + "description": "Self trade prevention setting of the strategy's orders.", + "allOf": [ + { + "$ref": "#/components/schemas/SelfTradePrevention" + }, + { + "description": "Self trade prevention setting of the strategy's orders." + } + ] + }, + "status": { + "description": "Status of the strategy.", + "allOf": [ + { + "$ref": "#/components/schemas/StrategyStatus" + }, + { + "description": "Status of the strategy." + } + ] + }, + "side": { + "description": "Side of the strategy.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "Side of the strategy." + } + ] + }, + "symbol": { + "type": "string", + "description": "Market symbol of the strategy." + }, + "timeInForce": { + "description": "Time in force of the strategy.", + "allOf": [ + { + "$ref": "#/components/schemas/TimeInForce" + }, + { + "description": "Time in force of the strategy." + } + ] + }, + "clientStrategyId": { + "type": "integer", + "format": "uint32", + "description": "Custom order strategy ID." + }, + "duration": { + "type": "integer", + "format": "uint64", + "description": "Duration of the strategy in milliseconds." + }, + "interval": { + "type": "integer", + "format": "uint64", + "description": "Interval of the strategy in milliseconds." + }, + "randomizedIntervalQuantity": { + "type": "boolean", + "description": "Determines whether the strategy will execute a randomized interval\nquantity." + }, + "slippageTolerance": { + "type": "string", + "format": "decimal", + "description": "Slippage tolerance allowed for the order." + }, + "slippageToleranceType": { + "description": "Slippage tolerance type", + "allOf": [ + { + "$ref": "#/components/schemas/SlippageToleranceType" + }, + { + "description": "Slippage tolerance type" + } + ] + } + } + }, + "StrategyCancelAllPayload": { + "type": "object", + "title": "StrategyCancelAllPayload", + "required": [ + "symbol" + ], + "properties": { + "symbol": { + "type": "string", + "description": "Market to cancel strategies for." + }, + "strategyType": { + "description": "Type of strategies to cancel.", + "allOf": [ + { + "$ref": "#/components/schemas/StrategyTypeEnum" + }, + { + "description": "Type of strategies to cancel." + } + ] + } + } + }, + "StrategyCancelPayload": { + "type": "object", + "title": "StrategyCancelPayload", + "required": [ + "symbol" + ], + "properties": { + "clientStrategyId": { + "type": "integer", + "format": "uint32", + "description": "Client ID of the strategy." + }, + "strategyId": { + "type": "string", + "description": "ID of the strategy." + }, + "symbol": { + "type": "string", + "description": "Market the strategy exists on." + } + } + }, + "StrategyCrankCancelReason": { + "type": "string", + "enum": [ + "Expired", + "FillOrKill", + "InsufficientBorrowableQuantity", + "InsufficientFunds", + "InsufficientLiquidity", + "InvalidPrice", + "InvalidQuantity", + "InsufficientMargin", + "Liquidation", + "PriceOutOfBounds", + "ReduceOnlyNotReduced", + "SelfTradePrevention", + "Unknown", + "UserPermissions" + ] + }, + "StrategyCreatePayload": { + "type": "object", + "title": "StrategyCreatePayload", + "required": [ + "strategyType", + "side", + "symbol" + ], + "properties": { + "autoLend": { + "type": "boolean", + "description": "If true then the strategy's orders can lend. Spot margin only." + }, + "autoLendRedeem": { + "type": "boolean", + "description": "If true then the strategy's orders can redeem a lend if required. Spot\nmargin only." + }, + "autoBorrow": { + "type": "boolean", + "description": "If true then the strategy's orders can borrow. Spot margin only." + }, + "autoBorrowRepay": { + "type": "boolean", + "description": "If true then the strategy's orders can repay a borrow. Spot margin only." + }, + "brokerId": { + "type": "integer", + "format": "uint16", + "description": "Broker ID of the orders." + }, + "clientStrategyId": { + "type": "integer", + "format": "uint32", + "description": "Custom client strategy id." + }, + "strategyType": { + "description": "Strategy type.", + "allOf": [ + { + "$ref": "#/components/schemas/StrategyTypeEnum" + }, + { + "description": "Strategy type." + } + ] + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "The strategy quantity." + }, + "price": { + "type": "string", + "format": "decimal", + "description": "The strategy limit price." + }, + "postOnly": { + "type": "boolean", + "description": "Only post liquidity, do not take liquidity." + }, + "reduceOnly": { + "type": "boolean", + "description": "If true then the strategy's orders can only reduce the position.\nFutures only." + }, + "selfTradePrevention": { + "description": "Action to take if the user crosses themselves in the order book.", + "allOf": [ + { + "$ref": "#/components/schemas/SelfTradePrevention" + }, + { + "description": "Action to take if the user crosses themselves in the order book." + } + ] + }, + "side": { + "description": "The side of the strategy.", + "allOf": [ + { + "$ref": "#/components/schemas/Side" + }, + { + "description": "The side of the strategy." + } + ] + }, + "symbol": { + "type": "string", + "description": "The market for the strategy." + }, + "timeInForce": { + "description": "How long the strategy's orders are good for.", + "allOf": [ + { + "$ref": "#/components/schemas/TimeInForce" + }, + { + "description": "How long the strategy's orders are good for." + } + ] + }, + "duration": { + "type": "integer", + "format": "uint64", + "description": "Duration of the strategy." + }, + "interval": { + "type": "integer", + "format": "uint64", + "description": "Interval of the strategy." + }, + "randomizedIntervalQuantity": { + "type": "boolean", + "description": "Randomized interval quantity for the strategy." + }, + "slippageTolerance": { + "type": "string", + "format": "decimal", + "description": "Slippage tolerance allowed for the order." + }, + "slippageToleranceType": { + "description": "Slippage tolerance type.", + "allOf": [ + { + "$ref": "#/components/schemas/SlippageToleranceType" + }, + { + "description": "Slippage tolerance type." + } + ] + } + } + }, + "StrategyStatus": { + "type": "string", + "enum": [ + "Running", + "Completed", + "Cancelled", + "Terminated" + ] + }, + "StrategyType": { + "type": "object", + "anyOf": [ + { + "$ref": "#/components/schemas/StrategyType_ScheduledStrategy" + } + ], + "discriminator": { + "propertyName": "strategyType", + "mapping": { + "Scheduled": "#/components/schemas/StrategyType_ScheduledStrategy" + } + } + }, + "StrategyTypeEnum": { + "type": "string", + "enum": [ + "Scheduled" + ] + }, + "StrategyType_ScheduledStrategy": { + "allOf": [ + { + "type": "object", + "required": [ + "strategyType" + ], + "properties": { + "strategyType": { + "type": "string", + "enum": [ + "Scheduled" + ], + "example": "Scheduled" + } + } + }, + { + "$ref": "#/components/schemas/ScheduledStrategy" + } + ] + }, + "SystemOrderType": { + "type": "string", + "enum": [ + "CollateralConversion", + "FutureExpiry", + "LiquidatePositionOnAdl", + "LiquidatePositionOnBook", + "LiquidatePositionOnBackstop", + "OrderBookClosed" + ] + }, + "Ticker": { + "type": "object", + "title": "Ticker", + "required": [ + "symbol", + "firstPrice", + "lastPrice", + "priceChange", + "priceChangePercent", + "high", + "low", + "volume", + "quoteVolume", + "trades" + ], + "properties": { + "symbol": { + "type": "string", + "description": "The symbol of the market." + }, + "firstPrice": { + "type": "string", + "format": "decimal", + "description": "First price for the interval." + }, + "lastPrice": { + "type": "string", + "format": "decimal", + "description": "Last price for the interval." + }, + "priceChange": { + "type": "string", + "format": "decimal", + "description": "Price change for the interval." + }, + "priceChangePercent": { + "type": "string", + "format": "decimal", + "description": "Percentage price change for the interval." + }, + "high": { + "type": "string", + "format": "decimal", + "description": "Highest price for the interval." + }, + "low": { + "type": "string", + "format": "decimal", + "description": "Lowest price for the interval." + }, + "volume": { + "type": "string", + "format": "decimal", + "description": "Base volume for the interval." + }, + "quoteVolume": { + "type": "string", + "format": "decimal", + "description": "Quote volume for the interval." + }, + "trades": { + "type": "string", + "description": "Trades for the interval." + } + } + }, + "TickerInterval": { + "type": "string", + "enum": [ + "1d", + "1w" + ] + }, + "TimeInForce": { + "type": "string", + "enum": [ + "GTC", + "IOC", + "FOK" + ] + }, + "Token": { + "type": "object", + "title": "Token", + "required": [ + "displayName", + "blockchain", + "depositEnabled", + "minimumDeposit", + "withdrawEnabled", + "minimumWithdrawal", + "withdrawalFee" + ], + "properties": { + "displayName": { + "type": "string" + }, + "blockchain": { + "$ref": "#/components/schemas/Blockchain" + }, + "contractAddress": { + "type": "string" + }, + "depositEnabled": { + "type": "boolean" + }, + "minimumDeposit": { + "type": "string", + "format": "decimal" + }, + "withdrawEnabled": { + "type": "boolean" + }, + "minimumWithdrawal": { + "type": "string", + "format": "decimal" + }, + "maximumWithdrawal": { + "type": "string", + "format": "decimal" + }, + "withdrawalFee": { + "type": "string", + "format": "decimal" + } + } + }, + "Trade": { + "type": "object", + "title": "Trade", + "required": [ + "price", + "quantity", + "quoteQuantity", + "timestamp", + "isBuyerMaker" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64", + "description": "Id of the trade." + }, + "price": { + "type": "string", + "format": "decimal", + "description": "Price of the trade." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the trade in the base asset." + }, + "quoteQuantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the trade in the quote asset." + }, + "timestamp": { + "type": "integer", + "format": "int64", + "description": "Timestamp of the trade (server time)." + }, + "isBuyerMaker": { + "type": "boolean", + "description": "Whether the buyer was the maker order." + } + } + }, + "UpdateAccountSettingsRequest": { + "type": "object", + "title": "UpdateAccountSettingsRequest", + "properties": { + "autoBorrowSettlements": { + "type": "boolean", + "description": "If true, then tries to borrow during collateral reconciliation.\nCollateral reconciliation is a process in which the system reconciles\nthe negative account debt or positive account equity." + }, + "autoLend": { + "type": "boolean", + "description": "Determines if the account should automatically lend." + }, + "autoRepayBorrows": { + "type": "boolean", + "description": "Determines if the account should automatically repay borrows with\navailable balance." + }, + "leverageLimit": { + "type": "string", + "format": "decimal", + "description": "Determines the maximum leverage allowed for the main account or\nsubaccount." + } + } + }, + "UpdateWithdrawalDelayRequest": { + "type": "object", + "title": "UpdateWithdrawalDelayRequest", + "required": [ + "withdrawalDelayHours", + "twoFactorToken" + ], + "properties": { + "withdrawalDelayHours": { + "type": "integer", + "format": "uint32", + "description": "The delay applied to withdrawals being processed, in hours." + }, + "twoFactorToken": { + "type": "string", + "description": "Issued two factor token." + } + } + }, + "WalletResponse": { + "type": "object", + "title": "WalletResponse", + "required": [ + "blockchain", + "address" + ], + "properties": { + "blockchain": { + "type": "string", + "description": "The blockchain network." + }, + "address": { + "type": "string", + "description": "The wallet address." + } + } + }, + "Withdrawal": { + "type": "object", + "title": "Withdrawal", + "required": [ + "id", + "blockchain", + "quantity", + "fee", + "symbol", + "status", + "toAddress", + "createdAt", + "isInternal" + ], + "properties": { + "id": { + "type": "integer", + "format": "int32", + "description": "Unique id of the withdrawal." + }, + "blockchain": { + "description": "Blockchain the withdrawal was requested for.", + "allOf": [ + { + "$ref": "#/components/schemas/Blockchain" + }, + { + "description": "Blockchain the withdrawal was requested for." + } + ] + }, + "clientId": { + "type": "string", + "description": "Custom client id." + }, + "identifier": { + "type": "string", + "description": "Transaction hash of the withdrawal, if it has been sent." + }, + "quantity": { + "type": "string", + "format": "decimal", + "description": "Quantity of the asset to withdraw." + }, + "fee": { + "type": "string", + "format": "decimal", + "description": "Fee charged." + }, + "fiatFee": { + "type": "string", + "format": "decimal", + "description": "Fiat fee charged." + }, + "fiatState": { + "description": "Fiat state for Equals Money.", + "allOf": [ + { + "$ref": "#/components/schemas/EqualsMoneyWithdrawalState" + }, + { + "description": "Fiat state for Equals Money." + } + ] + }, + "fiatSymbol": { + "description": "Fiat symbol.", + "allOf": [ + { + "$ref": "#/components/schemas/FiatAsset" + }, + { + "description": "Fiat symbol." + } + ] + }, + "providerId": { + "type": "string", + "description": "Provider ID for payment provider." + }, + "symbol": { + "description": "Symbol of the asset to withdraw.", + "allOf": [ + { + "$ref": "#/components/schemas/Asset" + }, + { + "description": "Symbol of the asset to withdraw." + } + ] + }, + "status": { + "description": "Status of the withdrawal.", + "allOf": [ + { + "$ref": "#/components/schemas/WithdrawalStatus" + }, + { + "description": "Status of the withdrawal." + } + ] + }, + "subaccountId": { + "type": "integer", + "format": "uint16", + "description": "ID of the subaccount requesting this withdrawal." + }, + "toAddress": { + "type": "string", + "description": "Address to withdraw to." + }, + "transactionHash": { + "type": "string", + "description": "Transaction hash of withdrawal." + }, + "createdAt": { + "type": "string", + "format": "naive-date-time", + "description": "When the withdrawal was created." + }, + "isInternal": { + "type": "boolean", + "description": "Whether the withdrawal is an internal transfer." + }, + "bankName": { + "type": "string", + "description": "Bank name." + }, + "bankIdentifier": { + "type": "string", + "description": "Bank identifier." + }, + "accountIdentifier": { + "type": "string", + "description": "Account identifier." + }, + "triggerAt": { + "type": "string", + "format": "naive-date-time", + "description": "When the withdrawal is to be triggered." + } + } + }, + "WithdrawalDelay": { + "type": "object", + "title": "WithdrawalDelay", + "properties": { + "currentWithdrawalDelayHours": { + "type": "integer", + "format": "int32", + "description": "The delay applied to withdrawals being processed." + }, + "pendingWithdrawalDelayHours": { + "type": "integer", + "format": "int32", + "description": "The delay that will be applied to withdrawals once the update to the\nsetting is enabled." + }, + "pendingWithdrawalDelayHoursEnabledAt": { + "type": "string", + "format": "naive-date-time", + "description": "The time when the update to the withdrawal delay setting will be\napplied." + } + } + }, + "WithdrawalStatus": { + "type": "string", + "enum": [ + "confirmed", + "ownershipVerificationRequired", + "pending", + "recipientInformationProvided", + "recipientInformationRequired" + ] + } + } + }, + "x-tagGroups": [ + { + "name": "Public Endpoints", + "tags": [ + "Assets", + "Borrow Lend Markets", + "Markets", + "System", + "Trades" + ] + }, + { + "name": "Authenticated Endpoints", + "tags": [ + "Account", + "Borrow Lend", + "Capital", + "Futures", + "History", + "Order", + "Request For Quote" + ] + }, + { + "name": "Websocket", + "tags": [ + "Streams" + ] + } + ] +} \ No newline at end of file diff --git a/docs/ccxt/examples/ccxt.pro/html/watchTicker.html b/docs/ccxt/examples/ccxt.pro/html/watchTicker.html new file mode 100644 index 0000000..147e483 --- /dev/null +++ b/docs/ccxt/examples/ccxt.pro/html/watchTicker.html @@ -0,0 +1,51 @@ + + + + CCXT Basic example for the browser + + + + +

Hello, CCXT!

+

This example uses websockets to watch changes in price of ETH/BTC

+

+
+
diff --git a/docs/ccxt/examples/ccxt.pro/js/apex-watch.js b/docs/ccxt/examples/ccxt.pro/js/apex-watch.js
new file mode 100644
index 0000000..795779b
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/apex-watch.js
@@ -0,0 +1,74 @@
+'use strict';
+
+import ccxt from '../../../js/ccxt.js';
+
+// your version must be 0.7+
+console.log ('CCXT Version:', ccxt.version)
+
+function handle (exchange, symbol, ticker) {
+    console.log (new Date (), exchange.id, symbol, ticker)
+}
+
+async function loop (exchange, symbol) {
+    while (true) {
+        try {
+            const ticker = await exchange.watchMyTrades ()
+            handle (exchange, symbol, ticker)
+            sleep( 10000 )
+        } catch (e) {
+            console.log (symbol, e)
+            // do nothing and retry on next loop iteration
+            // throw e // uncomment to break all loops in case of an error in any one of them
+            // break // you can also break just this one loop if it fails
+        }
+    }
+}
+
+async function main () {
+
+     const exchange = new ccxt.pro.apex ({
+         'apiKey': 'your api Key',
+         'secret': 'your api secret',
+         'walletAddress': 'your eth address',
+         'options': {
+             'accountId': 'your account id',
+             'passphrase': 'your api passphrase',
+             'seeds': 'your zklink omni seed',
+             'brokerId': '',
+         },
+     }) // usd(s)-margined contracts
+    exchange.setSandboxMode(true)
+    //
+    // or
+    //
+    //  const exchange = new ccxt.pro.binance () // spot markets
+    //
+    // WARNING: when using the spot markets mind subscription limits!
+    // don't attempt to subscribe to all of them
+    // the exchanges will not allow that in general
+    // instead, specify a shorter list of symbols to subscribe to
+    //
+    // or
+    //
+    //  const exchange = new ccxt.pro.binancecoinm () // coin-margined contracts
+
+    if (exchange.has['watchTicker']) {
+        await exchange.loadMarkets ()
+        // many symbols
+        //await Promise.all (exchange.symbols.map (symbol => loop (exchange, symbol)))
+        //
+        // or
+        //
+        // const symbols = [ 'BTC/USDT', 'ETH/USDT' ] // specific symbols
+        // await Promise.all (symbols.map (symbol => loop (exchange, symbol)))
+        //
+        // or
+        //
+        await loop (exchange, ['BTC-USDT','ETH-USDT']) // one symbol
+
+    } else {
+        console.log (exchange.id, 'does not support watchTicker yet')
+    }
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/binance-fetch-balance-snapshot-watch-balance-updates.js b/docs/ccxt/examples/ccxt.pro/js/binance-fetch-balance-snapshot-watch-balance-updates.js
new file mode 100644
index 0000000..7768f19
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/binance-fetch-balance-snapshot-watch-balance-updates.js
@@ -0,0 +1,55 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt')
+
+console.log ('CCXT Version:', ccxt.version)
+
+// This example will run silent and will return your balance only when the balance is updated.
+//
+// 1. launch the example with your keys and keep it running
+// 2. go to the trading section on the website
+// 3. place a order on a spot market
+// 4. see your balance updated in the example
+//
+// Warning! This example might produce a lot of output to your screen
+
+
+async function watchBalance (exchange) {
+    let balance = await exchange.fetchBalance ()
+    console.log ('---------------------------------------------------------')
+    console.log (exchange.iso8601 (exchange.milliseconds ()))
+    console.log (balance, '\n')
+    while (true) {
+        try {
+            const update = await exchange.watchBalance ()
+            balance = exchange.deep_extend (balance, update)
+            // it will print the balance update when the balance changes
+            // if the balance remains unchanged the exchange will not send it
+            console.log ('---------------------------------------------------------')
+            console.log (exchange.iso8601 (exchange.milliseconds ()))
+            console.log (balance, '\n')
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+            break
+        }
+    }
+}
+
+
+async function main() {
+
+     const exchange = new ccxt.pro.binance ({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    })
+
+    await exchange.loadMarkets ()
+
+    // exchange.verbose = true // uncomment for debugging purposes if necessary
+
+    await watchBalance (exchange)
+
+    await exchange.close ()
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/binance-https-proxy.js b/docs/ccxt/examples/ccxt.pro/js/binance-https-proxy.js
new file mode 100644
index 0000000..67b8017
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/binance-https-proxy.js
@@ -0,0 +1,48 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt')
+
+console.log ('CCXT Version:', ccxt.version)
+
+let HttpsProxyAgent = undefined
+
+try {
+    HttpsProxyAgent = require ('https-proxy-agent')
+} catch (e) {
+    console.log (e.constructor.name, e.message)
+    console.log ("\nCould not load the HTTPS proxy agent")
+    console.log ("\nPlease, run this command to make sure it's properly installed:")
+    console.log ("\nnpm install https-proxy-agent\n")
+    process.exit ()
+}
+
+async function main () {
+
+    console.log ('Using proxy server', httpsProxyUrl);
+
+    // adjust for your HTTPS proxy URL
+    const httpsProxyUrl = process.env.https_proxy || 'https://username:password@your-proxy.com'
+        , httpsAgent = new HttpsProxyAgent (httpsProxyUrl)
+        , exchange = new ccxt.binance ({
+            httpsAgent: httpsAgent, // ←--------------------- httpsAgent here
+            options: {
+                'ws': {
+                    'options': { agent: httpsAgent }, // ←--- httpsAgent here
+                },
+            },
+        })
+
+    const symbol = 'BTC/USDT'
+    await exchange.loadMarkets ()
+    console.log ('Markets loaded')
+    while (true) {
+        try {
+            const orderbook = await exchange.watchOrderBook (symbol)
+            console.log (exchange.iso8601 (exchange.milliseconds()), symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols-continuously.js b/docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols-continuously.js
new file mode 100644
index 0000000..fd7c1fe
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols-continuously.js
@@ -0,0 +1,38 @@
+"use strict";
+
+const ccxt = require ('ccxt')
+
+const ohlcvsBySymbol = {}
+
+function handleAllOHLCVs (exchange, ohlcvs, symbol, timeframe) {
+    const now = exchange.iso8601 (exchange.milliseconds ())
+    const lastCandle = exchange.safeValue (ohlcvs, ohlcvs.length - 1)
+    const datetime = exchange.iso8601 (lastCandle[0])
+    console.log (now, datetime, symbol, timeframe, lastCandle.slice (1))
+}
+
+async function pollOHLCV (exchange, symbol, timeframe) {
+    await exchange.throttle (1000) // 1000ms delay between subscriptions
+    while (true) {
+        try {
+            const response = await exchange.watchOHLCV (symbol, timeframe)
+            ohlcvsBySymbol[symbol] = response
+            handleAllOHLCVs(exchange, response, symbol, timeframe)
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+}
+
+async function main () {
+
+     const exchange = new ccxt.pro.binance()
+    const markets = await exchange.loadMarkets ()
+    const timeframe = '5m'
+
+    const firstOneHundredSymbols = exchange.symbols.slice (0, 100)
+
+    await Promise.all (firstOneHundredSymbols.map (symbol => pollOHLCV (exchange, symbol, timeframe)))
+}
+
+main ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols.js b/docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols.js
new file mode 100644
index 0000000..88aee6a
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols.js
@@ -0,0 +1,64 @@
+'use strict';
+
+const ccxt = require ('ccxt');
+
+// your version must be 0.7+
+console.log ('CCXT Version:', ccxt.version)
+
+function handle (exchange, symbol, timeframe, candles) {
+    const lastCandle = candles[candles.length - 1]
+    const lastClosingPrice = lastCandle[4]
+    console.log (new Date (), exchange.id, timeframe, symbol, '\t', lastClosingPrice)
+}
+
+async function loop (exchange, symbol, timeframe) {
+    while (true) {
+        try {
+            const candles = await exchange.watchOHLCV (symbol, timeframe)
+            handle (exchange, symbol, timeframe, candles)
+        } catch (e) {
+            console.log (symbol, e)
+            // do nothing and retry on next loop iteration
+            // throw e // uncomment to break all loops in case of an error in any one of them
+            // break // you can also break just this one loop if it fails
+        }
+    }
+}
+
+async function main () {
+
+     const exchange = new ccxt.pro.binanceusdm () // usd(s)-margined contracts
+    //
+    // or
+    //
+    //  const exchange = new ccxt.pro.binance () // spot markets
+    //
+    // WARNING: when using the spot markets mind subscription limits!
+    // don't attempt to subscribe to all of them
+    // the exchanges will not allow that in general
+    // instead, specify a shorter list of symbols to subscribe to
+    //
+    // or
+    //
+    //  const exchange = new ccxt.pro.binancecoinm () // coin-margined contracts
+
+    if (exchange.has['watchOHLCV']) {
+        await exchange.loadMarkets ()
+        const timeframe = '15m'
+        // many symbols
+        await Promise.all (exchange.symbols.map (symbol => loop (exchange, symbol, timeframe)))
+        //
+        // or
+        //
+        // const symbols = [ 'BTC/USDT', 'ETH/USDT' ] // specific symbols
+        // await Promise.all (symbols.map (symbol => loop (exchange, symbol, timeframe)))
+        //
+        // or
+        //
+        // await loop (exchange, 'BTC/USDT', timeframe) // one symbol
+    } else {
+        console.log (exchange.id, 'does not support watchOHLCV yet')
+    }
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/binance-watch-ticker-many-symbols.js b/docs/ccxt/examples/ccxt.pro/js/binance-watch-ticker-many-symbols.js
new file mode 100644
index 0000000..a817e2c
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/binance-watch-ticker-many-symbols.js
@@ -0,0 +1,62 @@
+'use strict';
+
+const ccxt = require ('ccxt');
+
+// your version must be 0.7+
+console.log ('CCXT Version:', ccxt.version)
+
+function handle (exchange, symbol, ticker) {
+    console.log (new Date (), exchange.id, symbol, ticker['last'])
+}
+
+async function loop (exchange, symbol) {
+    while (true) {
+        try {
+            const ticker = await exchange.watchTicker (symbol)
+            handle (exchange, symbol, ticker)
+        } catch (e) {
+            console.log (symbol, e)
+            // do nothing and retry on next loop iteration
+            // throw e // uncomment to break all loops in case of an error in any one of them
+            // break // you can also break just this one loop if it fails
+        }
+    }
+}
+
+async function main () {
+
+     const exchange = new ccxt.pro.binanceusdm () // usd(s)-margined contracts
+    //
+    // or
+    //
+    //  const exchange = new ccxt.pro.binance () // spot markets
+    //
+    // WARNING: when using the spot markets mind subscription limits!
+    // don't attempt to subscribe to all of them
+    // the exchanges will not allow that in general
+    // instead, specify a shorter list of symbols to subscribe to
+    //
+    // or
+    //
+    //  const exchange = new ccxt.pro.binancecoinm () // coin-margined contracts
+
+    if (exchange.has['watchTicker']) {
+        await exchange.loadMarkets ()
+        // many symbols
+        await Promise.all (exchange.symbols.map (symbol => loop (exchange, symbol)))
+        //
+        // or
+        //
+        // const symbols = [ 'BTC/USDT', 'ETH/USDT' ] // specific symbols
+        // await Promise.all (symbols.map (symbol => loop (exchange, symbol)))
+        //
+        // or
+        //
+        // await loop (exchange, 'BTC/USDT') // one symbol
+
+    } else {
+        console.log (exchange.id, 'does not support watchTicker yet')
+    }
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/build-ohlcv-many-symbols.js b/docs/ccxt/examples/ccxt.pro/js/build-ohlcv-many-symbols.js
new file mode 100644
index 0000000..733d6ef
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/build-ohlcv-many-symbols.js
@@ -0,0 +1,68 @@
+'use strict';
+
+const ccxt = require ('ccxt');
+const asTable  = require ('as-table').configure ({ delimiter: ' | ' })
+
+console.log ('CCXT Version:', ccxt.version)
+
+
+async function loop (exchange, symbol, timeframe, completeCandlesOnly = false) {
+    const durationInSeconds = exchange.parseTimeframe (timeframe)
+    const durationInMs = durationInSeconds * 1000
+    while (true) {
+        try {
+            const trades = await exchange.watchTrades (symbol)
+            if (trades.length > 0) {
+                const currentMinute = parseInt (exchange.milliseconds () / durationInMs)
+                let ohlcvc = exchange.buildOHLCVC (trades, timeframe)
+                if (completeCandlesOnly) {
+                    ohlcvc = ohlcvc.filter (candle => parseInt (candle[0] / durationInMs) < currentMinute)
+                }
+                if (ohlcvc.length > 0) {
+                    console.log("Symbol:", symbol, "timeframe:", timeframe);
+                    console.log ('-----------------------------------------------------------')
+                    console.log (asTable (ohlcvc))
+                    console.log ('-----------------------------------------------------------')
+                }
+            }
+        } catch (e) {
+            console.log (symbol, e)
+            // do nothing and retry on next loop iteration
+            // throw e // uncomment to break all loops in case of an error in any one of them
+            // break // you can also break just this one loop if it fails
+        }
+    }
+}
+
+async function main () {
+    // select the exchange
+     const exchange = new ccxt.pro.ftx ()
+
+    if (exchange.has['watchTrades']) {
+        await exchange.loadMarkets ()
+        // Change this value accordingly
+        const timeframe = '1m'
+
+        const allSymbols = exchange.symbols;
+
+        // arbitrary n symbols
+        const limit = 5;
+        // const selectedSymbols = allSymbols.slice(0, limit);
+        // you can also specify the symbols manually
+        // example:
+        // const selectedSymbols = ['BTC/USDT', 'LTC/USDT']
+
+        console.log(selectedSymbols);
+
+        // Use this variable to choose if only complete candles 
+        // should be considered
+        const completeCandlesOnly = true
+
+        await Promise.all (selectedSymbols.map (symbol => loop (exchange, symbol, timeframe, completeCandlesOnly)))
+
+    } else {
+        console.log (exchange.id, 'does not support watchTrades yet')
+    }
+}
+
+main ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades-warmup.js b/docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades-warmup.js
new file mode 100644
index 0000000..92040c3
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades-warmup.js
@@ -0,0 +1,82 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+console.log ('CCXT Version:', ccxt.version)
+
+let ohlcvs = {}
+
+async function log (exchange, symbol, timeframe) {
+    const market = exchange.market (symbol)
+    const duration = exchange.parseTimeframe (timeframe) * 1000
+    console.log (exchange.iso8601 (exchange.milliseconds ()), 'Warming up, waiting for at least one trade...')
+    while (!Object.keys (ohlcvs).length) {
+        await exchange.throttle (1)
+    }
+    let now = exchange.milliseconds ()
+    const start = (parseInt (now / duration) + 1) * duration
+    console.log (exchange.iso8601 (exchange.milliseconds ()), 'Trades started arriving, waiting till', exchange.iso8601 (start))
+    await exchange.sleep (start - now)
+    console.log (exchange.iso8601 (exchange.milliseconds ()), 'Done warming up')
+    for (let i = 0;; i++) {
+        now = exchange.milliseconds ()
+        let candle = Object.values (ohlcvs)[0]
+        console.log ('')
+        console.log (exchange.iso8601 (now), '------------------------------------------------------')
+        console.log ('Datetime                ', 'Timestamp    ', ... [ 'Open', 'High', 'Low', 'Close', market['base'], market['quote'] ].map (x => x.toString ().padEnd (10, ' ')))
+        for (let j = start; j < now; j += duration) {
+            if (!(j in ohlcvs)) {
+                ohlcvs[j] = [ j, candle[4], candle[4], candle[4], candle[4], 0, 0 ]
+            }
+            candle = exchange.safeValue (ohlcvs, j);
+            console.log (exchange.iso8601 (j), ... candle.map (x => x.toString ().padEnd (10, ' ')))
+        }
+        ohlcvs = exchange.indexBy (Object.values (ohlcvs).slice (-1000), 0)
+        await exchange.sleep(1000)
+    }
+}
+
+async function watch (exchange, symbol, timeframe) {
+    console.log ('Starting', exchange.id, symbol)
+    const duration = exchange.parseTimeframe (timeframe) * 1000
+    while (true) {
+        try {
+            const trades = await exchange.watchTrades(symbol)
+            for (const trade of trades) {
+                const timestamp = parseInt(trade['timestamp'] / duration) * duration
+                let candle = exchange.safe_value(ohlcvs, timestamp)
+                if (candle) {
+                    candle[2] = Math.max(trade['price'], candle[2])
+                    candle[3] = Math.min(trade['price'], candle[3])
+                    candle[4] = trade['price']
+                    candle[5] = exchange.parseNumber(exchange.amountToPrecision(symbol, trade['amount'] + candle[5]))
+                    candle[6] = exchange.parseNumber(exchange.costToPrecision(symbol, trade['cost'] + candle[6]))
+                } else {
+                    candle = [
+                        timestamp,
+                        trade['price'],
+                        trade['price'],
+                        trade['price'],
+                        trade['price'],
+                        exchange.parseNumber(exchange.amountToPrecision(symbol, trade['amount'])),
+                        exchange.parseNumber(exchange.costToPrecision(symbol, trade['cost'])),
+                    ]
+                }
+                ohlcvs[timestamp] = candle
+            }
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+}
+
+async function main() {
+    const symbol = 'BTC/USDT'
+     const exchange = new ccxt.pro.binance ({ 'newUpdates': true })
+    await exchange.loadMarkets ()
+    const timeframe = '1m'
+    await Promise.all ([ watch (exchange, symbol, timeframe), log (exchange, symbol, timeframe) ])
+    await exchange.close ()
+}
+
+main()
diff --git a/docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades.js b/docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades.js
new file mode 100644
index 0000000..79afddb
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/calculate-ohlcvs-from-trades.js
@@ -0,0 +1,59 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+console.log ('CCXT Version:', ccxt.version)
+
+
+async function main() {
+    let ohlcvs = {}
+    const symbol = 'BTC/USDT'
+     const exchange = new ccxt.pro.binance ({ 'newUpdates': true })
+    await exchange.loadMarkets ()
+    const market = exchange.market (symbol)
+    const timeframe = '1m'
+    const duration = exchange.parseTimeframe (timeframe) * 1000
+    console.log ('Starting', exchange.id, symbol)
+    while (true) {
+        try {
+            const trades = await exchange.watchTrades(symbol)
+            for (const trade of trades) {
+                const timestamp = parseInt(trade['timestamp'] / duration) * duration
+                let candle = exchange.safe_value(ohlcvs, timestamp)
+                if (candle) {
+                    candle[2] = Math.max(trade['price'], candle[2])
+                    candle[3] = Math.min(trade['price'], candle[3])
+                    candle[4] = trade['price']
+                    candle[5] = exchange.parseNumber(exchange.amountToPrecision(symbol, trade['amount'] + candle[5]))
+                    candle[6] = exchange.parseNumber(exchange.costToPrecision(symbol, trade['cost'] + candle[6]))
+                } else {
+                    candle = [
+                        timestamp,
+                        trade['price'],
+                        trade['price'],
+                        trade['price'],
+                        trade['price'],
+                        exchange.parseNumber(exchange.amountToPrecision(symbol, trade['amount'])),
+                        exchange.parseNumber(exchange.costToPrecision(symbol, trade['cost'])),
+                    ]
+                }
+                ohlcvs[timestamp] = candle
+            }
+            console.log ('')
+            console.log (exchange.iso8601 (exchange.milliseconds ()), '------------------------------------------------------')
+            const values = Object.values (ohlcvs).slice (-1000)
+            ohlcvs = exchange.indexBy (values, 0)
+            console.log ('Datetime                ', 'Timestamp    ', ... [ 'Open', 'High', 'Low', 'Close', market['base'], market['quote'] ].map (x => x.toString ().padEnd (10, ' ')))
+            for (let i = 0; i < values.length; i++) {
+                const candle = values[i]
+                console.log (exchange.iso8601 (candle[0]), ... candle.map (x => x.toString ().padEnd (10, ' ')))
+            }
+
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+    await exchange.close ()
+}
+
+main()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/exchange-capabitities.js b/docs/ccxt/examples/ccxt.pro/js/exchange-capabitities.js
new file mode 100644
index 0000000..a6ada5e
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/exchange-capabitities.js
@@ -0,0 +1,72 @@
+"use strict";
+
+/*  ------------------------------------------------------------------------ */
+
+const ccxt        = require ('../../../ccxt.js').pro
+    , asTable     = require ('as-table') // .configure ({ print: require ('string.ify').noPretty })
+    , log         = require ('ololog').noLocate
+    , ansi        = require ('ansicolor').nice
+
+;(async function test () {
+
+    let total = 0
+    let missing = 0
+    let implemented = 0
+    let emulated = 0
+
+    const exchanges = ccxt.exchanges
+        .map (id => new ccxt[id]())
+        .filter (exchange => exchange.has.ws)
+
+    log (
+        asTable (
+            exchanges
+                .map (exchange => {
+
+                    let result = {};
+
+                    [
+                        'ws',
+                        'watchOrderBook',
+                        'watchTicker',
+                        'watchTrades',
+                        'watchOHLCV',
+                        'watchBalance',
+                        'watchOrders',
+                        'watchMyTrades',
+
+                    ].forEach (key => {
+
+                        total += 1
+
+                        let capability = (key in exchange.has) ?
+                            exchange.has[key].toString () :
+                            'undefined'
+
+                        if (!exchange.has[key]) {
+                            capability = exchange.id.red.dim
+                            missing += 1
+                        } else if (exchange.has[key] === 'emulated') {
+                            capability = exchange.id.yellow
+                            emulated += 1
+                        } else {
+                            capability = exchange.id.green
+                            implemented += 1
+                        }
+
+                        result[key] = capability
+                    })
+
+                    return result
+                })
+        )
+    )
+
+    log ('Summary:',
+        exchanges.length.toString ().green, 'exchanges,',
+        implemented.toString ().green, 'methods implemented,',
+        emulated.toString ().yellow, 'emulated,',
+        missing.toString ().red, 'missing,',
+        total.toString (), 'total')
+
+}) ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/exchange-close.js b/docs/ccxt/examples/ccxt.pro/js/exchange-close.js
new file mode 100644
index 0000000..783ae39
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/exchange-close.js
@@ -0,0 +1,46 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt')
+
+console.log ("CCXT Pro Version:", ccxt.version)
+
+const orderbooks = {}
+
+let run = true
+
+async function watchOrderBook (exchange, symbol) {
+    while (run) {
+        try {
+            const orderbook = await exchange.watchOrderBook (symbol)
+            orderbooks[symbol] = orderbook
+            console.log (exchange.iso8601 (exchange.milliseconds ()), orderbook['datetime'], orderbook['nonce'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+}
+
+
+async function stop (exchange) {
+    await exchange.sleep (10000)
+    run = false
+    await exchange.close ()
+}
+
+
+async function main () {
+     const exchange = new ccxt.pro.binance ()
+    await exchange.loadMarkets ()
+    exchange.verbose = true
+    const symbols = [
+        'BTC/USDT',
+        'ETH/USDT',
+    ]
+    stop (exchange).then (() => {})
+    await Promise.all (symbols.map (symbol => watchOrderBook (exchange, symbol)))
+    console.log ('Sleeping for a moment...')
+    await exchange.sleep (10000)
+    console.log ('Done')
+}
+
+main ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/gateio-swap-watch-many-orderbooks.js b/docs/ccxt/examples/ccxt.pro/js/gateio-swap-watch-many-orderbooks.js
new file mode 100644
index 0000000..ad9cf2d
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/gateio-swap-watch-many-orderbooks.js
@@ -0,0 +1,30 @@
+'use strict';
+
+const ccxt = require ('ccxt')
+
+console.log ("CCXT Pro Version:", ccxt.version)
+
+async function loop (exchange, method, symbol) {
+    while (true) {
+        try {
+            const orderbook = await exchange[method] (symbol)
+            console.log (exchange.iso8601 (exchange.milliseconds ()), orderbook['datetime'], orderbook['nonce'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+}
+
+async function main () {
+     const exchange = new ccxt.pro.gateio ({
+        'options': {'defaultType':'swap'}
+    })
+    await exchange.loadMarkets ()
+    // exchange.verbose = true // uncomment for debugging purposes if necessary
+    const symbols = [
+        'ANC/USDT:USDT',
+    ]
+    await Promise.all (symbols.map (symbol => loop (exchange, 'fetchOrderBook', symbol)))
+}
+
+main ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/gateio-watch-balance.js b/docs/ccxt/examples/ccxt.pro/js/gateio-watch-balance.js
new file mode 100644
index 0000000..a0945cb
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/gateio-watch-balance.js
@@ -0,0 +1,23 @@
+const ccxt = require ('../../../ccxt')
+
+console.log ('CCXT Pro version:', ccxt.version)
+
+async function main () {
+     const exchange = new ccxt.pro.gateio ({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    })
+    await exchange.loadMarkets ()
+    exchange.verbose = true
+    while (true) {
+        try {
+            const response = await exchange.watchBalance ()
+            console.log (new Date (), response)
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+            await exchange.sleep (1000)
+        }
+    }
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/gateio-watch-order-book.js b/docs/ccxt/examples/ccxt.pro/js/gateio-watch-order-book.js
new file mode 100644
index 0000000..8ad5706
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/gateio-watch-order-book.js
@@ -0,0 +1,71 @@
+'use strict';
+
+const ccxt = require ('ccxt')
+
+console.log ("CCXT Pro Version:", ccxt.version)
+
+const orderbooks = {}
+
+async function watchAllSymbols (exchange, symbols) {
+    while (true) {
+        const keys = Object.keys (orderbooks);
+        if (symbols.length === keys.length) {
+            console.log ('\n\n\n\n\n')
+            console.log ('----------------------------------------------------')
+            console.log ('All orderbooks received at least one update:');
+            for (let i = 0; i < symbols.length; i++) {
+                const symbol = symbols[i]
+                const orderbook = orderbooks[symbol]
+                console.log (exchange.iso8601 (exchange.milliseconds ()), orderbook['datetime'], orderbook['nonce'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+            }
+            console.log ('----------------------------------------------------')
+            console.log ('\n\n\n\n\n')
+            // process.exit () // stop here if you want
+            break
+        } else {
+            await exchange.sleep (1000);
+        }
+    }
+}
+
+async function watchOrderBook (exchange, symbol) {
+    while (true) {
+        try {
+            const orderbook = await exchange.watchOrderBook (symbol)
+            orderbooks[symbol] = orderbook
+            console.log (exchange.iso8601 (exchange.milliseconds ()), orderbook['datetime'], orderbook['nonce'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+}
+
+async function main () {
+     const exchange = new ccxt.pro.gateio ({
+        'options': {
+            'defaultType': 'swap',
+        },
+    })
+    await exchange.loadMarkets ()
+    // exchange.verbose = true // uncomment for debugging purposes if necessary
+    const symbols = [
+        // 'SOS/USDT:USDT',
+        // 'JASMY/USDT:USDT',
+        // 'SLP/USDT:USDT',
+        'ACH/USDT:USDT',
+        'MKISHU/USDT:USDT',
+        // 'GMT/USDT:USDT',
+        // 'ASTR/USDT:USDT',
+        'RAMP/USDT:USDT',
+        'RSR/USDT:USDT',
+        // 'RACA/USDT:USDT',
+        // 'ROOK/USDT:USDT',
+        // 'ROSE/USDT:USDT',
+    ]
+    await Promise.all ([
+        watchAllSymbols (exchange, symbols),
+        ... symbols.map (symbol => watchOrderBook (exchange, symbol))
+    ])
+}
+
+main ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/graceful-shutdown.js b/docs/ccxt/examples/ccxt.pro/js/graceful-shutdown.js
new file mode 100644
index 0000000..59bac0c
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/graceful-shutdown.js
@@ -0,0 +1,43 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+let stop = false
+
+async function shutdown (milliseconds) {
+    await ccxt.sleep (10000)
+    stop = true
+}
+
+async function watchOrderBook (exchangeId, symbol) {
+
+     const exchange = new ccxt.pro[exchangeId] ()
+    await exchange.loadMarkets ()
+    // exchange.verbose = true
+    while (!stop) {
+        try {
+            const orderbook = await exchange.watchOrderBook (symbol)
+            console.log (new Date (), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (symbol, e)
+            stop = true
+            break
+        }
+    }
+    await exchange.close ()
+}
+
+async function main () {
+    const streams = {
+        'binance': 'BTC/USDT',
+        'ftx': 'BTC/USDT',
+    };
+
+    await Promise.all ([
+        shutdown (10000),
+        ... Object.entries (streams).map (([ exchangeId, symbol ]) => watchOrderBook (exchangeId, symbol))
+    ])
+
+}
+
+main()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/many-exchanges-many-streams.js b/docs/ccxt/examples/ccxt.pro/js/many-exchanges-many-streams.js
new file mode 100644
index 0000000..5ef3cf8
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/many-exchanges-many-streams.js
@@ -0,0 +1,37 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+(async () => {
+
+    const streams = {
+        'binance': 'BTC/USDT',
+        'bittrex': 'BTC/USDT',
+        'poloniex': 'BTC/USDT',
+        'bitfinex': 'BTC/USDT',
+        'hitbtc': 'BTC/USDT',
+        'upbit': 'BTC/USDT',
+        'coinbasepro': 'BTC/USD',
+        'ftx': 'BTC/USDT',
+        'okex': 'BTC/USDT',
+        'gateio': 'BTC/USDT',
+    };
+
+    await Promise.all (Object.keys (streams).map (exchangeId =>
+
+        (async () => {
+
+             const exchange = new ccxt.pro[exchangeId] ({ enableRateLimit: true })
+            const symbol = streams[exchangeId]
+            while (true) {
+                try {
+                    const orderbook = await exchange.watchOrderBook (symbol)
+                    console.log (new Date (), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+                } catch (e) {
+                    console.log (symbol, e)
+                }
+            }
+
+        }) ())
+    )
+}) ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/okex-create-futures-order.js b/docs/ccxt/examples/ccxt.pro/js/okex-create-futures-order.js
new file mode 100644
index 0000000..2b9e233
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/okex-create-futures-order.js
@@ -0,0 +1,48 @@
+'use strict';
+
+const ccxt = require ('ccxt')
+    , exchange = new ccxt.okex ({
+        apiKey: 'YOUR_API_KEY',
+        secret: 'YOUR_API_SECRET',
+        password: 'YOUR_API_PASSWORD',
+        enableRateLimit: true,
+        options: { defaultType: 'futures' },
+    })
+    , symbol = 'BTC/USDT:USDT-201225'
+    , amount = 1 // how may contracts
+    , price = undefined // or your limit price
+    , side = 'buy' // or 'sell'
+    , type = '1' // 1 open long, 2 open short, 3 close long, 4 close short for futures
+    , order_type = '4' // 0 = limit order, 4 = market order
+
+console.log ('CCXT Pro Version: ', ccxt.version)
+
+async function main () {
+
+    try {
+
+        await exchange.loadMarkets ()
+
+        // exchange.verbose = true // uncomment for debugging
+        // open long market price order
+        const order = await exchange.createOrder(symbol, 'market', side, amount, price, { type });
+        // --------------------------------------------------------------------
+        // open long market price order
+        // const order = await exchange.createOrder(symbol, type, side, amount, price, { order_type });
+        // --------------------------------------------------------------------
+        // close short market price order
+        // const order = await exchange.createOrder(symbol, 'market', side, amount, price, { type, order_type });
+        // --------------------------------------------------------------------
+        // close short market price order
+        // const order = await exchange.createOrder(symbol, '4', side, amount, price, { order_type });
+        // ...
+
+        console.log (order)
+
+    } catch (e) {
+
+        console.log (e.constructor.name, e.message)
+    }
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/okex-watch-balance-and-create-order.js b/docs/ccxt/examples/ccxt.pro/js/okex-watch-balance-and-create-order.js
new file mode 100644
index 0000000..8247e54
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/okex-watch-balance-and-create-order.js
@@ -0,0 +1,54 @@
+const ccxt = require ('ccxt')
+
+console.log ('Node.js:', process.version)
+console.log ('CCXT Pro v' + ccxt.version)
+
+ const exchange = new ccxt.pro.okex ({
+    'apiKey': 'YOUR_API_KEY',
+    'secret': 'YOUR_API_SECRET',
+    'password': 'YOUR_API_PASWORD'
+})
+
+async function watchBalance (code) {
+
+    while (true) {
+        const balance = await exchange.watchBalance ({
+            'code': code,
+        })
+        console.log ('New', code, 'balance is: ', balance[code])
+    }
+}
+
+async function createOrder (symbol, type, side, amount, price = undefined, params = {}) {
+
+    console.log ('Creating', symbol, type, 'order')
+    const order = await exchange.createOrder (symbol, type, side, amount, price, params);
+    console.log (symbol, type, side, 'order created')
+    console.log (order)
+}
+
+;(async () => {
+
+    await exchange.loadMarkets ()
+    console.log (exchange.id, 'markets loaded')
+
+    const symbol = 'ETH/USDT'
+    const market = exchange.market (symbol)
+    const quote = market['quote']
+
+    // run in parallel without await
+    console.log ('Watching', quote, 'balance')
+    watchBalance (quote)
+
+    // wait a bit to allow it to subscribe
+    await exchange.sleep (3000)
+
+    const ticker = await exchange.watchTicker (symbol)
+    const type = 'market'
+    const side = 'buy'
+    const amount = 0.1
+    const price = ticker['bid']
+
+    await createOrder (symbol, type, side, amount, price)
+
+}) ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/okx-watch-tickers.js b/docs/ccxt/examples/ccxt.pro/js/okx-watch-tickers.js
new file mode 100644
index 0000000..06dfb4f
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/okx-watch-tickers.js
@@ -0,0 +1,31 @@
+import ccxt from '../../../js/ccxt.js';
+
+async function main() {
+    const exchange = new ccxt.pro.okx()
+    await exchange.loadMarkets()
+    // exchange.verbose = true
+    while (true) {
+        try {
+
+            // don't do this, specify a list of symbols to watch for watchTickers
+            // or a very large subscription message will crash your WS connection
+            // const tickers = await exchange.watchTickers ()
+
+            // do this instead
+            const symbols = [
+                'ETH/BTC',
+                'BTC/USDT',
+                'ETH/USDT',
+                // ...
+            ]
+            const tickers = await exchange.watchTickers (symbols)
+            symbols = Object.keys(tickers)
+            console.log (new Date(), 'received', symbols.length, 'symbols', ... symbols.slice(0,5).join(', '), '...')
+        } catch (e) {
+            console.log (new Date(), e.constructor.name, e.message)
+            break
+        }
+    }
+}
+
+main()
diff --git a/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-different-streams.js b/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-different-streams.js
new file mode 100644
index 0000000..cf2de11
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-different-streams.js
@@ -0,0 +1,46 @@
+'use strict';
+
+const ccxt = require ('ccxt')
+
+console.log ('CCXT Version:', ccxt.version)
+
+async function watchOrders(exchange) {
+    while (true) {
+        try {
+            const orders = await exchange.watchOrders() // await here
+            console.log(orders)
+        } catch (e) {
+            console.log(e)
+        }
+    }
+}
+
+async function watchBalance(exchange) {
+    while (true) {
+        try {
+            const balance = await exchange.watchBalance() // await here
+            console.log(balance)
+        } catch (e) {
+            console.log(e)
+        }
+    }
+}
+
+async function main() {
+     const exchange = new ccxt.pro.binance({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+        'password': 'IF NECESSARY',
+        // etc...
+    })
+    await exchange.loadMarkets () // await here
+
+    // exchange.verbose = true // uncomment for debugging purposes if necessary
+
+    watchOrders(exchange) // no await
+    watchBalance(exchange) // no await
+
+    await exchange.close()
+}
+
+main()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams-2.js b/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams-2.js
new file mode 100644
index 0000000..bdc176a
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams-2.js
@@ -0,0 +1,26 @@
+'use strict';
+
+const ccxt = require ('ccxt');
+
+(async () => {
+
+     const exchange = new ccxt.pro.binance ({ enableRateLimit: true })
+    const symbols = [ 'BTC/USDT', 'ETH/BTC', 'ETH/USDT' ]
+
+    const loop = async (symbol) => {
+        while (true) {
+            try {
+                const orderbook = await exchange.watchOrderBook (symbol)
+                console.log (new Date (), symbol, orderbook['asks'][0], orderbook['bids'][0])
+            } catch (e) {
+                console.log (symbol, e)
+                // do nothing and retry on next loop iteration
+                // throw e // uncomment to break all loops in case of an error in any one of them
+                // break // you can also break just this one loop if it fails
+            }
+        }
+    }
+
+    await Promise.all (symbols.map (symbol => loop (symbol)))
+
+}) ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams.js b/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams.js
new file mode 100644
index 0000000..5929766
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/one-exchange-many-streams.js
@@ -0,0 +1,28 @@
+'use strict';
+
+const ccxt = require ('ccxt');
+
+(async () => {
+
+     const exchange = new ccxt.pro.binance ({ enableRateLimit: true })
+    const symbols = [ 'BTC/USDT', 'ETH/BTC', 'ETH/USDT' ]
+
+    await Promise.all (symbols.map (symbol =>
+
+        (async () => {
+
+            while (true) {
+                try {
+                    const orderbook = await exchange.watchOrderBook (symbol)
+                    console.log (new Date (), symbol, orderbook['asks'][0], orderbook['bids'][0])
+                } catch (e) {
+                    console.log (symbol, e)
+                    // do nothing and retry on next loop iteration
+                    // throw e // uncomment to break all loops in case of an error in any one of them
+                    // break // you can also break just this one loop if it fails
+                }
+            }
+
+        }) ())
+    )
+}) ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/socks-binance-watch-orderbook.js b/docs/ccxt/examples/ccxt.pro/js/socks-binance-watch-orderbook.js
new file mode 100644
index 0000000..8c595c2
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/socks-binance-watch-orderbook.js
@@ -0,0 +1,30 @@
+'use strict';
+
+const ccxt = require ('ccxt')
+    , SocksProxyAgent = require ('socks-proxy-agent')
+    , socks = 'socks://127.0.0.1:7000'
+    , socksAgent = new SocksProxyAgent (socks)
+    , exchange = new ccxt.binance ({
+        enableRatLimit: true,
+        httpsAgent: socksAgent, // ←--------------------- socksAgent here
+        options: {
+            'ws': {
+                'options': { agent: socksAgent }, // ←--- socksAgent here
+            },
+        },
+    })
+
+;(async () => {
+    console.log (socks)
+    const symbol = 'BTC/USDT'
+    await exchange.loadMarkets ()
+    console.log ('Markets loaded')
+    while (true) {
+        try {
+            const orderbook = await exchange.watchOrderBook (symbol)
+            console.log (exchange.iso8601 (exchange.milliseconds()), symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (e.constructor.name, e.message)
+        }
+    }
+}) ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-fetch-many-exchanges-many-ordersbooks.js b/docs/ccxt/examples/ccxt.pro/js/watch-fetch-many-exchanges-many-ordersbooks.js
new file mode 100644
index 0000000..9bc888f
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-fetch-many-exchanges-many-ordersbooks.js
@@ -0,0 +1,40 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+async function watchOrderBook (exchange, symbol) {
+    while (true) {
+        try {
+            const method = exchange.has.watchOrderBook ? 'watchOrderBook' : 'fetchOrderBook'
+            const orderbook = await exchange[method](symbol)
+            console.log (new Date (), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (symbol, e)
+            process.exit ()
+        }
+    }
+}
+
+async function watchExchange (exchangeId, symbols) {
+     const exchange = new ccxt.pro[exchangeId] ()
+    await exchange.loadMarkets ()
+    await Promise.all (symbols.map (symbol => watchOrderBook (exchange, symbol)))
+}
+
+async function main () {
+    const streams = {
+        'ftx': [
+            'BTC/USDT',
+            'ETH/BTC',
+        ],
+        'coinex': [
+            'BTC/USDT',
+            'ETH/BTC',
+        ],
+    };
+
+    const entries = Object.entries (streams)
+    await Promise.all (entries.map (([ exchangeId, symbols ]) => watchExchange (exchangeId, symbols)))
+}
+
+main()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-ordersbooks.js b/docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-ordersbooks.js
new file mode 100644
index 0000000..51e5241
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-ordersbooks.js
@@ -0,0 +1,38 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+async function watchOrderBook (exchange, symbol) {
+    while (true) {
+        try {
+            const orderbook = await exchange.watchOrderBook (symbol)
+            console.log (new Date (), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (symbol, e)
+        }
+    }
+}
+
+async function watchExchange (exchangeId, symbols) {
+     const exchange = new ccxt.pro[exchangeId] ()
+    await exchange.loadMarkets ()
+    await Promise.all (symbols.map (symbol => watchOrderBook (exchange, symbol)))
+}
+
+async function main () {
+    const streams = {
+        'binance': [
+            'BTC/USDT',
+            'ETH/BTC',
+        ],
+        'ftx': [
+            'BTC/USDT',
+            'ETH/BTC',
+        ],
+    };
+
+    const entries = Object.entries (streams)
+    await Promise.all (entries.map (([ exchangeId, symbols ]) => watchExchange (exchangeId, symbols)))
+}
+
+main()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-symbols.js b/docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-symbols.js
new file mode 100644
index 0000000..e01a594
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-many-exchanges-many-symbols.js
@@ -0,0 +1,40 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+console.log ('CCXT Version:', ccxt.version)
+
+
+async function watchTickerLoop (exchange, symbol) {
+    // exchange.verbose = true // uncomment for debugging purposes if necessary
+    while (true) {
+        try {
+            const ticker = await exchange.watchTicker (symbol)
+            console.log (new Date (), exchange.id, symbol, ticker['last'])
+        } catch (e) {
+            console.log (symbol, e)
+            // do nothing and retry on next loop iteration
+            // throw e // uncomment to break all loops in case of an error in any one of them
+            // break // you can also break just this one loop if it fails
+        }
+    }
+}
+
+async function exchangeLoop (exchangeId, symbols) {
+     const exchange = new ccxt.pro[exchangeId]()
+    await exchange.loadMarkets ()
+    const loops = symbols.map (symbol => watchTickerLoop (exchange, symbol))
+    await Promise.all (loops)
+    await exchange.close ()
+}
+
+async function main () {
+    const exchanges = {
+        'binance': [ 'BTC/USDT', 'ETH/USDT' ],
+        'ftx': [ 'BTC/USD', 'ETH/USD' ],
+    }
+    const loops = Object.entries (exchanges).map (([ exchangeId, symbols ]) => exchangeLoop (exchangeId, symbols))
+    await Promise.all (loops)
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-many-orderbooks.js b/docs/ccxt/examples/ccxt.pro/js/watch-many-orderbooks.js
new file mode 100644
index 0000000..ea5efce
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-many-orderbooks.js
@@ -0,0 +1,27 @@
+'use strict';
+
+const ccxt = require ('ccxt');
+
+async function watchOrderBook (exchangeId, symbol) {
+
+     const exchange = new ccxt.pro[exchangeId] ()
+    while (true) {
+        try {
+            const orderbook = await exchange.watchOrderBook (symbol)
+            console.log (new Date (), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+        } catch (e) {
+            console.log (symbol, e)
+        }
+    }
+}
+
+async function main () {
+    const streams = {
+        'binance': 'BTC/USDT',
+        'ftx': 'BTC/USDT',
+    };
+
+    await Promise.all (Object.entries (streams).map (([ exchangeId, symbol ]) => watchOrderBook (exchangeId, symbol)))
+}
+
+main()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-new-trades-only.js b/docs/ccxt/examples/ccxt.pro/js/watch-new-trades-only.js
new file mode 100644
index 0000000..0d9015e
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-new-trades-only.js
@@ -0,0 +1,43 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+console.log ('CCXT Version:', ccxt.version);
+
+async function watchExchange (exchangeId, symbol) {
+
+     const exchange = new ccxt.pro[exchangeId] ({
+        newUpdates: true,
+    })
+
+    await exchange.loadMarkets ();
+
+    // exchange.verbose = true // uncomment for debugging purposes if necessary
+
+    while (true) {
+        try {
+            const trades = await exchange.watchTrades (symbol)
+            for (let i = 0; i < trades.length; i++) {
+                const trade = trades[i]
+                console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, trade['symbol'], trade['id'], trade['datetime'], trade['price'], trade['amount'])
+            }
+        } catch (e) {
+            console.log (symbol, e)
+        }
+    }
+}
+
+async function main () {
+
+    const streams = {
+        'binance': 'BTC/USDT',
+        'okex': 'BTC/USDT',
+        'kraken': 'BTC/USD',
+    };
+
+    const values = Object.entries (streams)
+    const promises = values.map (([ exchangeId, symbol ]) => watchExchange (exchangeId, symbol))
+    await Promise.all (promises)
+}
+
+main ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-new-trades.js b/docs/ccxt/examples/ccxt.pro/js/watch-new-trades.js
new file mode 100644
index 0000000..9b0466d
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-new-trades.js
@@ -0,0 +1,42 @@
+'use strict';
+
+const ccxt = require ('../../../ccxt');
+
+(async () => {
+
+    const streams = {
+        'binance': 'BTC/USDT',
+        'okex': 'BTC/USDT'
+    };
+
+    await Promise.all (Object.keys (streams).map (exchangeId =>
+
+        (async () => {
+
+             const exchange = new ccxt.pro[exchangeId] ({
+                enableRateLimit: true,
+                options: {
+                    tradesLimit: 100, // lower = better, 1000 by default
+                },
+            })
+            const symbol = streams[exchangeId]
+            let lastId = ''
+            while (true) {
+                console.log ('---')
+                try {
+                    const trades = await exchange.watchTrades (symbol)
+                    for (let i = 0; i < trades.length; i++) {
+                        const trade = trades[i]
+                        if (trade['id'] > lastId) {
+                            console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, trade['symbol'], trade['id'], trade['datetime'], trade['price'], trade['amount'])
+                            lastId = trade['id']
+                        }
+                    }
+                } catch (e) {
+                    console.log (symbol, e)
+                }
+            }
+
+        }) ())
+    )
+}) ()
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-trades-many-symbols.js b/docs/ccxt/examples/ccxt.pro/js/watch-trades-many-symbols.js
new file mode 100644
index 0000000..3523ea0
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-trades-many-symbols.js
@@ -0,0 +1,29 @@
+'use strict';
+
+const ccxt = require ('ccxt');
+
+console.log ('CCXT Version:', ccxt.version)
+
+async function watchTrades (exchange, symbol) {
+
+    while (true) {
+        try {
+            const trades = await exchange.watchTrades (symbol)
+            console.log (new Date (), exchange.id, symbol, trades.length, 'trades')
+        } catch (e) {
+            console.log (symbol, e)
+        }
+    }
+}
+
+async function main () {
+    const symbols = [ 'USDT/THB', 'BTC/THB', 'ETH/THB' ]
+     const exchange = new ccxt.pro.zipmex({
+        'newUpdates': true
+    })
+    const markets = await exchange.loadMarkets ()
+    exchange.verbose = true
+    await Promise.all (symbols.map ((symbol) => watchTrades (exchange, symbol)))
+}
+
+main()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/js/watch-vs-fetch.js b/docs/ccxt/examples/ccxt.pro/js/watch-vs-fetch.js
new file mode 100644
index 0000000..179b9ba
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/js/watch-vs-fetch.js
@@ -0,0 +1,29 @@
+// see this issue for details
+// https://github.com/ccxt/ccxt/issues/6659
+
+const ccxt = require ('ccxt')
+
+ const exchange = new ccxt.pro.kraken ()
+
+function yellow (s) {
+    return '\x1b[33m' + s + '\x1b[0m'
+}
+
+async function runWs () {
+    while (1) {
+        const book = await exchange.watchOrderBook ('ETH/BTC')
+        console.log (new Date (), 'WS  ', book['datetime'], book['bids'][0][0], book['asks'][0][0])
+    }
+}
+
+async function runRest () {
+    while (1) {
+        const book = await exchange.fetchOrderBook ('ETH/BTC')
+        const timestamp = new Date (exchange.last_response_headers['Date']).getTime ()
+        const datetime = exchange.iso8601 (timestamp)
+        console.log (new Date (), 'REST', yellow (datetime), book['bids'][0][0], book['asks'][0][0])
+    }
+}
+
+runWs ()
+runRest ()
\ No newline at end of file
diff --git a/docs/ccxt/examples/ccxt.pro/php/many-exchanges-many-accounts.php b/docs/ccxt/examples/ccxt.pro/php/many-exchanges-many-accounts.php
new file mode 100644
index 0000000..aed70a4
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/php/many-exchanges-many-accounts.php
@@ -0,0 +1,76 @@
+verbose = true; // this is a debug output to demonstrate which networking calls are being issued
+
+    if (file_exists($markets_on_disk)) {
+
+        $cache = json_decode(file_get_contents($markets_on_disk), true);
+        foreach ($keys as $key) {
+            $exchange->{$key} = $cache[$key];
+        }
+
+    } else {
+
+        $markets = yield $exchange->load_markets();
+        $cache = array();
+        foreach ($keys as $key) {
+            $cache[$key] = $exchange->{$key};
+        }
+        file_put_contents($markets_on_disk, json_encode($cache));
+    }
+
+    return $exchange;
+}
+
+$exchanges = array(
+    array('binance', array(
+        'id' => 'binance1',
+        'apiKey' => 'YOUR_API_KEY_HERE',
+        'secret' => 'YOUR_SECRET_HERE',
+    )),
+    array('binance', array(
+        'id' => 'binance2',
+        'apiKey' => 'YOUR_API_KEY_HERE',
+        'secret' => 'YOUR_SECRET_HERE',
+    )),
+);
+
+$loop = function($exchange_id, $config) {
+    $exchange = yield create_exchange($exchange_id, $config);
+    $exchange->verbose = true;
+    while (true) {
+        $response = yield $exchange->watch_balance();
+        print('--------------------------------------------------------------');
+        print($exchange->id);
+        print($response);
+    }
+};
+
+
+foreach ($exchanges as $exchange) {
+    \React\Async\coroutine($loop, $exchange[0], $exchange[1]);
+}
diff --git a/docs/ccxt/examples/ccxt.pro/php/many-exchanges-synchronously.php b/docs/ccxt/examples/ccxt.pro/php/many-exchanges-synchronously.php
new file mode 100644
index 0000000..321ea40
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/php/many-exchanges-synchronously.php
@@ -0,0 +1,27 @@
+ true);
+$binance = new \ccxt\pro\binance($config);
+$bittrex = new \ccxt\pro\bittrex($config);
+$symbol = "BTC/USDT";
+
+$loop = function($exchange, $symbol) {
+    echo 'got inside' . PHP_EOL;
+    for ($i = 0; $i < 5; $i++) {
+        $ticker = yield $exchange->watch_ticker($symbol);
+        print_ticker($ticker, $exchange->id, $symbol);
+    }
+};
+
+function print_ticker($ticker, $exchange_name, $symbol) {
+    $bid = $ticker['bid'];
+    $ask = $ticker['ask'];
+    echo "$exchange_name $symbol - bid: $bid <> ask: $ask" . PHP_EOL;
+}
+
+\React\Async\coroutine($loop, $bittrex, $symbol);
+\React\Async\coroutine($loop, $binance, $symbol);
diff --git a/docs/ccxt/examples/ccxt.pro/php/one-exchange-many-streams.php b/docs/ccxt/examples/ccxt.pro/php/one-exchange-many-streams.php
new file mode 100644
index 0000000..6661472
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/php/one-exchange-many-streams.php
@@ -0,0 +1,30 @@
+ true,
+));
+
+$symbols = array('BTC/USDT', 'ETH/USDT', 'ETH/BTC');
+
+function print_orderbook($orderbook, $symbol) {
+    $id = isset($orderbook['nonce']) ? $orderbook['nonce'] : $orderbook['datetime'];
+    echo $id, ' ', $symbol, ' ',
+        count($orderbook['asks']), ' asks ', json_encode($orderbook['asks'][0]), ' ',
+        count($orderbook['bids']), ' bids ', json_encode($orderbook['bids'][0]), "\n";
+}
+
+$loop = function($exchange, $symbol) {
+    while (true) {
+        $orderbook = yield $exchange->watch_order_book($symbol);
+        print_orderbook($orderbook, $symbol);
+    }
+};
+
+foreach ($symbols as $symbol) {
+    \React\Async\coroutine($loop, $exchange, $symbol);
+}
diff --git a/docs/ccxt/examples/ccxt.pro/php/watch-multiple-methods-multiple-exchanges.php b/docs/ccxt/examples/ccxt.pro/php/watch-multiple-methods-multiple-exchanges.php
new file mode 100644
index 0000000..b57d724
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/php/watch-multiple-methods-multiple-exchanges.php
@@ -0,0 +1,41 @@
+ _YOUR_APIKEY_HERE_, 'secret' => _YOUR_SECRET_HERE_ ]*/ ); 
+
+$ftx_id = '\\ccxt\\pro\\ftx';
+$ftx_exchange = new $ftx_id( /*['apiKey' => _YOUR_APIKEY_HERE_, 'secret' => _YOUR_SECRET_HERE_]*/ ); 
+
+$wrapper_func = function($exchange, $symbol, $method_name) {
+    if ($exchange->has[$method_name]) {
+        print ("Starting $method_name for $exchange->id -> $symbol\n");
+        while (true) {
+            try {
+                $orderbook = yield $exchange->$method_name($symbol);
+                print("$exchange->id -> $method_name -> $symbol : " . substr(json_encode($orderbook), 0 , 70) . "...\n");
+            } catch (\Exception $ex) {
+                print($ex->getMessage());
+                sleep(5);
+            }
+        }
+    } else {
+        print ($exchange->id . " API yet doesnt support $method_name");
+    }
+};
+
+function runAsync (...$args) { 
+    \React\Async\coroutine(...$args);
+}
+
+// *** uncomment whichever methods you want to test ***
+// runAsync($wrapper_func, ...[$exchange, 'ETH/USDT', 'watchOrderBook']);
+// runAsync($wrapper_func, ...[$exchange, 'ETH/USDT', 'watchTicker']);
+// runAsync($wrapper_func, ...[$exchange, 'ETH/USDT', 'watchOrders']);
+// runAsync($wrapper_func, ...[$exchange, 'ETH/USDT', 'watchMyTrades']);
+
+runAsync($wrapper_func, ...[$binance_exchange, 'SOL/USDT', 'watchTrades']);
+runAsync($wrapper_func, ...[$ftx_exchange, 'ETH/USDT', 'watchTrades']);
+
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-create-order-cancel-order.py b/docs/ccxt/examples/ccxt.pro/py/binance-create-order-cancel-order.py
new file mode 100644
index 0000000..380ae59
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-create-order-cancel-order.py
@@ -0,0 +1,34 @@
+import ccxt.pro
+from pprint import pprint
+from asyncio import run
+
+
+print('CCXT Version:', ccxt.__version__)
+
+
+async def main():
+    exchange = ccxt.pro.binance({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    })
+
+    markets = await exchange.load_markets()
+
+    # exchange.verbose = True  # uncomment for debugging purposes if necessary
+
+    symbol = 'ETH/BTC'
+    type = 'limit'  # or 'market'
+    side = 'sell'  # or 'buy'
+    amount = 1.0
+    price = 0.060154  # or None
+
+    order = await exchange.create_order(symbol, type, side, amount, price)
+    canceled = await exchange.cancel_order(order['id'], order['symbol'])
+
+    pprint(canceled)
+
+    await exchange.close()
+
+
+run(main())
+
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-fetch-balance-snapshot-watch-balance-updates.py b/docs/ccxt/examples/ccxt.pro/py/binance-fetch-balance-snapshot-watch-balance-updates.py
new file mode 100644
index 0000000..da680ea
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-fetch-balance-snapshot-watch-balance-updates.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import run
+
+
+print('CCXT Version:', ccxt.__version__)
+
+
+# This example will run silent and will return your balance only when the balance is updated.
+#
+# 1. launch the example with your keys and keep it running
+# 2. go to the trading section on the website
+# 3. place a order on a spot market
+# 4. see your balance updated in the example
+#
+# Warning! This example might produce a lot of output to your screen
+
+
+async def watch_balance(exchange):
+    await exchange.load_markets()
+    # exchange.verbose = True  # uncomment for debugging purposes if necessary
+    balance = await exchange.fetch_balance()
+    print('---------------------------------------------------------')
+    print(exchange.iso8601(exchange.milliseconds()))
+    print(balance)
+    print('')
+    while True:
+        try:
+            update = await exchange.watch_balance()
+            balance = exchange.deep_extend(balance, update)
+            # it will print the balance update when the balance changes
+            # if the balance remains unchanged the exchange will not send it
+            print('---------------------------------------------------------')
+            print(exchange.iso8601(exchange.milliseconds()))
+            print(balance)
+            print('')
+        except Exception as e:
+            print('watch_balance() failed')
+            print(type(e).__name__, str(e))
+            break
+
+
+async def main():
+    exchange = ccxt.pro.binance({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    })
+    await watch_balance(exchange)
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-balance.py b/docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-balance.py
new file mode 100644
index 0000000..d495eca
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-balance.py
@@ -0,0 +1,39 @@
+import ccxt
+import ccxt.pro
+import asyncio
+
+from pprint import pprint
+
+loop = asyncio.get_event_loop()
+
+
+async def print_balance(exchange, market_type):
+    while True:
+        try:
+            balance = await exchange.watch_balance({'type': market_type})
+            pprint(balance)
+            print('balance of ' + market_type, balance)
+            print(exchange.options[market_type])
+        except ccxt.BaseError as e:
+            print(type(e), e)
+        except Exception as e:
+            print(type(e), e)
+
+
+async def main():
+    exchange = ccxt.pro.binance({
+        "apiKey": "",
+        "secret": "",
+        'enableRateLimit': True,
+        'newUpdates': True,
+    })
+    # you must make an order a transfer first to the websocket to send updates
+    asyncio.ensure_future(print_balance(exchange, 'future'))
+    asyncio.ensure_future(print_balance(exchange, 'delivery'))  # inverse futures settled in BTC
+    asyncio.ensure_future(print_balance(exchange, 'spot'))
+
+
+asyncio.run(main())
+asyncio.ensure_future(main())
+loop.run_forever()
+
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-order-book.py b/docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-order-book.py
new file mode 100644
index 0000000..b0e6153
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-futures-watch-order-book.py
@@ -0,0 +1,22 @@
+import ccxt.pro
+from asyncio import run
+
+
+async def main():
+    exchange = ccxt.pro.binance({
+        'options': {
+            'defaultType': 'future',
+        },
+    })
+    symbol = 'BTC/USDT'
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            print(orderbook['bids'][0], orderbook['asks'][0])
+        except Exception as e:
+            print(type(e).__name__, str(e))
+    await exchange.close()
+
+
+run(main())
+
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-futures.py b/docs/ccxt/examples/ccxt.pro/py/binance-futures.py
new file mode 100644
index 0000000..a08d807
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-futures.py
@@ -0,0 +1,27 @@
+import ccxt.pro as ccxt
+from asyncio import run
+
+print('CCXT Version:', ccxt.__version__)
+
+async def main():
+    exchange = ccxt.pro.binance({
+        'options': {
+            'defaultType': 'future',  # spot, margin, future, delivery
+        },
+    })
+    # or
+    # exchange = ccxt.pro.binanceusdm()
+    # or
+    # exchange = ccxt.pro.binancecoinm()
+    symbol = 'BTC/USDT'
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            print(exchange.iso8601(exchange.milliseconds()), exchange.id, symbol, 'ask:', orderbook['asks'][0], 'bid:', orderbook['bids'][0])
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-reload-markets.py b/docs/ccxt/examples/ccxt.pro/py/binance-reload-markets.py
new file mode 100644
index 0000000..4d887eb
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-reload-markets.py
@@ -0,0 +1,42 @@
+import ccxt.pro
+from asyncio import run, gather
+
+
+print('CCXT Pro version', ccxt.pro.__version__)
+
+
+async def watch_order_book(exchange, symbol):
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            datetime = exchange.iso8601(exchange.milliseconds())
+            print(datetime, orderbook['nonce'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+
+
+async def reload_markets(exchange, delay):
+    while True:
+        try:
+            await exchange.sleep(delay)
+            markets = await exchange.load_markets(True)
+            datetime = exchange.iso8601(exchange.milliseconds())
+            print(datetime, 'Markets reloaded')
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+
+
+async def main():
+    exchange = ccxt.pro.binance()
+    await exchange.load_markets()
+    # exchange.verbose = True
+    symbol = 'BTC/USDT'
+    delay = 60000  # every minute = 60 seconds = 60000 milliseconds
+    loops = [watch_order_book(exchange, symbol), reload_markets(exchange, delay)]
+    await gather(*loops)
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-spot-and-futures.py b/docs/ccxt/examples/ccxt.pro/py/binance-spot-and-futures.py
new file mode 100644
index 0000000..0655f80
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-spot-and-futures.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import gather, run
+
+
+orderbooks = {}
+
+
+def handle_all_orderbooks(orderbooks):
+    print('We have the following orderbooks:')
+    for id, orderbooks_by_symbol in orderbooks.items():
+        for symbol in orderbooks_by_symbol.keys():
+            orderbook = orderbooks_by_symbol[symbol]
+            print(ccxt.pro.Exchange.iso8601(orderbook['timestamp']), id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+
+
+async def symbol_loop(exchange, id, symbol):
+    print('Starting', id, symbol)
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            orderbooks[id] = orderbooks.get(id, {})
+            orderbooks[id][symbol] = orderbook
+            print('===========================================================')
+            #
+            # here you can do what you want
+            # with the most recent versions of each orderbook you have so far
+            #
+            # you can also wait until all of them are available
+            # by just looking into all the orderbooks and counting them
+            #
+            # we just print them here to keep this example simple
+            #
+            handle_all_orderbooks(orderbooks)
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def exchange_loop(id, config):
+    print('Starting', id)
+    exchange = getattr(ccxt.pro, config['id'])({
+        'options': config['options'],
+    })
+    loops = [symbol_loop(exchange, id, symbol) for symbol in config['symbols']]
+    await gather(*loops)
+    await exchange.close()
+
+
+async def main():
+    configs = {
+        'Exchange A (Binance spot)': {
+            'id': 'binance',
+            'symbols': ['BTC/USDT', 'ETH/BTC','ETH/USDT'],
+            'options': {
+                'defaultType': 'spot',
+            },
+        },
+        'Exchange B (Binance futures)': {
+            'id': 'binance',
+            'symbols': ['BTC/USDT', 'ETH/USDT'],
+            'options': {
+                'defaultType': 'future',
+            },
+        },
+    }
+    loops = [exchange_loop(id, config) for id, config in configs.items()]
+    await gather(*loops)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-watch-many-orderbooks.py b/docs/ccxt/examples/ccxt.pro/py/binance-watch-many-orderbooks.py
new file mode 100644
index 0000000..b1345b0
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-watch-many-orderbooks.py
@@ -0,0 +1,51 @@
+import ccxt.pro as ccxt
+import asyncio
+
+orderbooks = {}
+
+def when_orderbook_changed(exchange_spot, symbol, orderbook):
+    # this is a common handler function
+    # it is called when any of the orderbook is updated
+    # it has access to both the orderbook that was updated
+    # as well as the rest of the orderbooks
+    # ...................................................................
+    print('-------------------------------------------------------------')
+    print('Last updated:', exchange_spot.iso8601(exchange_spot.milliseconds()))
+    # ...................................................................
+    # print just one orderbook here
+    # print(orderbook['datetime'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+    # ...................................................................
+    # or print all orderbooks that have been already subscribed-to
+    for symbol, orderbook in orderbooks.items():
+        print(orderbook['datetime'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+
+
+async def watch_one_orderbook(exchange_spot, symbol):
+    # a call cost of 1 in the queue of subscriptions
+    # means one subscription per exchange.rateLimit milliseconds
+    your_delay = 1
+    await exchange_spot.throttle(your_delay)
+    while True:
+        try:
+            orderbook = await exchange_spot.watch_order_book(symbol)
+            orderbooks[symbol] = orderbook
+            when_orderbook_changed(exchange_spot, symbol, orderbook)
+        except Exception as e:
+            print(type(e).__name__, str(e))
+
+
+async def watch_some_orderbooks(exchange_spot, symbol_list):
+    loops = [watch_one_orderbook(exchange_spot, symbol) for symbol in symbol_list]
+    # let them run, don't for all tasks cause they execute asynchronously
+    # don't print here
+    await asyncio.gather(*loops)
+
+
+async def main():
+    exchange_spot = ccxt.binance()
+    await exchange_spot.load_markets()
+    await watch_some_orderbooks(exchange_spot, ['ZEN/USDT', 'RUNE/USDT', 'AAVE/USDT', 'SNX/USDT'])
+    await exchange_spot.close()
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-watch-margin-balance.py b/docs/ccxt/examples/ccxt.pro/py/binance-watch-margin-balance.py
new file mode 100644
index 0000000..5fbca51
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-watch-margin-balance.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import run
+import ccxt.pro as ccxt
+from pprint import pprint
+
+
+# This example will run silent and will return your balance only when the balance is updated.
+
+# 1. launch the example with your keys and keep it running
+# 2. go to the margin trading on the website
+# 3. place a margin order on a spot market
+# 4. see your balance updated in the example
+
+
+async def main():
+    exchange = ccxt.pro.binance({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+        'options': {
+            'defaultType': 'margin',
+        },
+        # comment it out if you don't want debug output
+        # this is for the demo purpose only (to show the communication)
+        'verbose': True,
+    })
+    while True:
+        try:
+            balance = await exchange.watch_balance()
+            # it will print the balance update when the balance changes
+            # if the balance remains unchanged the exchange will not send it
+            pprint(balance)
+        except Exception as e:
+            print('watch_balance() failed')
+            print(e)
+            break
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-watch-ohlcv.py b/docs/ccxt/examples/ccxt.pro/py/binance-watch-ohlcv.py
new file mode 100644
index 0000000..b607a82
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-watch-ohlcv.py
@@ -0,0 +1,43 @@
+import ccxt.pro
+from asyncio import run
+
+print('CCXT Pro version', ccxt.pro.__version__)
+
+
+def table(values):
+    first = values[0]
+    keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
+    widths = [max([len(str(v[k])) for v in values]) for k in keys]
+    string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
+    return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])
+
+
+async def main():
+    exchange = ccxt.pro.binance({
+        # 'options': {
+        #     'OHLCVLimit': 1000, # how many candles to store in memory by default
+        # },
+    })
+    symbol = 'ETH/USDT'  # or BNB/USDT, etc...
+    timeframe = '1m'  # 5m, 1h, 1d
+    limit = 10  # how many candles to return max
+    method = 'watchOHLCV'
+    if (method in exchange.has) and exchange.has[method]:
+        max_iterations = 100000  # how many times to repeat the loop before exiting
+        for i in range(0, max_iterations):
+            try:
+                ohlcvs = await exchange.watch_ohlcv(symbol, timeframe, None, limit)
+                now = exchange.milliseconds()
+                print('\n===============================================================================')
+                print('Loop iteration:', i, 'current time:', exchange.iso8601(now), symbol, timeframe)
+                print('-------------------------------------------------------------------------------')
+                print(table([[exchange.iso8601(o[0])] + o[1:] for o in ohlcvs]))
+            except Exception as e:
+                print(type(e).__name__, str(e))
+                break
+        await exchange.close()
+    else:
+        print(exchange.id, method, 'is not supported or not implemented yet')
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-watch-order-book-individual-updates.py b/docs/ccxt/examples/ccxt.pro/py/binance-watch-order-book-individual-updates.py
new file mode 100644
index 0000000..92360f1
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-watch-order-book-individual-updates.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import run
+import ccxt.pro as ccxt
+
+
+class MyBinance(ccxt.binance):
+    def handle_order_book_message(self, client, message, orderbook):
+        asks = self.safe_value(message, 'a', [])
+        bids = self.safe_value(message, 'b', [])
+        # printing high-frequency updates is a resource-heavy task
+        # this print statement is here just to demonstrate the work of it
+        # replace it with you logic for processing individual updates
+        print('Updates:', {
+            'asks': asks,
+            'bids': bids,
+        })
+        return super(MyBinance, self).handle_order_book_message(client, message, orderbook);
+
+async def main():
+    exchange = MyBinance()
+    symbol = 'BTC/USDT'
+    print('Watching', exchange.id, symbol)
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            # break  # you can also break just this one loop if it fails
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-watch-orderbook-watch-balance.py b/docs/ccxt/examples/ccxt.pro/py/binance-watch-orderbook-watch-balance.py
new file mode 100644
index 0000000..db991d7
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-watch-orderbook-watch-balance.py
@@ -0,0 +1,63 @@
+import ccxt.pro
+from asyncio import run, gather
+
+
+data = {
+    'orderbook': None,
+    'balance': None,
+}
+
+
+def common_handler(exchange, symbol):
+    market = exchange.market(symbol)
+    base = market['base']
+    quote = market['quote']
+    balance = data['balance']
+    orderbook = data['orderbook']
+    if balance and orderbook:
+        total = balance['total']
+        tip = [ orderbook['asks'][0], orderbook['bids'][0] ]
+        print(exchange.iso8601(exchange.milliseconds()), symbol, 'orderbook:', tip, 'balance:', total)
+
+
+async def watch_order_book(exchange, symbol):
+    while True:
+        try:
+            data['orderbook'] = await exchange.watch_order_book(symbol)
+            common_handler(exchange, symbol)
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break  # break this loop
+
+
+async def watch_balance(exchange, symbol):
+    while True:
+        try:
+            data['balance'] = await exchange.watch_balance()
+            common_handler(exchange, symbol)
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break  # break this loop
+
+
+async def main():
+    exchange = ccxt.pro.binance({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    })
+    await exchange.load_markets()
+    symbol = 'BTC/USDT'
+    while True:
+        try:
+            loops = [
+                watch_order_book(exchange, symbol),
+                watch_balance(exchange, symbol)
+            ]
+            await gather(*loops)
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-watch-orders-being-placed.py b/docs/ccxt/examples/ccxt.pro/py/binance-watch-orders-being-placed.py
new file mode 100644
index 0000000..c8d144f
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-watch-orders-being-placed.py
@@ -0,0 +1,59 @@
+# Python
+import ccxt.pro
+from asyncio import run, gather
+from pprint import pprint
+
+
+async def place_delayed_order(exchange, symbol, amount, price):
+    try:
+        await exchange.sleep(5000)  # wait a bit
+        order = await exchange.create_limit_buy_order(symbol, amount, price)
+        print(exchange.iso8601(exchange.milliseconds()), 'place_delayed_order')
+        pprint(order)
+        print('---------------------------------------------------------------')
+    except Exception as e:
+        # break
+        print(e)
+
+
+async def watch_orders_loop(exchange, symbol):
+    while True:
+        try:
+            orders = await exchange.watch_orders(symbol)
+            print(exchange.iso8601(exchange.milliseconds()), 'watch_orders_loop', len(orders), ' last orders cached')
+            print('---------------------------------------------------------------')
+        except Exception as e:
+            # break
+            print(e)
+
+
+async def watch_balance_loop(exchange):
+    while True:
+        try:
+            balance = await exchange.watch_balance()
+            print(exchange.iso8601(exchange.milliseconds()), 'watch_balance_loop')
+            pprint(balance)
+            print('---------------------------------------------------------------')
+        except Exception as e:
+            # break
+            print(e)
+
+
+async def main():
+    exchange = ccxt.pro.binanceusdm({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    })
+    symbol = 'BTC/USDT'
+    amount = 0.001
+    price = 11111
+    loops = [
+        watch_orders_loop(exchange, symbol),
+        watch_balance_loop(exchange),
+        place_delayed_order(exchange, symbol, amount, price)
+    ]
+    await gather(*loops)
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/binance-watch-spot-futures-balances-continuously.py b/docs/ccxt/examples/ccxt.pro/py/binance-watch-spot-futures-balances-continuously.py
new file mode 100644
index 0000000..933505a
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/binance-watch-spot-futures-balances-continuously.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import run, gather
+import os
+import sys
+
+root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(root + '/python')
+
+import ccxt.pro  # noqa: E402
+
+
+print('CCXT Version:', ccxt.__version__)
+
+
+async def print_balance_continuously(exchange):
+    while True:
+        try:
+            print('-----------------------------------------------------------')
+            await exchange.load_markets()
+            balance = await exchange.watch_balance()
+            print(exchange.iso8601(exchange.milliseconds()), exchange.id)
+            for currency, value in balance['total'].items():
+                print(value, currency)
+        except Exception as e:
+            print('-----------------------------------------------------------')
+            print(exchange.iso8601(exchange.milliseconds()), exchange.id, type(e), e)
+            await exchange.sleep(300000)  # sleep 5 minutes and retry
+
+
+async def main():
+    config = {
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    }
+    exchange_ids = [
+        'binance',
+        'binanceusdm',
+        'binancecoinm',
+    ]
+    exchanges = [getattr(ccxt.pro, exchange_id)(config) for exchange_id in exchange_ids]
+    printing_loops = [print_balance_continuously(exchange) for exchange in exchanges]
+    await gather(*printing_loops)
+    closing_tasks = [exchange.close() for exchange in exchanges]
+    await gather(*closing_tasks)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ohlcv.py b/docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ohlcv.py
new file mode 100644
index 0000000..9e10b81
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ohlcv.py
@@ -0,0 +1,41 @@
+import ccxt.pro
+from asyncio import run
+
+
+def table(values):
+    first = values[0]
+    keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
+    widths = [max([len(str(v[k])) for v in values]) for k in keys]
+    string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
+    return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])
+
+
+async def main():
+    exchange = ccxt.pro.bitmex({
+        # 'options': {
+        #     'OHLCVLimit': 1000, # how many candles to store in memory by default
+        # },
+    })
+    symbol = 'BTC/USD'
+    timeframe = '1m'  # 5m, 1h, 1d
+    limit = 10  # how many candles to return max
+    method = 'watchOHLCV'
+    if (method in exchange.has) and exchange.has[method]:
+        max_iterations = 100  # how many times to repeat the loop before exiting
+        for i in range(0, max_iterations):
+            try:
+                ohlcvs = await exchange.watch_ohlcv(symbol, timeframe, None, limit)
+                now = exchange.milliseconds()
+                print('\n===============================================================================')
+                print('Loop iteration:', i, 'current time:', exchange.iso8601(now), symbol, timeframe)
+                print('-------------------------------------------------------------------------------')
+                print(table([[exchange.iso8601(o[0])] + o[1:] for o in ohlcvs]))
+            except Exception as e:
+                print(type(e).__name__, str(e))
+                break
+        await exchange.close()
+    else:
+        print(exchange.id, method, 'is not supported or not implemented yet')
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ticker_and_ohlcv.py b/docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ticker_and_ohlcv.py
new file mode 100644
index 0000000..6c085e3
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/bitmex_watch_ticker_and_ohlcv.py
@@ -0,0 +1,73 @@
+import ccxt.pro
+from asyncio import run, gather
+
+
+def table(values):
+    first = values[0]
+    keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first))
+    widths = [max([len(str(v[k])) for v in values]) for k in keys]
+    string = ' | '.join(['{:<' + str(w) + '}' for w in widths])
+    return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values])
+
+
+async def watch_ticker(color, duration, exchange, symbol):
+    method = 'watchTicker'
+    if (method in exchange.has) and exchange.has[method]:
+        start = exchange.milliseconds()
+        i = 1
+        while True:
+            ticker = await exchange.watch_ticker(symbol)
+            now = exchange.milliseconds()
+            # start color code
+            print(color, 'Ticker ========================================================================')
+            print(exchange.iso8601(now), symbol, 'iteration:', i, 'last price:', ticker['last'])
+            print('-------------------------------------------------------------------------------')
+            # pprint.pprint(ticker)  # uncomment for a lengthy complete printout
+            print('\x1b[0m')  # stop color code
+            i += 1
+            if (start + duration) < now:
+                break
+    else:
+        raise Exception(exchange.id + ' ' + method + ' is not supported or not implemented yet')
+
+
+async def watch_ohlcv(color, duration, exchange, symbol, timeframe, limit):
+    method = 'watchOHLCV'
+    if (method in exchange.has) and exchange.has[method]:
+        start = exchange.milliseconds()
+        i = 1
+        while True:
+            ohlcvs = await exchange.watch_ohlcv(symbol, timeframe, None, limit)
+            now = exchange.milliseconds()
+            # start color code
+            print(color, 'OHLCV =========================================================================')
+            print(exchange.iso8601(now), symbol, timeframe, 'iteration:', i)
+            print('-------------------------------------------------------------------------------')
+            print(table([[exchange.iso8601(o[0])] + o[1:] for o in ohlcvs]))
+            print('\x1b[0m')  # stop color code
+            i += 1
+            if (start + duration) < now:
+                break
+    else:
+        raise Exception(exchange.id + ' ' + method + ' is not supported or not implemented yet')
+
+
+# =============================================================================
+
+
+async def main():
+    exchange = ccxt.pro.bitmex()
+    await exchange.load_markets()
+    duration = 1200000  # run 20 minutes = 1200000 milliseconds
+    symbol = 'BTC/USD'
+    limit = 10
+    loops = [
+        watch_ticker('\033[35m', duration, exchange, symbol),              # magenta
+        watch_ohlcv('\x1b[33m', duration, exchange, symbol, '1m', limit),  # yellow
+        watch_ohlcv('\x1b[32m', duration, exchange, symbol, '5m', limit),  # green
+    ]
+    await gather(*loops)
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/bitvavo-watch-order-book.py b/docs/ccxt/examples/ccxt.pro/py/bitvavo-watch-order-book.py
new file mode 100644
index 0000000..2494a41
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/bitvavo-watch-order-book.py
@@ -0,0 +1,23 @@
+import ccxt.pro
+from asyncio import run
+
+
+print('CCXT Pro version', ccxt.pro.__version__)
+
+
+async def main():
+    exchange = ccxt.pro.bitvavo()
+    await exchange.load_markets()
+    exchange.verbose = True
+    symbol = 'BTC/EUR'
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            print(orderbook['nonce'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/build-ohlcv-many-symbols.py b/docs/ccxt/examples/ccxt.pro/py/build-ohlcv-many-symbols.py
new file mode 100644
index 0000000..50937ae
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/build-ohlcv-many-symbols.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+import asyncio
+import ccxt.pro
+
+
+print('CCXT Version:', ccxt.__version__)
+
+
+async def loop(exchange, symbol, timeframe, complete_candles_only=False):
+    duration_in_seconds = exchange.parse_timeframe(timeframe)
+    duration_in_ms = duration_in_seconds * 1000
+    while True:
+        try:
+            trades = await exchange.watch_trades(symbol)
+            if len(trades) > 0:
+                current_minute = int(exchange.milliseconds() / duration_in_ms)
+                ohlcvc = exchange.build_ohlcvc(trades, timeframe)
+                if complete_candles_only:
+                    ohlcvc = [candle for candle in ohlcvc if int(candle[0] / duration_in_ms) < current_minute]
+                if len(ohlcvc) > 0:
+                    print('-----------------------------------------------------------')
+                    print("Symbol:", symbol, "timeframe:", timeframe)
+                    print(ohlcvc)
+
+        except Exception as e:
+            print(f"{type(e).__name__}: {(str(e))}")
+            # raise type(e)(str(e))  # uncomment to break all loops in case of an error in any one of them
+            # break  # you can also break just this one loop if it fails
+
+
+async def main():
+    # select the exchange
+    exchange = ccxt.pro.binance()
+    if exchange.has['watchTrades']:
+        markets = await exchange.load_markets()
+        # Change this value accordingly
+        timeframe = '1m'
+        limit = 5
+        selected_symbols = list(markets.values())[:limit]
+        # you can also specify the symbols manually
+        # selected_symbols = ['BTC/USDT', 'ETH/USDT']
+
+        # Use this variable to choose if only complete candles
+        # should be considered
+        complete_candles_only = True
+        await asyncio.gather(*[loop(exchange, symbol['symbol'], timeframe, complete_candles_only)
+                               for symbol in selected_symbols])
+        await exchange.close()
+    else:
+        print(exchange.id, 'does not support watchTrades yet')
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/coinbase-watch-all-trades.py b/docs/ccxt/examples/ccxt.pro/py/coinbase-watch-all-trades.py
new file mode 100644
index 0000000..82244ea
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/coinbase-watch-all-trades.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import run
+
+async def main():
+    exchange = ccxt.pro.coinbase()
+    method = 'watchTrades'
+    print('CCXT Pro version', ccxt.pro.__version__)
+    if exchange.has[method]:
+        last_id = ''
+        while True:
+            try:
+                trades = await exchange.watch_trades('BTC/USD')
+                for trade in trades:
+                    if trade['id'] > last_id:
+                        print(exchange.iso8601(exchange.milliseconds()), trade['symbol'], trade['datetime'], trade['price'], trade['amount'])
+                        last_id = trade['id']
+
+            except Exception as e:
+                # stop
+                await exchange.close()
+                raise e
+                # or retry
+                # pass
+    else:
+        raise Exception(exchange.id + ' ' + method + ' is not supported or not implemented yet')
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/coinbase-watch-trades.py b/docs/ccxt/examples/ccxt.pro/py/coinbase-watch-trades.py
new file mode 100644
index 0000000..64aaf28
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/coinbase-watch-trades.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import run
+
+async def main():
+    exchange = ccxt.pro.coinbase()
+    method = 'watchTrades'
+    print('CCXT Pro version', ccxt.pro.__version__)
+    if exchange.has[method]:
+        while True:
+            try:
+                trades = await exchange.watch_trades('BTC/USD')
+                num_trades = len(trades)
+                trade = trades[-1]
+                print(exchange.iso8601(exchange.milliseconds()), trade['symbol'], trade['datetime'], trade['price'], trade['amount'], 'stored', num_trades, 'trades in cache')
+            except Exception as e:
+                # stop
+                await exchange.close()
+                raise e
+                # or retry
+                # pass
+    else:
+        raise Exception(exchange.id + ' ' + method + ' is not supported or not implemented yet')
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/consume-all-trades.py b/docs/ccxt/examples/ccxt.pro/py/consume-all-trades.py
new file mode 100644
index 0000000..389ee64
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/consume-all-trades.py
@@ -0,0 +1,22 @@
+import ccxt.pro
+from asyncio import run
+
+
+async def consume_all_trades(exchange, symbol):
+    await exchange.load_markets()
+    while True:
+        try:
+            trades = await exchange.watch_trades(symbol)
+            print('----------------------------------------------------------------------')
+            print(exchange.iso8601(exchange.milliseconds()), 'received', len(trades), 'new', symbol, 'trades:')
+            for trade in trades:
+                print(exchange.id, symbol, trade['id'], trade['datetime'], trade['amount'], trade['price'])
+            exchange.trades[symbol].clear()
+        except Exception as e:
+            print(type(e).__name__, str(e))
+    await exchange.close()
+
+
+exchange = ccxt.pro.bitmex()
+symbol = 'BTC/USD'
+run(consume_all_trades(exchange, symbol))
diff --git a/docs/ccxt/examples/ccxt.pro/py/gateio-watch-trades.py b/docs/ccxt/examples/ccxt.pro/py/gateio-watch-trades.py
new file mode 100644
index 0000000..5639c05
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/gateio-watch-trades.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+
+import asyncio
+import ccxt.pro
+
+from datetime import datetime
+
+async def loop(exchange, symbol):
+    since = datetime.utcnow()
+    timestamp = int(since.timestamp() * 1000)
+    while True:
+        trades = await exchange.watch_trades(symbol, since=timestamp)
+        print('--------------------------------------------------------------')
+        print('Received', len(trades), 'after', exchange.iso8601 (timestamp))
+        print('waiting for next update...')
+
+
+async def main():
+    exchange = ccxt.pro.gateio()
+    await loop(exchange, 'BTC/USDT')
+    await exchange.close()
+
+
+if __name__ == '__main__':
+    asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/intercept-original-ohlcv-updates.py b/docs/ccxt/examples/ccxt.pro/py/intercept-original-ohlcv-updates.py
new file mode 100644
index 0000000..a4dfd25
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/intercept-original-ohlcv-updates.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import run
+import ccxt.pro
+from pprint import pprint
+
+
+class MyBinance(ccxt.pro.binance):
+    def handle_ohlcv(self, client, message):
+        # add your handling of the original message here
+        print('intercepted', message)
+        return super(MyBinance, self).handle_ohlcv(client, message)
+
+
+async def main():
+    exchange = MyBinance()
+    symbol = 'BTC/USDT'
+    print('Watching', exchange.id, symbol)
+    while True:
+        try:
+            ohlcv = await exchange.watch_ohlcv(symbol, '1m')
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            # break  # you can also break just this one loop if it fails
+    await exchange.close()
+
+
+if __name__ == "__main__":
+    print('CCXT Version:', ccxt.__version__)
+    run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/kucoin-watch-multiple-orderbooks.py b/docs/ccxt/examples/ccxt.pro/py/kucoin-watch-multiple-orderbooks.py
new file mode 100644
index 0000000..e70dc34
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/kucoin-watch-multiple-orderbooks.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import gather, run
+
+
+async def symbol_loop(exchange, symbol):
+    print('Starting the', exchange.id, 'symbol loop with', symbol)
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            now = exchange.milliseconds()
+            print(exchange.iso8601(now), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+async def main():
+    exchange = ccxt.pro.kucoin({
+        "apiKey": "YOUR_API_KEY",
+        "secret": "YOUR_API_SECRET",
+        "password": "YOUR_API_PASSWORD",
+    })
+    symbols = ['KDA/USDT', 'KDA/BTC', 'BTC/USDT']
+    loops = [symbol_loop(exchange, symbol) for symbol in symbols]
+    await gather(*loops)
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-different-streams.py b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-different-streams.py
new file mode 100644
index 0000000..c9ff7d4
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-different-streams.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import gather, run
+
+
+async def symbol_loop(exchange, method, symbol):
+    print('Starting', exchange.id, method, symbol)
+    while True:
+        try:
+            response = await getattr(exchange, method)(symbol)
+            now = exchange.milliseconds()
+            iso8601 = exchange.iso8601(now)
+            if method == 'watchOrderBook':
+                print(iso8601, exchange.id, method, symbol, response['asks'][0], response['bids'][0])
+            elif method == 'watchTicker':
+                print(iso8601, exchange.id, method, symbol, response['high'], response['low'], response['bid'], response['ask'])
+            elif method == 'watchTrades':
+                print(iso8601, exchange.id, method, symbol, len(response), 'trades')
+
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def method_loop(exchange, method, symbols):
+    print('Starting', exchange.id, method, symbols)
+    loops = [symbol_loop(exchange, method, symbol) for symbol in symbols]
+    await gather(*loops)
+
+
+async def exchange_loop(exchange_id, methods):
+    print('Starting', exchange_id, methods)
+    exchange = getattr(ccxt.pro, exchange_id)()
+    loops = [method_loop(exchange, method, symbols) for method, symbols in methods.items()]
+    await gather(*loops)
+    await exchange.close()
+
+
+async def main():
+    exchanges = {
+        'okex': {
+            'watchOrderBook': ['BTC/USDT', 'ETH/BTC', 'ETH/USDT'],
+            'watchTicker': ['BTC/USDT'],
+        },
+        'binance': {
+            'watchOrderBook': ['BTC/USDT', 'ETH/BTC'],
+            'watchTrades': [ 'ETH/BTC' ],
+        },
+    }
+    loops = [exchange_loop(exchange_id, methods) for exchange_id, methods in exchanges.items()]
+    await gather(*loops)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-synchronized.py b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-synchronized.py
new file mode 100644
index 0000000..383344a
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-synchronized.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+
+import asyncio
+import ccxt.pro
+
+
+orderbooks = {}
+
+
+def handle_all_orderbooks(orderbooks):
+    print('We have the following orderbooks:')
+    for exchange_id, orderbooks_by_symbol in orderbooks.items():
+        for symbol in orderbooks_by_symbol.keys():
+            orderbook = orderbooks_by_symbol[symbol]
+            print(ccxt.pro.Exchange.iso8601(orderbook['timestamp']), exchange_id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+
+
+async def symbol_loop(exchange, symbol):
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            orderbooks[exchange.id] = orderbooks.get(exchange.id, {})
+            orderbooks[exchange.id][symbol] = orderbook
+            print('===========================================================')
+            #
+            # here you can do what you want
+            # with the most recent versions of each orderbook you have so far
+            #
+            # you can also wait until all of them are available
+            # by just looking into all the orderbooks and counting them
+            #
+            # we just print them here to keep this example simple
+            #
+            handle_all_orderbooks(orderbooks)
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def exchange_loop(exchange_id, symbols):
+    exchange = getattr(ccxt.pro, exchange_id)()
+    loops = [symbol_loop(exchange, symbol) for symbol in symbols]
+    await asyncio.gather(*loops)
+    await exchange.close()
+
+
+async def main():
+    symbols = ['BTC/USDT', 'ETH/BTC']
+    # symbols = []
+    exchanges = {
+        'okex': symbols + ['ETH/USDT'],
+        'binance': symbols,
+    }
+    loops = [exchange_loop(exchange_id, symbols) for exchange_id, symbols in exchanges.items()]
+    await asyncio.gather(*loops)
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-throttled.py b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-throttled.py
new file mode 100644
index 0000000..b32c5f0
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-orderbooks-throttled.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import run, gather, sleep
+
+
+orderbooks = {}
+
+
+def handle_all_orderbooks(orderbooks):
+    print('We have the following orderbooks:')
+    for exchange_id, orderbooks_by_symbol in orderbooks.items():
+        for symbol in orderbooks_by_symbol.keys():
+            orderbook = orderbooks_by_symbol[symbol]
+            print(ccxt.pro.Exchange.iso8601(orderbook['timestamp']), exchange_id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+
+
+async def handling_loop(orderbooks):
+    delay = 5
+    while True:
+        await sleep(delay)
+        handle_all_orderbooks(orderbooks)
+
+
+async def symbol_loop(exchange, symbol):
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            orderbooks[exchange.id] = orderbooks.get(exchange.id, {})
+            orderbooks[exchange.id][symbol] = orderbook
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def exchange_loop(exchange_id, symbols):
+    exchange = getattr(ccxt.pro, exchange_id)()
+    loops = [symbol_loop(exchange, symbol) for symbol in symbols]
+    await gather(*loops)
+    await exchange.close()
+
+
+async def main():
+    symbols = ['BTC/USDT', 'ETH/BTC']
+    # symbols = []
+    exchanges = {
+        'okex': symbols + ['ETH/USDT'],
+        'binance': symbols,
+    }
+    loops = [exchange_loop(exchange_id, symbols) for exchange_id, symbols in exchanges.items()]
+    loops += [handling_loop(orderbooks)]
+    await gather(*loops)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams-with-keys.py b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams-with-keys.py
new file mode 100644
index 0000000..1ae3e5e
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams-with-keys.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import gather, run
+
+
+async def symbol_loop(exchange, method, symbol):
+    print('Starting', exchange.id, method, symbol)
+    while True:
+        try:
+            response = await getattr(exchange, method)(symbol)
+            now = exchange.milliseconds()
+            iso8601 = exchange.iso8601(now)
+            if method == 'watchOrderBook':
+                print(iso8601, exchange.id, method, symbol, response['asks'][0], response['bids'][0])
+            elif method == 'watchTicker':
+                print(iso8601, exchange.id, method, symbol, response['high'], response['low'], response['bid'], response['ask'])
+            elif method == 'watchTrades':
+                print(iso8601, exchange.id, method, symbol, len(response), 'trades')
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def symbols_method_loop(exchange, method, symbols):
+    print('Starting', exchange.id, method, symbols)
+    loops = [symbol_loop(exchange, method, symbol) for symbol in symbols]
+    await gather(*loops)
+
+
+async def method_loop(exchange, method):
+    print('Starting', exchange.id, method)
+    while True:
+        try:
+            response = await getattr(exchange, method)()
+            now = exchange.milliseconds()
+            iso8601 = exchange.iso8601(now)
+            print(iso8601, exchange.id, method, response)
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def exchange_loop(exchange_id, methods, config={}):
+    print('Starting', exchange_id, methods)
+    exchange = getattr(ccxt.pro, exchange_id)()
+    for attr, value in config.items():
+        setattr(exchange, attr, value)
+    loops = [symbols_method_loop(exchange, method, symbols) if len(symbols) else method_loop(exchange, method) for method, symbols in methods.items()]
+    await gather(*loops)
+    await exchange.close()
+
+
+async def main():
+    keys = {
+        'okex': {
+            'apiKey': 'YOUR_API_KEY',
+            'secret': 'YOUR_SECRET',
+        },
+        'binance': {
+            'apiKey': 'YOUR_API_KEY',
+            'secret': 'YOUR_SECRET',
+        },
+    }
+    exchanges = {
+        'okex': {
+            'watchOrderBook': ['BTC/USDT', 'ETH/BTC', 'ETH/USDT'],
+            'watchTicker': ['BTC/USDT'],
+            'watchBalance': [],
+        },
+        'binance': {
+            'watchOrderBook': ['BTC/USDT', 'ETH/BTC'],
+            'watchTrades': [ 'ETH/BTC' ],
+            'watchBalance': [],
+        },
+    }
+    loops = [exchange_loop(exchange_id, methods, keys.get(exchange_id, {})) for exchange_id, methods in exchanges.items()]
+    await gather(*loops)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams.py b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams.py
new file mode 100644
index 0000000..ce840b3
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-streams.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import gather, run
+
+
+async def symbol_loop(exchange, symbol):
+    print('Starting the', exchange.id, 'symbol loop with', symbol)
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            now = exchange.milliseconds()
+            print(exchange.iso8601(now), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+async def exchange_loop(exchange_id, symbols):
+    print('Starting the', exchange_id, 'exchange loop with', symbols)
+    exchange = getattr(ccxt.pro, exchange_id)()
+    loops = [symbol_loop(exchange, symbol) for symbol in symbols]
+    await gather(*loops)
+    await exchange.close()
+
+
+async def main():
+    exchanges = {
+        'okex': ['BTC/USDT', 'ETH/BTC', 'ETH/USDT'],
+        'binance': ['BTC/USDT', 'ETH/BTC'],
+    }
+    loops = [exchange_loop(exchange_id, symbols) for exchange_id, symbols in exchanges.items()]
+    await gather(*loops)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-symbols-watch-trades.py b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-symbols-watch-trades.py
new file mode 100644
index 0000000..6e2ca25
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/many-exchanges-many-symbols-watch-trades.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+import ccxt.pro
+from asyncio import gather, run
+
+
+async def symbol_loop(exchange, symbol):
+    print('Starting the', exchange.id, 'symbol loop with', symbol)
+    while True:
+        try:
+            trades = await exchange.watch_trades(symbol)
+            now = exchange.milliseconds()
+            print(exchange.iso8601(now), exchange.id, symbol, len(trades), trades[-1]['price'])
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def exchange_loop(exchange_id, symbols):
+    print('Starting the', exchange_id, 'exchange loop with', symbols)
+    exchange = getattr(ccxt.pro, exchange_id)({
+        'newUpdates': True,  # https://github.com/ccxt/ccxt/wiki/ccxt.pro.manual#incremental-data-structures
+    })
+    loops = [symbol_loop(exchange, symbol) for symbol in symbols]
+    await gather(*loops)
+    await exchange.close()
+
+
+async def main():
+    exchanges = {
+        'okex': ['BTC/USDT', 'ETH/BTC', 'ETH/USDT'],
+        'binance': ['BTC/USDT', 'ETH/BTC'],
+    }
+    loops = [exchange_loop(exchange_id, symbols) for exchange_id, symbols in exchanges.items()]
+    await gather(*loops)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/many-exchanges.py b/docs/ccxt/examples/ccxt.pro/py/many-exchanges.py
new file mode 100644
index 0000000..b2dc690
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/many-exchanges.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+import asyncio
+import ccxt.pro
+
+
+async def loop(exchange_id, symbol):
+    exchange = getattr(ccxt.pro, exchange_id)()
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            now = exchange.milliseconds()
+            print(exchange.iso8601(now), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0])
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+    await exchange.close()
+
+
+async def main():
+    symbols = {
+        'kraken': 'BTC/USDT',
+        'binance': 'BTC/USDT',
+        'bitmex': 'XBT_USDT',
+    }
+    await asyncio.gather(*[loop(exchange_id, symbol) for exchange_id, symbol in symbols.items()])
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/multiple-exchanges-watch-orderbook-continuously.py b/docs/ccxt/examples/ccxt.pro/py/multiple-exchanges-watch-orderbook-continuously.py
new file mode 100644
index 0000000..0a0ac95
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/multiple-exchanges-watch-orderbook-continuously.py
@@ -0,0 +1,34 @@
+import ccxt.pro
+import asyncio
+import time
+
+
+async def watch_book(exchange, ticker):
+    last = None
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(ticker)
+            # TODO add timeout within a minute
+            # TODO add last
+            top_bid = orderbook['bids'][0][0]
+            if last != top_bid:
+                print(f'{int(time.time() * 1000)} top bid for celo on {exchange.name} is {top_bid}')
+            last = top_bid
+        except Exception as e:
+            print(f'{exchange.name} failed {type(e)} {e}')
+
+
+async def main():
+    exchange_ids = ['coinbasepro', 'okcoin', 'bittrex']
+    exchanges = [getattr(ccxt.pro, exchange_id)() for exchange_id in exchange_ids]
+    try:
+        done, pending = await asyncio.wait({watch_book(exchange, 'CELO/USD') for exchange in exchanges}, return_when=asyncio.FIRST_EXCEPTION)
+        for completed in done:
+            # trigger the exception here
+            completed.result()
+    except Exception as e:
+        print(f'closing all exchanges because of exception {type(e)} {e}')
+        await asyncio.gather(*[exchange.close() for exchange in exchanges])
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/okex-create-swap-order.py b/docs/ccxt/examples/ccxt.pro/py/okex-create-swap-order.py
new file mode 100644
index 0000000..a913673
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/okex-create-swap-order.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import run
+import ccxt.pro
+
+
+print('CCXT Pro Version: ', ccxt.pro.__version__)
+
+exchange = ccxt.pro.okex({
+    'apiKey': 'YOUR_API_KEY',
+    'secret': 'YOUR_API_SECRET',
+    'password': 'YOUR_API_PASSWORD',
+    'options': { 'defaultType': 'swap' },
+})
+
+
+async def main():
+    await exchange.load_markets()
+    # exchange.verbose = True  # uncomment for debugging
+
+    # https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-params
+    # https://www.okex.com/docs/en/#swap-swap---orders
+
+    symbol = 'BTC/USDT:USDT'
+    amount = 1  # how may contracts
+    price = None  # or your limit price
+    side = 'buy'  # or 'sell'
+    future_type = '1'  # 1 open long, 2 open short, 3 close long, 4 close short for futures
+    order_type = '4'  # 0 = limit order, 4 = market order
+
+    try:
+        # open long market price order
+        order = await exchange.create_order(symbol, 'market', side, amount, price, {'type': future_type})
+        # --------------------------------------------------------------------
+        # open long market price order
+        # const order = await exchange.create_order(symbol, type, side, amount, price, {'order_type': order_type})
+        # --------------------------------------------------------------------
+        # close short market price order
+        # const order = await exchange.create_order(symbol, 'market', side, amount, price, {'type': future_type, 'order_type': order_type})
+        # --------------------------------------------------------------------
+        # close short market price order
+        # const order = await exchange.create_order(symbol, '4', side, amount, price, {'order_type': order_type})
+        # ...
+        print(order)
+    except Exception as e:
+        print(type(e).__name__, str(e))
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance-with-params.py b/docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance-with-params.py
new file mode 100644
index 0000000..65276cf
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance-with-params.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+import asyncio
+import ccxt.pro as ccxt
+from pprint import pprint
+
+
+async def main():
+    exchange = ccxt.pro.okex({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+        # okex requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication
+        'password': 'YOUR_API_PASSWORD',
+        # comment it out if you don't want debug output
+        # this is for the demo purpose only (to show the communication)
+        'verbose': True,
+    })
+    while True:
+        try:
+            balance = await exchange.watch_balance({
+                # okex watch_balance requires a symbol or an instrument_id
+                'symbol': 'BTC/USDT',
+                'type': 'margin',
+            })
+            # it will print the balance update when the balance changes
+            # if the balance remains unchanged the exchange will not send it
+            pprint(balance)
+        except Exception as e:
+            print('watch_balance() failed')
+            print(e)
+            break
+    await exchange.close()
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance.py b/docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance.py
new file mode 100644
index 0000000..3b8f181
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/okex-watch-margin-balance.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+import asyncio
+import ccxt.pro as ccxt
+from pprint import pprint
+
+
+async def main():
+    exchange = ccxt.pro.okex({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+        # okex requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication
+        'password': 'YOUR_API_PASSWORD',
+        'options': {
+            'watchBalance': 'margin',
+        },
+        # comment it out if you don't want debug output
+        # this is for the demo purpose only (to show the communication)
+        'verbose': True,
+    })
+    while True:
+        try:
+            balance = await exchange.watch_balance({
+                # okex watch_balance requires a symbol or an instrument_id
+                'symbol': 'BTC/USDT',
+            })
+            # it will print the balance update when the balance changes
+            # if the balance remains unchanged the exchange will not send it
+            pprint(balance)
+        except Exception as e:
+            print('watch_balance() failed')
+            print(e)
+            break
+    await exchange.close()
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/okx-bbo-tbt.py b/docs/ccxt/examples/ccxt.pro/py/okx-bbo-tbt.py
new file mode 100644
index 0000000..ba3e0a5
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/okx-bbo-tbt.py
@@ -0,0 +1,36 @@
+import ccxt.pro
+from asyncio import run
+
+
+print('CCXT Pro version', ccxt.pro.__version__)
+
+
+async def main():
+    exchange = ccxt.pro.okx({
+        'options': {
+            'watchOrderBook': {
+                'depth': 'bbo-tbt',  # tick-by-tick best bidask
+            },
+        },
+    })
+    markets = await exchange.load_markets()
+    # exchange.verbose = True  # uncomment for debugging purposes if necessary
+    symbol = 'BTC/USDT'
+    while True:
+        try:
+            # -----------------------------------------------------------------
+            # use this:
+            # orderbook = await exchange.watch_order_book(symbol)
+            # print(orderbook['datetime'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+            # -----------------------------------------------------------------
+            # or this:
+            ticker = await exchange.watch_ticker(symbol)
+            print(ticker['datetime'], symbol, [ticker['ask'], ticker['askVolume']], [ticker['bid'], ticker['bidVolume']])
+            # -----------------------------------------------------------------
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/on-connected-user-hook.py b/docs/ccxt/examples/ccxt.pro/py/on-connected-user-hook.py
new file mode 100644
index 0000000..131f59c
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/on-connected-user-hook.py
@@ -0,0 +1,55 @@
+import ccxt.pro
+from asyncio import run, ensure_future
+from pprint import pprint
+
+
+print('CCXT Version:', ccxt.__version__)
+
+
+# on_connected() is called when a client connection is established
+# note that the exchange will reuse the same client connection
+# some exchanges might require two or more public/private connections
+# therefore on_connected() may be called more than once
+
+class MyBinance(ccxt.pro.binance):
+    def on_connected(self, client, message=None):
+        print('Connected to', client.url)
+        ensure_future(create_order(self))
+
+
+async def create_order(exchange):
+    symbol = 'BTC/USDT'
+    type = 'limit'
+    side = 'buy'
+    amount = 123.45  # change for your values
+    price = 54.321  # change for your values
+    params = {}
+    try:
+        order = await exchange.create_order(symbol, type, side, amount, price, params)
+        print('--------------------------------------------------------------')
+        print('create_order():')
+        pprint(order)
+    except Exception as e:
+        print(type(e).__name__, str(e))
+
+
+async def watch_orders(exchange):
+    while True:
+        try:
+            orders = await exchange.watch_orders()
+            print('--------------------------------------------------------------')
+            print('watch_orders():')
+            pprint(orders)
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+    await exchange.close()
+
+
+exchange = MyBinance({
+    'apiKey': 'YOUR_API_KEY',
+    'secret': 'YOUR_SECRET',
+})
+
+
+run(watch_orders(exchange))
diff --git a/docs/ccxt/examples/ccxt.pro/py/one-exchange-different-streams.py b/docs/ccxt/examples/ccxt.pro/py/one-exchange-different-streams.py
new file mode 100644
index 0000000..c2de428
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/one-exchange-different-streams.py
@@ -0,0 +1,35 @@
+import ccxt.pro
+import asyncio
+
+
+async def watch_order_book(exchange, symbol):
+    while True:
+        orderbook = await exchange.watch_order_book(symbol)
+        print(orderbook['datetime'], symbol, orderbook['asks'][0], orderbook['bids'][0])
+
+
+async def watch_trades(exchange, symbol):
+    while True:
+        trades = await exchange.watch_trades(symbol)
+        last = trades[-1]
+        print(last['datetime'], last['price'], last['amount'])
+
+
+async def main():
+    exchange = ccxt.pro.bitstamp()
+    await exchange.load_markets()
+    symbol = 'BTC/USD'
+    while True:
+        try:
+            loops = [
+                watch_order_book(exchange, symbol),
+                watch_trades(exchange, symbol)
+            ]
+            await asyncio.gather(*loops)
+        except Exception as e:
+            print(type(e).__name__, str(e))
+            break
+    await exchange.close()
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/one-exchange-many-streams.py b/docs/ccxt/examples/ccxt.pro/py/one-exchange-many-streams.py
new file mode 100644
index 0000000..ed537c4
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/one-exchange-many-streams.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import run
+import ccxt.pro
+
+async def loop(exchange, symbol):
+    await exchange.throttle(10)
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            now = exchange.milliseconds()
+            print(exchange.iso8601(now), symbol, orderbook['asks'][0], orderbook['bids'][0])
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            # break  # you can also break just this one loop if it fails
+
+async def main():
+    exchange = ccxt.pro.ftx()
+    symbols = ['BTC/USDT', 'ETH/USDT', 'ETH/BTC']
+    await asyncio.gather(*[loop(exchange, symbol) for symbol in symbols])
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/phemex-cancel-all-orders.py b/docs/ccxt/examples/ccxt.pro/py/phemex-cancel-all-orders.py
new file mode 100644
index 0000000..8cef2de
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/phemex-cancel-all-orders.py
@@ -0,0 +1,23 @@
+import ccxt.pro
+from asyncio import run
+from pprint import pprint
+
+print('CCXT Version:', ccxt.__version__)
+
+async def main():
+    exchange = ccxt.pro.phemex({
+        'apiKey': 'YOUR_API_KEY',
+        'secret': 'YOUR_SECRET',
+    })
+    markets = await exchange.load_markets()
+    # exchange.verbose = True  # uncomment for debugging purposes if necessary
+    try:
+        symbol = 'UNI/USDT'
+        response = await exchange.cancel_all_orders(symbol)
+        pprint(response)
+    except Exception as e:
+        print(type(e).__name__, str(e))
+    await exchange.close()
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/spot-vs-future-arbitrage-bitmart.py b/docs/ccxt/examples/ccxt.pro/py/spot-vs-future-arbitrage-bitmart.py
new file mode 100644
index 0000000..2a66513
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/spot-vs-future-arbitrage-bitmart.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+ 
+import asyncio
+import sys
+import os
+
+# ------------------------------------------------------------------------------
+
+root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+sys.path.append(root + '/python')
+
+# ------------------------------------------------------------------------------
+
+import ccxt.pro
+
+print('CCXT Version:', ccxt.pro.__version__)
+
+orderbooks = {}
+
+def handle_all_orderbooks(exchange, orderbooks, spot, future):
+    if spot in orderbooks and future in orderbooks: 
+        spot_order_book = orderbooks[spot]
+        future_order_book = orderbooks[future]
+        timestamp = exchange.milliseconds()
+        spot_lag = abs(timestamp - spot_order_book['timestamp']) if spot_order_book['timestamp'] else 10000
+        future_lag = abs(timestamp - future_order_book['timestamp']) if future_order_book['timestamp'] else 10000
+        if spot_lag >= 10000 or future_lag >= 10000:
+            print('Lag > 10 seconds')
+
+async def symbol_loop(exchange, symbol, spot, future):
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            orderbooks[symbol] = orderbook
+            print(exchange.id, '{:13s}'.format(symbol), orderbook['datetime'], orderbook['asks'][0], orderbook['bids'][0])
+            #
+            # here you can do what you want
+            # with the most recent versions of each orderbook you have so far
+            #
+            # you can also wait until all of them are available
+            # by just looking into all the orderbooks and counting them
+            #
+            # we just print them here to keep this example simple
+            #
+            handle_all_orderbooks(exchange, orderbooks, spot, future)
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def main():
+    spot = 'BTC/USDT'
+    future = 'BTC/USDT:USDT'
+    symbols = [ spot, future ]
+    exchange = ccxt.pro.bitmart()
+    loops = [
+        symbol_loop(exchange, spot, spot, future),
+        symbol_loop(exchange, future, spot, future),
+    ]
+    await asyncio.gather(*loops)
+    await exchange.close()
+
+
+asyncio.run(main())
+
diff --git a/docs/ccxt/examples/ccxt.pro/py/watch-all-symbols.py b/docs/ccxt/examples/ccxt.pro/py/watch-all-symbols.py
new file mode 100644
index 0000000..42b1e32
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/watch-all-symbols.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+import asyncio
+import ccxt.pro
+
+
+async def loop(exchange, symbol, n):
+    i = 0
+    while True:
+        try:
+            orderbook = await exchange.watch_order_book(symbol)
+            # print every 100th bidask to avoid wasting CPU cycles on printing
+            if not i % 100:
+                # i = how many updates there were in total
+                # n = the number of the pair to count subscriptions
+                now = exchange.milliseconds()
+                print(exchange.iso8601(now), n, symbol, i, orderbook['asks'][0], orderbook['bids'][0])
+            i += 1
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            # break  # you can also break just this one loop if it fails
+
+
+async def main():
+    exchange = ccxt.pro.kraken()
+    await exchange.load_markets()
+    markets = list(exchange.markets.values())
+    symbols = [market['symbol'] for market in markets if not market['darkpool']]
+    await asyncio.gather(*[loop(exchange, symbol, n) for n, symbol in enumerate(symbols)])
+    await exchange.close()
+
+
+
+asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/watch-custom-exchange-specific-streams.py b/docs/ccxt/examples/ccxt.pro/py/watch-custom-exchange-specific-streams.py
new file mode 100644
index 0000000..48f3d10
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/watch-custom-exchange-specific-streams.py
@@ -0,0 +1,45 @@
+import asyncio
+import ccxt.pro
+
+
+class MyBinance(ccxt.pro.binance):
+
+    def handle_mini_ticker(self, client, message):
+        market_id = self.safe_string_lower(message, 's')
+        message_hash = market_id + '@miniTicker'
+        client.resolve(message, message_hash)
+
+    def handle_message(self, client, message):
+        handlers = {
+            '24hrMiniTicker': self.handle_mini_ticker,
+            # add other custom handlers here
+        }
+        e = self.safe_string(message, 'e')
+        method = self.safe_value(handlers, e)
+        if method:
+            return method(client, message)
+        else:
+            return super(MyBinance, self).handle_message(client, message)
+
+
+async def main():
+    exchange = MyBinance({
+        'enableRateLimit': False,
+        'options': {
+            'defaultType': 'future'
+        }
+    })
+    await exchange.load_markets()
+    # exchange.verbose = True  # uncomment for debugging purposes
+    market = exchange.market('BTC/USDT')
+    message_hash = market['lowercaseId'] + '@miniTicker'
+    while True:
+        try:
+            print(await exchange.watch_public(message_hash))
+        except Exception as e:
+            print(type(e).__name__, str(e))
+    await exchange.close()
+
+
+if __name__ == '__main__':
+    asyncio.run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/watch-many-exchanges-many-tickers.py b/docs/ccxt/examples/ccxt.pro/py/watch-many-exchanges-many-tickers.py
new file mode 100644
index 0000000..1e41766
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/watch-many-exchanges-many-tickers.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import run, gather
+import ccxt.pro
+
+
+print('CCXT Version:', ccxt.__version__)
+
+
+async def exchange_loop(exchange_id, symbols):
+    exchange = getattr(ccxt.pro, exchange_id)()
+    markets = await exchange.load_markets()
+    await gather(*[watch_ticker_loop(exchange, symbol) for symbol in symbols])
+    await exchange.close()
+
+
+async def watch_ticker_loop(exchange, symbol):
+    # exchange.verbose = True  # uncomment for debugging purposes if necessary
+    while True:
+        try:
+            ticker = await exchange.watch_ticker(symbol)
+            now = exchange.milliseconds()
+            print(exchange.iso8601(now), exchange.id, symbol, 'bid:', ticker['bid'], 'ask:', ticker['ask'], 'last:', ticker['last'], 'on', ticker['datetime'])
+        except Exception as e:
+            print(str(e))
+            # raise e  # uncomment to break all loops in case of an error in any one of them
+            break  # you can break just this one loop if it fails
+
+
+async def main():
+    exchanges = {
+        'binance': [ 'BTC/USDT', 'ETH/USDT' ],
+        'ftx': [ 'BTC/USD', 'ETH/USD' ],
+    }
+    loops = [exchange_loop(exchange_id, symbols) for exchange_id, symbols in exchanges.items()]
+    await gather(*loops)
+
+
+run(main())
diff --git a/docs/ccxt/examples/ccxt.pro/py/watch-ticker-to-csv.py b/docs/ccxt/examples/ccxt.pro/py/watch-ticker-to-csv.py
new file mode 100644
index 0000000..980b093
--- /dev/null
+++ b/docs/ccxt/examples/ccxt.pro/py/watch-ticker-to-csv.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+from asyncio import gather, run
+import ccxt.pro
+from pprint import pprint
+
+
+async def watch_ticker_continuously(exchange, symbol):
+    filename = exchange.id + '-' + symbol.replace('/', '-') + '.csv'
+    print('Watching', exchange.id, symbol, filename)
+    keys = ['index', 'exchange', 'symbol', 'timestamp', 'open', 'high', 'low', 'close', 'baseVolume']
+    with open(filename, 'w') as file:
+        file.write(','.join(keys) + "\n")
+    index = 0
+    while True:
+        try:
+            ticker = await exchange.watch_ticker(symbol)
+            values = [str(index), exchange.id] + [str(ticker[key]) for key in keys[2:]]
+            print(*values)
+            with open(filename, 'a') as file:
+                file.write(','.join(values) + "\n")
+            index += 1
+        except Exception as e:
+            print(e)
+
+
+async def watch_tickers_continuously(exchange_id, overrides, symbols):
+    exchange_class = getattr(ccxt.pro, exchange_id)
+    exchange = exchange_class(overrides)
+    coroutines = [watch_ticker_continuously(exchange, symbol) for symbol in symbols]
+    await gather(*coroutines)
+    await exchange.close()
+
+
+async def main():
+    exchanges = {
+        'binance': {'options': {'defaultType': 'future'}},
+        'huobipro': {}
+    }
+    symbols = ['BTC/USDT', 'ETH/USDT', 'LTC/USDT', 'XRP/USDT', 'BCH/USDT']
+    coroutines = [watch_tickers_continuously(exchange_id, exchanges[exchange_id], symbols) for exchange_id in exchanges.keys()]
+    return await gather(*coroutines)
+
+
+run(main())
diff --git a/docs/ccxt/examples/html/basic-cors-proxy.html b/docs/ccxt/examples/html/basic-cors-proxy.html
new file mode 100644
index 0000000..3fcaa88
--- /dev/null
+++ b/docs/ccxt/examples/html/basic-cors-proxy.html
@@ -0,0 +1,46 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+
+
+

Hello, CCXT!

+

+
+
diff --git a/docs/ccxt/examples/html/basic-inheritance.html b/docs/ccxt/examples/html/basic-inheritance.html
new file mode 100644
index 0000000..5b49712
--- /dev/null
+++ b/docs/ccxt/examples/html/basic-inheritance.html
@@ -0,0 +1,47 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+    
+
+
+

Hello, CCXT!

+

+
+
\ No newline at end of file
diff --git a/docs/ccxt/examples/html/basic-poller.html b/docs/ccxt/examples/html/basic-poller.html
new file mode 100644
index 0000000..66b75b4
--- /dev/null
+++ b/docs/ccxt/examples/html/basic-poller.html
@@ -0,0 +1,52 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+
+
+

Hello, CCXT!

+

+
+
diff --git a/docs/ccxt/examples/html/basic-rate-limiting.html b/docs/ccxt/examples/html/basic-rate-limiting.html
new file mode 100644
index 0000000..dedad15
--- /dev/null
+++ b/docs/ccxt/examples/html/basic-rate-limiting.html
@@ -0,0 +1,49 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+
+
+

Hello, CCXT!

+

+
+
diff --git a/docs/ccxt/examples/html/basic.html b/docs/ccxt/examples/html/basic.html
new file mode 100644
index 0000000..ecae2e9
--- /dev/null
+++ b/docs/ccxt/examples/html/basic.html
@@ -0,0 +1,43 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+
+
+

Hello, CCXT!

+

+
+
diff --git a/docs/ccxt/examples/html/binance-cors-proxy.html b/docs/ccxt/examples/html/binance-cors-proxy.html
new file mode 100644
index 0000000..b7dee13
--- /dev/null
+++ b/docs/ccxt/examples/html/binance-cors-proxy.html
@@ -0,0 +1,28 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+
+
+

Hello, CCXT!

+

+
+
diff --git a/docs/ccxt/examples/html/bitmex-browser-cors-proxy.js b/docs/ccxt/examples/html/bitmex-browser-cors-proxy.js
new file mode 100644
index 0000000..7dc2c20
--- /dev/null
+++ b/docs/ccxt/examples/html/bitmex-browser-cors-proxy.js
@@ -0,0 +1,7 @@
+// JavaScript CORS Proxy
+// Save this in a file like cors.js and run with `node cors [port]`
+// It will listen for your requests on the port you pass in command line or port 8080 by default
+const port = (process.argv.length > 2) ? parseInt (process.argv[2]) : 8080 // default
+require ('cors-anywhere').createServer ({
+    setHeaders: { 'origin': 'https://www.bitmex.com' }
+}).listen (port, '0.0.0.0')
diff --git a/docs/ccxt/examples/html/bitmex-cors.html b/docs/ccxt/examples/html/bitmex-cors.html
new file mode 100644
index 0000000..79a5392
--- /dev/null
+++ b/docs/ccxt/examples/html/bitmex-cors.html
@@ -0,0 +1,46 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+
+
+

Hello, CCXT!

+

+
+
diff --git a/docs/ccxt/examples/html/tradingview-charts.html b/docs/ccxt/examples/html/tradingview-charts.html
new file mode 100644
index 0000000..7aefb87
--- /dev/null
+++ b/docs/ccxt/examples/html/tradingview-charts.html
@@ -0,0 +1,61 @@
+
+
+
+    CCXT Basic example for the browser
+    
+    
+    
+
+
+
+
diff --git a/docs/ccxt/examples/html/webworker/index.html b/docs/ccxt/examples/html/webworker/index.html
new file mode 100644
index 0000000..f9c4684
--- /dev/null
+++ b/docs/ccxt/examples/html/webworker/index.html
@@ -0,0 +1,97 @@
+
+
+    
+        

CCXT running on a Webworker example

+

This example uses a web worker to continuously call fetchTicker on a user-defined exchange, symbol and interval. Then, the web worker reaches back with the results.

+

Parameters

+ +

+ +

+ +

+ + +

Received Results:

+ + + + + + + + + + + + + +
SymbolLast PriceBase VolumeExchange TsLocal Ts
+ + + + \ No newline at end of file diff --git a/docs/ccxt/examples/html/webworker/worker.js b/docs/ccxt/examples/html/webworker/worker.js new file mode 100644 index 0000000..9c897e9 --- /dev/null +++ b/docs/ccxt/examples/html/webworker/worker.js @@ -0,0 +1,43 @@ +self.importScripts('https://unpkg.com/ccxt@1.79.2/dist/ccxt.browser.js'); + +console.log("Loaded ccxt version:", self.ccxt.version); + +var exchangeInstance = undefined; + +// handler of received messages +self.onmessage = async function handler(msg) { + await handleMessageFromMain(msg) +} + +// get messages from the main script +async function handleMessageFromMain(msg) { + console.log(msg.data); + var [exchange, symbol, interval] = msg.data; + console.log('Worker received:', symbol,exchange, interval) + interval = parseInt(interval) + await processTicker(symbol, exchange) + // schedule process ticker execution + setInterval (async () => { + await processTicker(symbol, exchange) + }, interval) +} + +async function processTicker(symbol, exchangeId) { + if (exchangeInstance === undefined) { + exchangeInstance = new ccxt[exchangeId] + } + var result = await fetchTicker(symbol) + var symbol = result['symbol'] + var last = result['last'] + var timestamp = result['timestamp'] + var baseVolume = result['baseVolume'] + var ourTimestamp = Date.now() + // send the data back to the main script + postMessage([symbol, last, baseVolume, timestamp, ourTimestamp]); +} + +async function fetchTicker(symbol){ + // use ccxt to fetch ticker info + var result = await exchangeInstance.fetchTicker(symbol) + return result; +} \ No newline at end of file diff --git a/docs/ccxt/examples/js/README.md b/docs/ccxt/examples/js/README.md new file mode 100644 index 0000000..c01e149 --- /dev/null +++ b/docs/ccxt/examples/js/README.md @@ -0,0 +1,15 @@ +# CCXT JavaScript Examples + +These examples might require the following super-useful high-quality Node.js modules by [xpl](https://github.com/xpl): + +- [ansicolor](https://github.com/xpl/ansicolor): A quality JavaScript library for the ANSI color/style management ([ansicolor @ npm](https://npmjs.com/package/ansicolor)) +- [as-table](https://github.com/xpl/as-table): A simple function that prints objects as ASCII tables ([as-table @ npm](https://npmjs.com/package/as-table)) +- [ololog](https://github.com/xpl/ololog): Platform-agnostic logging with blackjack and hookers ([ololog @ npm](https://npmjs.com/package/ololog)) + +All of the modules above are installed with the ccxt library devDependencies by npm automatically. + +To run the ccxt JavaScript examples from any folder type in console: + +```shell +node path/to/example.js # substitute for actual filename here +``` diff --git a/docs/ccxt/examples/js/advanced-error-handling.js b/docs/ccxt/examples/js/advanced-error-handling.js new file mode 100644 index 0000000..7b75ba3 --- /dev/null +++ b/docs/ccxt/examples/js/advanced-error-handling.js @@ -0,0 +1,39 @@ +"use strict"; + +const ccxt = require ('../../ccxt.js'); + +// instantiate the exchange +let exchange = new ccxt.coinbasepro ({ + 'apiKey': 'XXXXXXXXXXXXXX', + 'secret': 'YYYYYYYYYYYYYY', +}); + +async function checkOrders(){ + try { + // fetch orders + let orders = await exchange.fetchOrders ('BTC/USDT'); + // output the result + console.log (exchange.id, 'fetched orders', orders); + } catch (e) { + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + console.log ('[DDoS Protection] ' + e.message); + } else if (e instanceof ccxt.RequestTimeout) { + console.log ('[Request Timeout] ' + e.message); + } else if (e instanceof ccxt.AuthenticationError) { + console.log ('[Authentication Error] ' + e.message); + } else if (e instanceof ccxt.ExchangeNotAvailable) { + console.log ('[Exchange Not Available Error] ' + e.message); + } else if (e instanceof ccxt.ExchangeError) { + console.log ('[Exchange Error] ' + e.message); + } else if (e instanceof ccxt.NetworkError) { + console.log ('[Network Error] ' + e.message); + } else { + // you can throw it if you want to stop the execution + // console.log ('[Exception ' + e.constructor.name + '] ' + e.message); + throw e; + } + } +} + +// for demonstrational purposes, we use 1000 ms interval +setInterval(checkOrders, 1000); diff --git a/docs/ccxt/examples/js/aggregate-orderbook.js b/docs/ccxt/examples/js/aggregate-orderbook.js new file mode 100644 index 0000000..c04eb1e --- /dev/null +++ b/docs/ccxt/examples/js/aggregate-orderbook.js @@ -0,0 +1,54 @@ + + +import ccxt from '../../js/ccxt.js'; + +const aggregateOrderBookSide = function (orderbookSide, precision = undefined) { + const result = [] + const amounts = {} + for (let i = 0; i < orderbookSide.length; i++) { + const ask = orderbookSide[i] + let price = ask[0] + if (precision !== undefined) { + price = ccxt.decimalToPrecision (price, ccxt.ROUND, precision, ccxt.TICK_SIZE) + } + amounts[price] = (amounts[price] || 0) + ask[1] + } + Object.keys (amounts).forEach (price => { + result.push ([ + parseFloat (price), + amounts[price] + ]) + }) + return result +} + +const aggregateOrderBook = function (orderbook, precision = undefined) { + let asks = aggregateOrderBookSide(orderbook['asks'], precision) + let bids = aggregateOrderBookSide(orderbook['bids'], precision) + return { + 'asks': ccxt.sortBy (asks, 0), + 'bids': ccxt.sortBy (bids, 0, true), + 'timestamp': orderbook['timestamp'], + 'datetime': orderbook['datetime'], + 'nonce': orderbook['nonce'], + }; +} + +;(async () => { + + const exchange = new ccxt.coinbasepro() + + await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for verbose debug output + + // level 2 (default) + const orderbook = await exchange.fetchOrderBook('BTC/USD') + + // or level 3 + // const orderbook = await exchange.fetchOrderBook('BTC/USD', undefined, { 'level': 3 }) + + const step = 0.5 // 0.01, 0.1, 0.5, 1.0, 2.5, 5.0, 10.0 + console.log (aggregateOrderBook (orderbook, step)) + +})(); \ No newline at end of file diff --git a/docs/ccxt/examples/js/apex-example.js b/docs/ccxt/examples/js/apex-example.js new file mode 100644 index 0000000..4577221 --- /dev/null +++ b/docs/ccxt/examples/js/apex-example.js @@ -0,0 +1,97 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.apex({ + 'apiKey': 'your api Key', + 'secret': 'your api secret', + 'walletAddress': 'your eth address', + 'options': { + 'accountId': 'your account id', + 'passphrase': 'your api passphrase', + 'seeds': 'your zklink omni seed', + 'brokerId': '', + }, + }); + exchange.setSandboxMode (true) + const fetchTime = await exchange.fetchTime(); + console.log(fetchTime); + //const transfer = await exchange.transfer('USDT', 1.1); + //console.log(transfer); + //const transferFromContract = await exchange.transfer('USDT', 1.2, 'contract', 'spot'); + //console.log(transferFromContract); + //const fetchCurrencies = await exchange.fetchCurrencies(); + //console.log(fetchCurrencies); + //const fetchBalance = await exchange.fetchBalance(); + //console.log(fetchBalance); + //const fetchMarkets = await exchange.fetchMarkets(); + //console.log(fetchMarkets); + //const fetchTicker = await exchange.fetchTicker('BTC-USDT'); + //console.log(fetchTicker); + //const fetchTickers = await exchange.fetchTickers(); + //console.log(fetchTickers); + //const fetchTrades = await exchange.fetchTrades('BTC-USDT'); + //console.log(fetchTrades); + //const fetchOHLCV = await exchange.fetchOHLCV('BTC-USDT','1m', undefined, 200); + //console.log(fetchOHLCV); + //const fechOrderBook = await exchange.fetchOrderBook('BTC-USDT'); + //console.log(fechOrderBook); + //const fetchOpenInterest = await exchange.fetchOpenInterest('BTC-USDT'); + //console.log(fetchOpenInterest); + + //const fetchTransfers = await exchange.fetchTransfers(); + //console.log(fetchTransfers); + //const fetchTransfer = await exchange.fetchTransfer(); + //console.log(fetchTransfer); + + //const createOrderRes1 = await exchange.createOrder('BTC-USDT', 'LIMIT', 'SELL', 0.001, 100000, {'reduceOnly':true}); + //console.log(createOrderRes1); + const createOrderRes1 = await exchange.createOrder('BTC-USDT', 'STOP_LIMIT', 'BUY', 0.001, 100000, {'triggerPriceType':'INDEX', 'triggerPrice':'10100'}); + console.log(createOrderRes1); + + const fetchOpenOrders = await exchange.fetchOpenOrders(); + console.log(fetchOpenOrders); + //const fetchOpenOrder = await exchange.fetchOrder(undefined,undefined,{"clientOrderId":'apexomni-615910568987983964-1741322302826-253839'}); + //console.log(fetchOpenOrder); + //const cancelOrder = await exchange.cancelOrder('685707935650677596'); + //console.log(cancelOrder); + //const cancelOrder1 = await exchange.cancelOrder(undefined,undefined,{"clientOrderId":'apexomni-615910568987983964-1741324574601-908656'}); + //console.log(cancelOrder1); + //const cancelAllOrders = await exchange.cancelAllOrders(); + //console.log(cancelAllOrders); + + //const setLeverage = await exchange.setLeverage(5,'BTC-USDT'); + //console.log(setLeverage); + + //const fetchPositions = await exchange.fetchPositions(); + //console.log(fetchPositions); + + //const fetchOrder = await exchange.fetchOrder('685781264227107164'); + //console.log(fetchOrder); + + //const fetchOrderTrades = await exchange.fetchOrderTrades('685781264227107164'); //{"clientOrderId":'apexomni-615910568987983964-1741339789276-640091'} + //console.log(fetchOrderTrades); + + + let since = exchange.milliseconds () - 86400000*1; // -1 day from now + let allTrades = []; + let page = 0; + while (since < exchange.milliseconds ()) { + const params = { + 'page': page, // exchange-specific non-unified parameter name + } + const trades = await exchange.fetchFundingHistory ('BTC-USDT', since, 20, params) + if (trades.length) { + allTrades = allTrades.concat (trades) + page++ + } else { + break + } + } + allTrades = exchange.sortBy(allTrades, 'timestamp'); + + + const createOrderRes = await exchange.createOrder('BTC-USDT', 'LIMIT', 'BUY', 0.001, 70000, {'reduceOnly':true,'postOnly':true}); + console.log(createOrderRes); + console.log('end'); +} +await example(); diff --git a/docs/ccxt/examples/js/arbitrage-pairs.js b/docs/ccxt/examples/js/arbitrage-pairs.js new file mode 100644 index 0000000..fafeced --- /dev/null +++ b/docs/ccxt/examples/js/arbitrage-pairs.js @@ -0,0 +1,130 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import fs from 'fs'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'), keysGlobal = 'keys.json', keysLocal = 'keys.local.json', keysFile = fs.existsSync (keysLocal) ? keysLocal : (fs.existsSync (keysGlobal) ? keysGlobal : false), config = keysFile ? require ('../../' + keysFile) : {}; + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'id1'.green, 'id2'.yellow, 'id3'.blue, '...') + printSupportedExchanges () +} + +let printExchangeSymbolsAndMarkets = function (exchange) { + log (getExchangeSymbols (exchange)) + log (getExchangeMarketsTable (exchange)) +} + +let getExchangeMarketsTable = (exchange) => { + return asTable.configure ({ delimiter: ' | ' }) (Object.values (markets)) +} + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)); + +let proxies = [ + '', // no proxy by default + 'https://crossorigin.me/', + 'https://cors-anywhere.herokuapp.com/', +] + +;(async function main () { + + if (process.argv.length > 3) { + + let ids = process.argv.slice (2) + let exchanges = {} + + log (ids.join (', ').yellow) + + // load all markets from all exchanges + for (let id of ids) { + + let settings = config[id] || {} + + // instantiate the exchange by id + let exchange = new ccxt[id] (ccxt.extend ({ + // verbose, + // 'proxy': 'https://cors-anywhere.herokuapp.com/', + }, settings)) + + // save it in a dictionary under its id for future use + exchanges[id] = exchange + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + // basic round-robin proxy scheduler + let currentProxy = 0 + let maxRetries = proxies.length + + for (let numRetries = 0; numRetries < maxRetries; numRetries++) { + + try { // try to load exchange markets using current proxy + + exchange.proxy = proxies[currentProxy] + await exchange.loadMarkets () + + } catch (e) { // rotate proxies in case of connectivity errors, catch all other exceptions + + // swallow connectivity exceptions only + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + log.bright.yellow ('[DDoS Protection Error] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow ('[Timeout Error] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow ('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow ('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow ('[Exchange Error] ' + e.message) + } else { + throw e; // rethrow all other exceptions + } + + // retry next proxy in round-robin fashion in case of error + currentProxy = ++currentProxy % proxies.length + } + } + + log (id.green, 'loaded', exchange.symbols.length.toString ().green, 'markets') + } + + log ('Loaded all markets'.green) + + // get all unique symbols + let uniqueSymbols = ccxt.unique (ccxt.flatten (ids.map (id => exchanges[id].symbols))) + + // filter out symbols that are not present on at least two exchanges + let arbitrableSymbols = uniqueSymbols + .filter (symbol => + ids.filter (id => + (exchanges[id].symbols.indexOf (symbol) >= 0)).length > 1) + .sort ((id1, id2) => (id1 > id2) ? 1 : ((id2 > id1) ? -1 : 0)) + + // print a table of arbitrable symbols + let table = arbitrableSymbols.map (symbol => { + let row = { symbol } + for (let id of ids) + if (exchanges[id].symbols.indexOf (symbol) >= 0) + row[id] = id + return row + }) + + log (asTable.configure ({ delimiter: ' | ' }) (table)) + + } else { + + printUsage () + + } + + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/basic-chart.js b/docs/ccxt/examples/js/basic-chart.js new file mode 100644 index 0000000..7f527ad --- /dev/null +++ b/docs/ccxt/examples/js/basic-chart.js @@ -0,0 +1,29 @@ + + +import ccxt from '../../js/ccxt.js'; +import asciichart from 'asciichart'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async function main () { + + // experimental, not yet implemented for all exchanges + // your contributions are welcome ;) + + const index = 4 // [ timestamp, open, high, low, close, volume ] + const ohlcv = await new ccxt.okcoin ().fetchOHLCV ('BTC/USD', '15m') + const lastPrice = ohlcv[ohlcv.length - 1][index] // closing price + const series = ohlcv.map (x => x[index]) // closing price + const bitcoinRate = ('₿ = $' + lastPrice).green + const chart = asciichart.plot (series, { height: 15, padding: ' ' }) + log.yellow ("\n" + chart, bitcoinRate, "\n") + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/basic-orderbook-polling.js b/docs/ccxt/examples/js/basic-orderbook-polling.js new file mode 100644 index 0000000..5a66f4c --- /dev/null +++ b/docs/ccxt/examples/js/basic-orderbook-polling.js @@ -0,0 +1,13 @@ +import ccxt from '../../js/ccxt.js'; + +const id = 'huobipro', exchange = new ccxt[id] ({ enableRateLimit: true }), symbol = 'ETH/BTC';(async function main () { + + await exchange.loadMarkets () + + for (let i = 0; i < 2000; i++) { + + const orderbook = await exchange.fetchOrderBook (symbol) + console.log (new Date (), i, symbol, orderbook.asks[0], orderbook.bids[0]) + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/bcc-vs-bch.js b/docs/ccxt/examples/js/bcc-vs-bch.js new file mode 100644 index 0000000..6efb5f0 --- /dev/null +++ b/docs/ccxt/examples/js/bcc-vs-bch.js @@ -0,0 +1,115 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog' +import config from '../../keys.json'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)) + +let proxies = [ + '', // no proxy by default + 'https://crossorigin.me/', + 'https://cors-anywhere.herokuapp.com/', +] + +;(async function main () { + + let ids = ccxt.exchanges + let exchanges = {} + + // instantiate all exchanges + ccxt.exchanges.forEach (id => { + if (id in ccxt) + exchanges[id] = new (ccxt)[id] ({ + verbose: false, + substituteCommonCurrencyCodes: true, + }) + }) + + // set up api keys appropriately + for (let id in config) { + if (id in exchanges) + for (let key in config[id]) + exchanges[id][key] = config[id][key] + } + + log (ids.join (', ').yellow) + + // load all markets from all exchanges + + await Promise.all (ids.map (async id => { + + let exchange = exchanges[id] + + // basic round-robin proxy scheduler + let currentProxy = 0 + let maxRetries = proxies.length + + for (let numRetries = 0; numRetries < maxRetries; numRetries++) { + + try { // try to load exchange markets using current proxy + + exchange.proxy = proxies[currentProxy] + await exchange.loadMarkets () + + } catch (e) { // rotate proxies in case of connectivity errors, catch all other exceptions + + // swallow connectivity exceptions only + if ((e instanceof ccxt.DDoSProtection) || e.message.includes ('ECONNRESET')) { + log.bright.yellow (exchange.id + ' [DDoS Protection]') + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id + ' [Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id + ' [Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id + ' [Exchange Not Available] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id + ' [Exchange Error] ' + e.message) + } else { + throw e; // rethrow all other exceptions + } + + // retry next proxy in round-robin fashion in case of error + currentProxy = ++currentProxy % proxies.length + } + } + + if (exchange.symbols) + log (id.green, 'loaded', exchange.symbols.length.toString ().green, 'markets') + + })) + + log ('Loaded all markets'.green) + + let table = ccxt.exchanges.map (id => { + console.log (id) + let exchange = exchanges[id] + if (exchange.currencies) { + let hasBCC = exchange.currencies.includes ('BCC') + let hasBCH = exchange.currencies.includes ('BCH') + let hasBoth = (hasBCC && hasBCH) + return { + id, + 'BCC': hasBoth ? id.green : (hasBCC ? id.yellow : ''), + 'BCH': hasBCH ? id.green : '', + } + } else { + return { + 'id': id.red, + 'BCC': '', + 'BCH': '', + } + } + }) + + log (asTable.configure ({ delimiter: ' | ' }) (table)) + + process.exit () + +}) () diff --git a/docs/ccxt/examples/js/benchmark.js b/docs/ccxt/examples/js/benchmark.js new file mode 100644 index 0000000..8f7d42c --- /dev/null +++ b/docs/ccxt/examples/js/benchmark.js @@ -0,0 +1,104 @@ +import { spawn } from 'child_process'; +import asTable from 'as-table'; +import ccxt, { version } from '../../js/ccxt.js'; +const stats = (times) => { + // calculate statistics + const sum = times.reduce((a, b) => a + b, 0); + const avg = Math.round(sum / times.length); + const min = Math.min(...times); + const max = Math.max(...times); + times.sort((a, b) => a - b); + const median = times.length % 2 === 0 ? (times[times.length / 2 - 1] + times[times.length / 2]) / 2 : times[Math.floor(times.length / 2)]; + return { min, 'average': avg, max, median, 'iterations': times.length }; +}; +async function benchmark(exchangeId, method, args, verbose = false, minIterations = 10, argsv = '') { + const exchange = new ccxt.pro[exchangeId]({}); + const languages = ['js', 'py', 'php', 'cs']; + const commands = languages.map((language) => ({ + 'language': language, + 'method': method, + 'command': `npm run cli.${language} ${exchangeId} ${method} ${args.join(' ')} -- ${argsv} --poll`, + })); + const wsMethod = method + 'Ws'; + if (exchange.has[wsMethod]) { + const wsCommands = languages.map((language) => ({ + 'language': language, + 'method': wsMethod, + 'command': `npm run cli.${language} ${exchangeId} ${wsMethod} ${args.join(' ')} -- ${argsv} --poll`, + })); + commands.push(...wsCommands); + } + const regex = /iteration (\d+) passed in (\d+) ms/g; + async function runCommand(command) { + if (verbose) { + console.log(exchange.iso8601(new Date().getTime()), ' running command:', command); + } + return new Promise((resolve, reject) => { + const [cmd, ...args] = command.split(' '); + const child = spawn(cmd, args); + const matches = []; + const language = command.slice(8, 15); + child.stdout.on('data', (data) => { + const message = data.toString(); + matches.push(...Array.from(message.matchAll(regex))); + const match = matches[matches.length - 1]; + if (match && match[1] && match[2]) { + const iteration = parseInt(match[1]); + const time = parseInt(match[2]); + if (iteration <= minIterations) { + if (verbose) { + console.log(exchange.iso8601(new Date().getTime()), `${language} iteration ${iteration} passed in ${time} ms`); + } + } + else { + const times = matches.map((m) => parseInt(m[2])); + child.kill(); + if (verbose) { + console.log(exchange.iso8601(new Date().getTime()), `killed process - ${language} iteration ${iteration} passed in ${time} ms`); + } + resolve({ times }); + } + } + }); + child.stderr.on('data', (data) => { + const message = data.toString(); + console.error(exchange.iso8601(new Date().getTime()), `command ${command} failed. stderr: ${message}`); + const times = matches.map((m) => parseInt(m[2])); + resolve({ times }); + }); + child.on('close', (code) => { + const times = matches.map((m) => parseInt(m[2])); + resolve({ times }); + console.log(exchange.iso8601(new Date().getTime()), `${language} child process exited with code ${code}`); + }); + child.on('error', (err) => { + console.error(exchange.iso8601(new Date().getTime()), `command ${command} failed. error: ${err}`); + reject(err); + }); + }); + } + const benchmarks = []; + const results = await Promise.all(commands.map((c) => runCommand(c.command))); + for (let i = 0; i < results.length; i++) { + const result = results[i]; + benchmarks.push({ 'language': commands[i].language, 'method': commands[i].method, ...stats(result.times) }); + } + if (verbose) { + const rawResults = results.map((r, i) => ({ 'language': commands[i].language, 'method': commands[i].method, ...stats(r.times), 'times': r.times })); + console.log(rawResults); + } + console.log(asTable(benchmarks)); +} +const [_, , exchangeId, methodName, ...params] = process.argv.filter((x) => !x.startsWith('--')); +const verbose = process.argv.includes('--verbose'); +const minIterationsString = process.argv.find((x) => x.startsWith('--min-iterations='))?.slice(18); +const minIterations = minIterationsString ? parseInt(minIterationsString) : 10; +const argsv = process.argv.filter((x) => x.startsWith('--') && !x.startsWith('--min-iterations')).join(' '); +console.log((new Date()).toISOString()); +console.log('Node.js:', process.version); +console.log('CCXT v' + version); +const start = new Date().getTime(); +await benchmark(exchangeId, methodName, params, verbose, minIterations, argsv); +const end = new Date().getTime(); +console.log((new Date().toISOString()), 'Total time:', end - start, 'ms'); +process.exit(0); diff --git a/docs/ccxt/examples/js/binance-fetch-all-deposits.js b/docs/ccxt/examples/js/binance-fetch-all-deposits.js new file mode 100644 index 0000000..715e56b --- /dev/null +++ b/docs/ccxt/examples/js/binance-fetch-all-deposits.js @@ -0,0 +1,45 @@ + + +import ccxt from '../../js/ccxt.js'; + +(async function main () { + + const exchange = new ccxt.binance ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) + + await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging + + const ninetyDays = 90 * 24 * 60 * 60 * 1000; + let startTime = exchange.parse8601 ('2018-01-01T00:00:00') + const now = exchange.milliseconds () + const currencyCode = undefined // any currency + + let allTransactions = [] + + while (startTime < now) { + + const endTime = startTime + ninetyDays + + const transactions = await exchange.fetchDeposits (currencyCode, startTime, undefined, { + 'endTime': endTime, + }) + if (transactions.length) { + const lastTransaction = transactions[transactions.length - 1] + startTime = lastTransaction['timestamp'] + 1 + allTransactions = allTransactions.concat (transactions) + } else { + startTime = endTime; + } + } + + console.log ('Fetched', allTransactions.length, 'transactions') + for (let i = 0; i < allTransactions.length; i++) { + const transaction = allTransactions[i] + console.log (i, transaction['datetime'], transaction['txid'], transaction['currency'], transaction['amount']) + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-async-await.js b/docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-async-await.js new file mode 100644 index 0000000..3c08e58 --- /dev/null +++ b/docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-async-await.js @@ -0,0 +1,34 @@ +'use strict'; + +const ccxt = require ('../../js/ccxt.js') + +console.log('CCXT Version:', ccxt.version) + +async function symbolLoop (exchange, symbol, timeframe) { + while (true) { + try { + const ohlcvs = await exchange.fetchOHLCV (symbol, timeframe) + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, ohlcvs.length, 'OHLCV candles received') + // await exchange.sleep (60 * 1000) // sleep if necessary, though not required + } catch (e) { + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, e.constructor.name, e.message) + } + } +} + +async function main () { + const exchange = new ccxt.binance () + await exchange.loadMarkets () + // exchange.verbose = true // uncomment for debugging purposes if necessary + const symbols = [ + 'BTC/USDT', // unified symbols used here as opposed to exchange-specific market ids + 'ETH/USDT', // more about unified symbols vs exchange-specific ids here: + 'ADA/USDT', // https://github.com/ccxt/ccxt/wiki/Manual#markets + ] + const timeframe = '1m' + const loops = symbols.map (symbol => symbolLoop (exchange, symbol, timeframe)) + await Promise.all (loops) +} + + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.js b/docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.js new file mode 100644 index 0000000..5e69fa1 --- /dev/null +++ b/docs/ccxt/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.js @@ -0,0 +1,33 @@ +'use strict'; + +const ccxt = require ('../../js/ccxt.js') + +console.log('CCXT Version:', ccxt.version) + +function symbolLoop (exchange, symbol, timeframe) { + exchange.fetchOHLCV (symbol, timeframe).then (ohlcvs => { + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, ohlcvs.length, 'OHLCV candles received') + setTimeout (() => symbolLoop (exchange, symbol, timeframe), 0) + }).catch (e => { + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, e.constructor.name, e.message) + setTimeout (() => symbolLoop (exchange, symbol, timeframe), 0) + }) +} + +function main () { + const exchange = new ccxt.binance () + // exchange.verbose = true // uncomment for debugging purposes if necessary + const symbols = [ + 'BTC/USDT', // unified symbols used here as opposed to exchange-specific market ids + 'ETH/USDT', // more about unified symbols vs exchange-specific ids here: + 'ADA/USDT', // https://github.com/ccxt/ccxt/wiki/Manual#markets + ] + const timeframe = '1m' + exchange.loadMarkets ().then (markets => { + for (const symbol of symbols) { + setTimeout (() => symbolLoop (exchange, symbol, timeframe), 0) + } + }) +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/binance-fetchTicker-delivery-vs-future.js b/docs/ccxt/examples/js/binance-fetchTicker-delivery-vs-future.js new file mode 100644 index 0000000..d4d16c7 --- /dev/null +++ b/docs/ccxt/examples/js/binance-fetchTicker-delivery-vs-future.js @@ -0,0 +1,31 @@ + + +import ccxt from '../../js/ccxt.js'; + +async function fetchTickers (exchange) { + let tickers = undefined + try { + // await exchange.loadMarkets () // optional + tickers = await exchange.fetchTickers () + } catch (e) { + console.error (e.constructor.name, e.message) + } + return tickers +} + +(async () => { + + const future = new ccxt.binance ({ options: { defaultType: 'future' }}) + const delivery = new ccxt.binance ({ options: { defaultType: 'delivery' }}) + + // ... + + const futureTickers = await fetchTickers (future); + console.log (futureTickers) + + console.log ('-------------------------------------------') + + const deliveryTickers = await fetchTickers (delivery); + console.log (deliveryTickers) + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/binance-futures-transfer-from-sub-account-to-master.js b/docs/ccxt/examples/js/binance-futures-transfer-from-sub-account-to-master.js new file mode 100644 index 0000000..f128e31 --- /dev/null +++ b/docs/ccxt/examples/js/binance-futures-transfer-from-sub-account-to-master.js @@ -0,0 +1,41 @@ + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +// https://github.com/ccxt/ccxt/issues/10181 + +async function main () { + + const exchange = new ccxt.binance ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) + + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes + + const fromEmail = 'sender@example.com' // edit for your values + , toEmail = 'receiver@example.com' // edit for your values + , code = 'USDT' // edit for your values + , amount = 100 // edit for your values + , futuresType = 1 // 1 for USDT-margined futures,2 for coin-margined futures + + const currency = exchange.currency (code); + + const response = await exchange.sapiPostSubAccountFuturesInternalTransfer ({ + 'fromEmail': fromEmail, // sender email + 'toEmail': toEmail, // recipient email + 'futuresType': futuresType, // 1 for USDT-margined futures,2 for coin-margined futures + 'asset': currency['id'], + 'amount': exchange.currencyToPrecision (code, amount), + }) + + console.log (response) + +} + +main () + diff --git a/docs/ccxt/examples/js/binance-margin-stop-order.js b/docs/ccxt/examples/js/binance-margin-stop-order.js new file mode 100644 index 0000000..0a732a4 --- /dev/null +++ b/docs/ccxt/examples/js/binance-margin-stop-order.js @@ -0,0 +1,39 @@ + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'options': { + 'defaultType': 'margin', + }, + }) + + const markets = await exchange.loadMarkets () + + exchange.verbose = true // uncomment for debugging purposes if necessary + + const symbol = 'BTC/USDT' + const type = 'STOP_LOSS_LIMIT' + const side = 'buy' + const amount = YOUR_AMOUNT_HERE + const price = YOUR_PRICE_HERE + const params = { + 'stopPrice': YOUR_STOP_PRICE_HERE, + 'timeInForce': 'GTC', + } + + try { + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + } catch (e) { + console.log (e.constructor.name, e.message) + } +} + +main () diff --git a/docs/ccxt/examples/js/binance-server-time.js b/docs/ccxt/examples/js/binance-server-time.js new file mode 100644 index 0000000..269f2d0 --- /dev/null +++ b/docs/ccxt/examples/js/binance-server-time.js @@ -0,0 +1,34 @@ + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' + +const log = ololog.configure ({ locate: false }) + +const binance = new ccxt['binance'] () +const recvWindow = binance.options.recvWindow +const aheadWindow = 1000 + +async function test () { + const localStartTime = Date.now () + const { serverTime } = await binance.publicGetTime () + const localFinishTime = Date.now () + const estimatedLandingTime = (localFinishTime + localStartTime) / 2 + + const diff = serverTime - estimatedLandingTime + + log (`request departure time: ${binance.iso8601 (localStartTime)}`) + log (`response arrival time: ${binance.iso8601 (localFinishTime)}`) + log (`server time: ${binance.iso8601 (serverTime)}`) + log (`request landing time (est): ${binance.iso8601 (estimatedLandingTime)}, ${Math.abs (diff)} ms ${Math.sign (diff) > 0 ? 'behind' : 'ahead of'} server`) + log ('\n') + + if (diff < -aheadWindow) { + log.error.red (`your request will likely be rejected if local time is ahead of the server's time for more than ${aheadWindow} ms \n`) + } + + if (diff > recvWindow) { + log.error.red (`your request will likely be rejected if local time is behind server time for more than ${recvWindow} ms\n`) + } +} + +test (); diff --git a/docs/ccxt/examples/js/binance-universal-transfer.js b/docs/ccxt/examples/js/binance-universal-transfer.js new file mode 100644 index 0000000..a526298 --- /dev/null +++ b/docs/ccxt/examples/js/binance-universal-transfer.js @@ -0,0 +1,16 @@ +import ccxt from '../../js/ccxt.js'; + +(async () => { + + // apiKey must have universal transfer permissions + const binance = new ccxt.binance ({ + "apiKey": "", + "secret": "", + }) + + console.log (await binance.transfer ('USDT', 1, 'spot', 'future')) + const transfers = await binance.fetchTransfers (); + console.log ('got ', transfers.length, ' transfers') + console.log (await binance.transfer ('USDT', 1, 'spot', 'cross')) // For transfer to cross margin wallet + console.log (await binance.transfer ('USDT', 1, 'spot', 'ADA/USDT')) // For transfer to an isolated margin wallet +}) () diff --git a/docs/ccxt/examples/js/bitfinex-fetch-trades.js b/docs/ccxt/examples/js/bitfinex-fetch-trades.js new file mode 100644 index 0000000..cc2236f --- /dev/null +++ b/docs/ccxt/examples/js/bitfinex-fetch-trades.js @@ -0,0 +1,35 @@ + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import asTable from 'as-table'; + +// ---------------------------------------------------------------------------- + +const // ---------------------------------------------------------------------------- +table = asTable.configure ({ delimiter: ' | ' });(async () => { + + const exchange = new ccxt.bitfinex ({ + 'verbose': process.argv.includes ('--verbose'), + 'timeout': 60000, + }) + + try { + + const response = await exchange.fetchTrades ('ETH/BTC', 1518983548636 - 2 * 24 * 60 * 60 * 1000) + log (table (response)) + log (response.length.toString (), 'trades') + log.green ('Succeeded.') + + } catch (e) { + + log.dim ('--------------------------------------------------------') + log (e.constructor.name, e.message) + log.dim ('--------------------------------------------------------') + log.dim (exchange.last_http_response) + log.error ('Failed.') + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/bitfinex2-fetch-trades.js b/docs/ccxt/examples/js/bitfinex2-fetch-trades.js new file mode 100644 index 0000000..2ce1716 --- /dev/null +++ b/docs/ccxt/examples/js/bitfinex2-fetch-trades.js @@ -0,0 +1,35 @@ + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; + +// ---------------------------------------------------------------------------- + +const // ---------------------------------------------------------------------------- +table = asTable.configure ({ delimiter: ' | ' });(async () => { + + const exchange = new ccxt.bitfinex2 ({ + 'verbose': process.argv.includes ('--verbose'), + 'timeout': 60000, + }) + + try { + + const response = await exchange.fetchTrades ('ETH/BTC', 1518983548636 - 2 * 24 * 60 * 60 * 1000) + log (table (response)) + log (response.length.toString (), 'trades') + log.green ('Succeeded.') + + } catch (e) { + + log.dim ('--------------------------------------------------------') + log (e.constructor.name, e.message) + log.dim ('--------------------------------------------------------') + log.dim (exchange.last_http_response) + log.error ('Failed.') + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/bitmex-browser-cors-proxy.js b/docs/ccxt/examples/js/bitmex-browser-cors-proxy.js new file mode 100644 index 0000000..3d179a4 --- /dev/null +++ b/docs/ccxt/examples/js/bitmex-browser-cors-proxy.js @@ -0,0 +1,7 @@ +// JavaScript CORS Proxy +// Save this in a file like cors.js and run with `node cors [port]` +// It will listen for your requests on the port you pass in command line or port 8080 by default +let port = (process.argv.length > 2) ? parseInt (process.argv[2]) : 8080 // default +require ('cors-anywhere').createServer ({ + setHeaders: { 'origin': 'https://www.bitmex.com' } +}).listen (port, '0.0.0.0') diff --git a/docs/ccxt/examples/js/bitpanda-fetchMyTrades-reduce.js b/docs/ccxt/examples/js/bitpanda-fetchMyTrades-reduce.js new file mode 100644 index 0000000..dbaaccf --- /dev/null +++ b/docs/ccxt/examples/js/bitpanda-fetchMyTrades-reduce.js @@ -0,0 +1,36 @@ +import ccxt from '../../js/ccxt.js'; + +const bitpanda = new ccxt.bitpanda ({ + "apiKey": "INSERTYOURAPIKEY" +}) + + +// output +` +fetching USDT/EUR trades on bitpanda +--------------------------------------------- +maker volume 6621.81 USDT maker fee 5.62 USDT +taker volume 2544.82 USDT taker fee 3.27 USDT + +sold 9166.63 USDT for 7802.38 EUR +bought 0.00 USDT for 0.00 EUR +` + +;(async () => { + const market = { + symbol: 'USDT/EUR', + base: 'USDT', + quote: 'EUR', + } + console.log ('fetching', market.symbol, 'trades on bitpanda') + console.log ('---------------------------------------------') + const trades = await bitpanda.fetchMyTrades ('USDT/EUR') + const makers = trades.filter (x => x.takerOrMaker === 'maker') + const takers = trades.filter (x => x.takerOrMaker === 'taker') + console.log ('maker volume', makers.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'maker fee', makers.reduce ((a, b) => a + b.fee['cost'], 0).toFixed (2), market.base) + console.log ('taker volume', takers.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'taker fee', takers.reduce ((a, b) => a + b.fee['cost'], 0).toFixed (2), market.base) + const sells = trades.filter (x => x.side === 'sell') + const buys = trades.filter (x => x.side === 'buy') + console.log ('\nsold', sells.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'for', sells.reduce ((a, b) => a + b.cost, 0).toFixed (2), market.quote) + console.log ('bought', buys.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'for', buys.reduce ((a, b) => a + b.cost, 0).toFixed (2), market.quote) +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/bitrue-fetch-balance.js b/docs/ccxt/examples/js/bitrue-fetch-balance.js new file mode 100644 index 0000000..8d36e1f --- /dev/null +++ b/docs/ccxt/examples/js/bitrue-fetch-balance.js @@ -0,0 +1,28 @@ + + +import ccxt from '../../js/ccxt.js'; + +async function main () { + + console.log ('CCXT Version:', ccxt.version) + + const exchange = new ccxt.bitrue ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }) + + await exchange.loadMarkets () + + exchange.verbose = true + + try { + + const balance = await exchange.fetchBalance () + console.log (balance) + + } catch (e) { + console.log (e.constructor.name, e.message); + } +} + +main () diff --git a/docs/ccxt/examples/js/bitstamp-private-api.js b/docs/ccxt/examples/js/bitstamp-private-api.js new file mode 100644 index 0000000..44b57aa --- /dev/null +++ b/docs/ccxt/examples/js/bitstamp-private-api.js @@ -0,0 +1,115 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure({ locate: false }) + +ansicolor.nice + + ;(async () => { + let apiUrl = 'https://www.bitstamp.net/api'; + + // instantiate the exchange + let exchange = new ccxt.bitstamp({ + 'apiKey': 'APIKEY', + 'secret': 'APISECRET', + 'uid': 'ACCOUNTID', + 'urls': { + 'api': { + 'public': apiUrl, + 'private': apiUrl, + 'v1': apiUrl + } + } + }) + + try { + // fetch account balance from the exchange + let balance = await exchange.fetchBalance() + log('balance'.green, balance.total) + + // fetch fees + let singleFee = await exchange.fetchTradingFee('BTC/USD') + log('fee'.green, 'BTC/USD', singleFee) + let tradingFees = await exchange.fetchTradingFees() + log('tradingFees'.green, tradingFees) + let fundingFees = await exchange.fetchFundingFees() + log('fundingFees'.green, fundingFees) + let fees = await exchange.fetchFees() + log('fees'.green, fees) + + // my trades + let myTrades = await exchange.fetchMyTrades('BTC/USD', undefined, 5) + log('myTrades'.green, asTable(myTrades)) + + // user transactions + let transactions = await exchange.fetchTransactions() + log('Transactions'.green, asTable(transactions)) + + // ledger + let ledger = await exchange.fetchLedger() + log('Ledger'.green, asTable(ledger)) + + // deposits + let deposits = await exchange.fetchDeposits() + log('Deposits'.green, asTable(deposits)) + + // create new limit order + let newOrder = await exchange.createOrder('BTC/USD', 'limit', 'buy', 0.01, 8000) + console.log('New limit order'.green, newOrder); + + // open orders + let openOrders = await exchange.fetchOpenOrders() + log('Open orders'.green, asTable(openOrders)) + + // order data + let orderData = await exchange.fetchOrder(newOrder.id) + console.log('Order data'.green, orderData); + + // cancel order + let canceledOrder = await exchange.cancelOrder(newOrder.id) + console.log('Canceled order'.green, canceledOrder); + + // create market order + let marketOrder = await exchange.createOrder('BTC/USD', 'market', 'buy', 0.01) + console.log('New market order'.green, marketOrder); + + // open orders + let secondOpenOrders = await exchange.fetchOpenOrders() + log('Open orders'.green, asTable(secondOpenOrders)) + + // deposit address + let paxDeposit = await exchange.fetchDepositAddress("XLM") + log('Pax deposit address'.green, paxDeposit) + + // withdrawal + let ethWithdraw = await exchange.withdraw("ETH", 0.01, "0x6c28cb9dd2f4e3bb6f56c822bc306f3b8a3e7c08") + log('ETH withdrawal'.green, ethWithdraw) + + // withdrawals + let withdrawals = await exchange.fetchWithdrawals() + log('Withdrawals'.green, asTable(withdrawals)) + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection || e.message.includes('ECONNRESET')) { + log.bright.yellow('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow('[Network Error] ' + e.message) + } else { + throw e; + } + } + + })() \ No newline at end of file diff --git a/docs/ccxt/examples/js/bitstamp-public-api.js b/docs/ccxt/examples/js/bitstamp-public-api.js new file mode 100644 index 0000000..23994c1 --- /dev/null +++ b/docs/ccxt/examples/js/bitstamp-public-api.js @@ -0,0 +1,39 @@ + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import asTable from 'as-table'; + + +const table = asTable.configure ({ delimiter: ' | ' }), id = 'bitstamp', exchange = new ccxt[id] ({ enableRateLimit: true }), symbol = 'BTC/USD';(async function main () { + + // Markets data + const markets = await exchange.fetchMarkets () + console.log('Total number of markets: ', Object.keys(markets).length); + + // Currencies + const currencies = await exchange.fetchCurrencies () + console.log('Currencies: ', JSON.stringify(currencies)); + + // Order book data + const orderbook = await exchange.fetchOrderBook (symbol) + console.log ('Order book ', symbol, orderbook.asks[0], orderbook.bids[0]) + + // Ticker + const ticker = await exchange.fetchTicker (symbol) + console.log ('Ticker ', symbol, " bid ", ticker.bid, " ask ", ticker.ask) + + // Trades + const response = await exchange.fetchTrades (symbol, null, 10) + log (table (response)) + + // OHLC data + const candles = await exchange.fetchOHLCV (symbol, '1m', undefined, 10); + const first = candles[0] + const last = candles[candles.length - 1] + console.log ( + 'Fetched', candles.length, symbol, 'candles', + 'from', exchange.iso8601 (first[0]), + 'to', exchange.iso8601 (last[0]) + ) + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/bittrex-balance.js b/docs/ccxt/examples/js/bittrex-balance.js new file mode 100644 index 0000000..ac4c08e --- /dev/null +++ b/docs/ccxt/examples/js/bittrex-balance.js @@ -0,0 +1,50 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog' + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)) + +;(async () => { + + // instantiate the exchange + let exchange = new ccxt.bittrex ({ + "apiKey": "471b47a06c384e81b24072e9a8739064", + "secret": "694025686e9445589787e8ca212b4cff", + }) + + + try { + + // fetch account balance from the exchange + let balance = await exchange.fetchBalance () + + // output the result + log (exchange.name.green, 'balance', balance) + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + log.bright.yellow ('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow ('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow ('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow ('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow ('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow ('[Network Error] ' + e.message) + } else { + throw e; + } + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/bittrex-fetch-closed-orders-history.js b/docs/ccxt/examples/js/bittrex-fetch-closed-orders-history.js new file mode 100644 index 0000000..fcc44cb --- /dev/null +++ b/docs/ccxt/examples/js/bittrex-fetch-closed-orders-history.js @@ -0,0 +1,69 @@ +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; +import asTable from 'as-table'; + + +const { noLocate } = ololog; +const log = noLocate; + +const exchange = new ccxt.bittrex ({ + 'enableRateLimit': true, + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + });(async () => { + + await exchange.loadMarkets () + + const symbol = 'ETH/BTC' + , market = exchange.markets[symbol] + , startingDate = '2017-01-01T00:00:00' + , now = exchange.milliseconds () + + log.bright.green ('\nFetching history for:', symbol, '\n') + + let allOrders = [] + let since = exchange.parse8601 (startingDate) + + while (since < now) { + + try { + + log.bright.blue ('Fetching history for', symbol, 'since', exchange.iso8601 (since)) + const orders = await exchange.fetchClosedOrders (symbol, since) + log.green.dim ('Fetched', orders.length, 'orders') + + allOrders = allOrders.concat (orders) + + if (orders.length) { + + const lastOrder = orders[orders.length - 1] + since = lastOrder['timestamp'] + 1 + + } else { + + break // no more orders left for this symbol, move to next one + } + + } catch (e) { + + log.red.unlimited (e) + + } + } + + // omit the following keys for a compact table output + // otherwise it won't fit into the screen width + const omittedKeys = [ + 'info', + 'timestamp', + 'lastTradeTimestamp', + 'fee', + ] + + log.yellow (asTable (allOrders.map (order => exchange.omit (order, omittedKeys)))) + log.green ('Fetched', allOrders.length, symbol, 'orders in total') + + // do whatever you want to do with them, calculate profit loss, etc... + +}) () + diff --git a/docs/ccxt/examples/js/blockchaincom-withdrawal.js b/docs/ccxt/examples/js/blockchaincom-withdrawal.js new file mode 100644 index 0000000..7f37c34 --- /dev/null +++ b/docs/ccxt/examples/js/blockchaincom-withdrawal.js @@ -0,0 +1,59 @@ +"use strict"; + +const ccxt = require('../../ccxt.js') +const asTable = require('as-table') +const log = require('ololog').configure({ locate: false }) + + +const exchange = new ccxt.blockchaincom({ + 'secret': 'YOUR_API_SECRET', +}) + +// blockchaincom specific internal beneficiary id +const address = 'BENEFICIARY_ID'; + + +(async () => { + + const markets = await exchange.loadMarkets () + + try { + const code = 'USDT' + const amount = 5 + + // fetch withdrawal beneficiary ids + const whiteList = await exchange.privateGetWhitelistCurrency({'currency': code}) + log('Withdrawl Whitelist', whiteList) + // + // [ + // { + // "whitelistId":"adcd73fb-9ba6-41o7-8c0d-7013482cb88f", // unique id for each beneficiary, to be passed in as address into withdraw () + // "name":"John Doe", + // "currency":"USDT" + // } + // ] + // + + // withdrawal + let withdrawal = await exchange.withdraw(code, amount, address, undefined); + log('Withdrawal', withdrawal) + + } catch (e) { + if (e instanceof ccxt.DDoSProtection || e.message.includes('ECONNRESET')) { + log('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log('[Network Error] ' + e.message) + } else { + throw e; + } + } + +})() diff --git a/docs/ccxt/examples/js/build-ohlcv-bars.js b/docs/ccxt/examples/js/build-ohlcv-bars.js new file mode 100644 index 0000000..bd06132 --- /dev/null +++ b/docs/ccxt/examples/js/build-ohlcv-bars.js @@ -0,0 +1,48 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// Bulding OHLCV array from trades (executions) data is a bit tricky. For example, if you want to build 100 ohlcv bars of 1-minute timeframe, then you have to fetch the 100 minutes of trading data. So, higher timeframe bars require more trading data (i.e. building 100 bars of 1-day timeframe OHLCV would require massive amount of trading data, which might not be desirable for user, because of data-usage rate limits) +async function example_with_fetch_trades() { + const exch = new ccxt.binance({}); + const timeframe = '1m'; + const symbol = 'OGN/USDT'; + const since = exch.milliseconds() - 1000 * 60 * 30; // last 30 mins + const limit = 1000; + const trades = await exch.fetchTrades(symbol, since, limit); + const generatedBars = exch.buildOHLCVC(trades, timeframe, since, limit); + // you can ignore 6th index ("count" field) from ohlcv entries, which is not part of OHLCV standard structure and is just added internally by `buildOHLCVC` method + console.log('[REST] Constructed', generatedBars.length, 'bars from trades: ', generatedBars); +} +async function example_with_watch_trades() { + const exch = new ccxt.pro.binance({}); + const timeframe = '1m'; + const symbol = 'DOGE/USDT'; + const limit = 1000; + const since = exch.milliseconds() - 10 * 60 * 1000 * 1000; // last 10 hrs + let collectedTrades = []; + const collectedBars = []; + while (true) { + const wsTrades = await exch.watchTrades(symbol, since, limit, {}); + collectedTrades = collectedTrades.concat(wsTrades); + const generatedBars = exch.buildOHLCVC(collectedTrades, timeframe, since, limit); + // Note: first bar would be partially constructed bar and its 'open' & 'high' & 'low' prices (except 'close' price) would probably have different values compared to real bar on chart, because the first obtained trade timestamp might be somewhere in the middle of timeframe period, so the pre-period would be missing because we would not have trades data. To fix that, you can get older data with `fetchTrades` to fill up bars till start bar. + for (let i = 0; i < generatedBars.length; i++) { + const bar = generatedBars[i]; + const barTimestamp = bar[0]; + const collectedBarsLength = collectedBars.length; + const lastCollectedBarTimestamp = collectedBarsLength > 0 ? collectedBars[collectedBarsLength - 1][0] : 0; + if (barTimestamp === lastCollectedBarTimestamp) { + // if timestamps are same, just updarte the last bar + collectedBars[collectedBarsLength - 1] = bar; + } + else if (barTimestamp > lastCollectedBarTimestamp) { + collectedBars.push(bar); + // remove the trades from saved array, which were till last collected bar's open timestamp + collectedTrades = exch.filterBySinceLimit(collectedTrades, barTimestamp); + } + } + // Note: first bar would carry incomplete values, please read comment in "buildOHLCVCFromWatchTrades" method definition for further explanation + console.log('[WS] Constructed', collectedBars.length, 'bars from', symbol, 'trades: ', collectedBars); + } +} +await example_with_fetch_trades(); +await example_with_watch_trades(); diff --git a/docs/ccxt/examples/js/builtin-rate-limiting-rest-poller.js b/docs/ccxt/examples/js/builtin-rate-limiting-rest-poller.js new file mode 100644 index 0000000..03c5709 --- /dev/null +++ b/docs/ccxt/examples/js/builtin-rate-limiting-rest-poller.js @@ -0,0 +1,25 @@ + + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import { nice as ansi } from 'ansicolor'; +import asTable from 'as-table'; + +const exchange = new ccxt.coinbasepro () +const repeat = 100 + +async function test (symbol) { + + for (let i = 0; i < repeat; i++) { + let ticker = await exchange.fetchTicker (symbol) + log (exchange.id.green, exchange.iso8601 (exchange.milliseconds ()), ticker['datetime'], symbol.green, ticker['last']) + } +} + +const concurrent = [ + test ('BTC/USD'), + test ('ETH/BTC'), + test ('ETH/USD') +] + +Promise.all (concurrent) \ No newline at end of file diff --git a/docs/ccxt/examples/js/bybit-trailing.js b/docs/ccxt/examples/js/bybit-trailing.js new file mode 100644 index 0000000..fe7d09b --- /dev/null +++ b/docs/ccxt/examples/js/bybit-trailing.js @@ -0,0 +1,62 @@ +'use strict'; + +const ccxt = require ('../../ccxt'); + +console.log ('CCXT Version:', ccxt.version) + +const exchange = new ccxt.bybit({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_KEY', +}) + +// exchange.set_sandbox_mode(true) // enable sandbox mode + +// Example 1 :: Swap : open position and set trailing stop and close it +async function example1 () { + exchange['options']['defaultType'] = 'swap'; // very important set swap as default type + await exchange.loadMarkets (); + + const symbol = 'LTC/USDT:USDT'; + const market = exchange.market(symbol); + + // fetch swap balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create order and open position + const type = 'market'; + const side = 'buy'; + const amount = 0.1 + const price = undefined; + const createOrder = await exchange.createOrder (symbol, type, side, amount, price); + console.log ('Created order id:', createOrder['id']) + + // set trailing stop + const rawSide = 'Buy'; // or 'Sell' + const trailing_stop = 30; // YOUR TRAILING STOP HERE + const trailingParams = { + 'symbol': market['id'], + 'side': rawSide, + 'trailing_stop': trailing_stop + } + const trailing_response = await exchange.privatePostPrivateLinearPositionTradingStop (trailingParams); + console.log(trailing_response) + + // check opened position + const symbols = [ symbol ]; + const positions = await exchange.fetchPositions (symbols); + console.log (positions) + + // Close position by issuing a order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, type, side, amount, price, params); + console.log (closePositionOrder); +} + +async function main () { + await example1 (); +} + +main (); \ No newline at end of file diff --git a/docs/ccxt/examples/js/bybit-updated.cjs b/docs/ccxt/examples/js/bybit-updated.cjs new file mode 100644 index 0000000..45f7e43 --- /dev/null +++ b/docs/ccxt/examples/js/bybit-updated.cjs @@ -0,0 +1,154 @@ +'use strict'; + +const ccxt = require ('../../dist/cjs/ccxt.js'); + +console.log ('CCXT Version:', ccxt.version) + +const exchange = new ccxt.bybit ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +// Example 1: Spot : fetch balance, create order, cancel it and check canceled orders +async function example1 () { + exchange['options']['defaultType'] = 'spot'; // very important set spot as default type + + await exchange.loadMarkets (); + + // fetch spot balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create order + const symbol = 'LTC/USDT'; + const createOrder = await exchange.createOrder (symbol, 'limit', 'buy', 50, 0.1); + console.log ('Created order id:', createOrder['id']) + + // cancel order + const cancelOrder = await exchange.cancelOrder (createOrder['id'], symbol); + + // Check canceled orders (bybit does not have a single endpoint to check orders + // we have to choose whether to check open or closed orders and call fetchOpenOrders + // or fetchClosedOrders respectively + const canceledOrders = await exchange.fetchClosedOrders (symbol); + console.log (canceledOrders); +} + +// ----------------------------------------------------------------------------------------- + +// Example 2 :: Swap : fetch balance, open a position and close it +async function example2 () { + exchange['options']['defaultType'] = 'swap'; // very important set swap as default type + await exchange.loadMarkets (); + + // fetch swap balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create order and open position + const symbol = 'LTC/USDT:USDT'; + const createOrder = await exchange.createOrder (symbol, 'market', 'buy', 0.1); + console.log ('Created order id:', createOrder['id']) + + // check opened position + const symbols = [ symbol ]; + const positions = await exchange.fetchPositions (symbols); + console.log (positions) + + // Close position by issuing a order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, 'market', 'sell', 0.1, undefined, params); + console.log (closePositionOrder); +} + +// ----------------------------------------------------------------------------------------- + +// Example 3 :: USDC Swap : fetch balance, open a position and close it +async function example3 () { + exchange['options']['defaultType'] = 'swap'; // very important set swap as default type + await exchange.loadMarkets (); + + // fetch USDC swap balance + // when no symbol is available we can show our intent + // of using USDC endpoints by either using defaultSettle in options or + // settle in params + // Using Options: exchange['options']['defaultSettle'] = 'USDC'; + // Using params: + const balanceParams = { + 'settle': 'USDC' + } + const balance = await exchange.fetchBalance (balanceParams); + console.log (balance) + + // create order and open position + // taking into consideration that USDC markets do not support + // market orders + const symbol = 'BTC/USD:USDC'; + const amount = 0.1; + const price = 29940 // adjust this accordingly + const createOrder = await exchange.createOrder (symbol, 'limit', 'buy', amount, price); + console.log ('Created order id:', createOrder['id']) + + // check if the order was filled and the position opened + const symbols = [ symbol ]; + const positions = await exchange.fetchPositions (symbols); + console.log (positions) + + // close position (assuming it was already opened) by issuing an order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, 'limit', 'sell', amount, price, params); + console.log (closePositionOrder); +} + +// ----------------------------------------------------------------------------------------- + +// Example 4 :: Future : fetch balance, create stop-order and check open stop-orders +async function example4 () { + exchange['options']['defaultType'] = 'future'; // very important set future as default type + await exchange.loadMarkets (); + + // fetch future balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create stop-order + const symbol = 'ETH/USD:ETH-220930'; + const amount = 10; // in USD for inverse futures + const price = 1200; + const side = 'buy'; + const type = 'limit'; + const stopOrderParams = { + 'position_idx': 0, // 0 One-Way Mode, 1 Buy-side, 2 Sell-side, default = 0 + 'stopPrice': 1000, // mandatory for stop orders + 'basePrice': 1100 // mandatory for stop orders + } + const stopOrder = await exchange.createOrder (symbol, type, side, amount, price, stopOrderParams); + console.log ('Created order id:', stopOrder['id']) + + // check opened stop-order + const openOrderParams = { + 'stop': true + } + const openOrders = await exchange.fetchOpenOrders (symbol, undefined, undefined, openOrderParams); + console.log (openOrders) + + // Cancell open stop-order + const cancelOrder = await exchange.cancelOrder (stopOrder['id'], symbol, openOrderParams); + console.log (cancelOrder); +} + +// ----------------------------------------------------------------------------------------- + +async function main () { + await example1 (); + await example2 (); + await example3 (); + await example4 (); + +} + +main (); \ No newline at end of file diff --git a/docs/ccxt/examples/js/coinbase-fetch-all-balances.js b/docs/ccxt/examples/js/coinbase-fetch-all-balances.js new file mode 100644 index 0000000..11ff454 --- /dev/null +++ b/docs/ccxt/examples/js/coinbase-fetch-all-balances.js @@ -0,0 +1,38 @@ +"use strict"; + +const ccxt = require ('../../js/ccxt.js') + +console.log ('CCXT Version:', ccxt.version) + +async function fetchAllBalances (exchange) { + const params = {} + let balance = {} + while (true) { + const response = await exchange.fetchBalance (params) + balance = exchange.extend (balance, response) + const info = exchange.safeValue (response, 'info', {}) + const pagination = exchange.safeValue (info, 'pagination', {}) + const startingAfter = exchange.safeString (pagination, 'next_starting_after') + if (startingAfter !== undefined) { + params['starting_after'] = startingAfter + } else { + break + } + } + return balance +} + +async function main () { + const exchange = new ccxt.coinbase ({ + // Value is the "name" field in the api_key.json file Coinbase will offer for download + apiKey: 'organizations/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/apiKeys/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + // This is the "privateKey" field in that JSON file + secret: '-----BEGIN EC PRIVATE KEY-----\nxxx...xxx==\n-----END EC PRIVATE KEY-----', + }) + const markets = await exchange.loadMarkets () + // coinbase.verbose = true // uncomment for debugging purposes if necessary + const balance = await fetchAllBalances (exchange) + console.log (balance) +} + +main () diff --git a/docs/ccxt/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.js b/docs/ccxt/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.js new file mode 100644 index 0000000..febfcd1 --- /dev/null +++ b/docs/ccxt/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.js @@ -0,0 +1,47 @@ +"use strict"; + +const ccxt = require ('../../ccxt') + +console.log ('CCXT Version:', ccxt.version) + +// https://github.com/ccxt/ccxt/issues/15405 + +async function main () { + + const exchange = new ccxt.coinex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + + // exchange.verbose = true // uncomment for debugging purposes + + await exchange.loadMarkets (); + const addresses = {}; + const promises = []; + + async function fetchDepositAddress (currency, network) { + try { + const response = await exchange.fetchDepositAddress(currency, { 'network': network }); + addresses[currency][network] = response['address'] + } + catch (err) { + console.error(err) + } + } + + const currencies = Object.keys (exchange.currencies); + + for (const currency of currencies) { + const networks = Object.keys (exchange.currencies[currency]['networks']); + for (const network of networks) { + addresses[currency] = {}; + promises.push (fetchDepositAddress (currency, network)); + } + } + + await Promise.all (promises); + + console.log (addresses) +}; + +main (); diff --git a/docs/ccxt/examples/js/coinex-futures.js b/docs/ccxt/examples/js/coinex-futures.js new file mode 100644 index 0000000..8326835 --- /dev/null +++ b/docs/ccxt/examples/js/coinex-futures.js @@ -0,0 +1,75 @@ +'use strict'; + +const ccxt = require ('../../ccxt'); + +console.log ('CCXT Version:', ccxt.version) + +let exchange = new ccxt.coinex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +// Example 1 :: Swap : fetch balance, create a limit swap order with leverage +async function example1 () { + exchange['options']['defaultType'] = 'swap'; + exchange.options['defaultMarginMode'] = 'cross' // or isolated + await exchange.loadMarkets (); + + const symbol = 'ADA/USDT:USDT'; + + // fetchBalance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // set the desired leverage (has to be made before placing the order and for a specific symbol) + const leverage = 8; + const leverage_response = await exchange.setLeverage(leverage, symbol) + + // create limit order + const amount = 50; + const price = 0.3 // adjust this accordingly + const createOrder = await exchange.createOrder (symbol, 'limit', 'buy', amount, price); + console.log ('Created order id:', createOrder['id']) +} + +// Example 2 :: Swap :: open a position and close it +async function example2 () { + exchange['options']['defaultType'] = 'swap'; + exchange.options['defaultMarginMode'] = 'cross' // or isolated + await exchange.loadMarkets (); + + const symbol = 'ADA/USDT:USDT'; + + // fetchBalance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // set the desired leverage (has to be made before placing the order and for a specific symbol) + const leverage = 8; + const leverage_response = await exchange.setLeverage(leverage, symbol) + + // create market order and open position + const amount = 50; + const createOrder = await exchange.createOrder (symbol, 'market', 'buy', amount); + console.log ('Created order id:', createOrder['id']) + + // check if the order was filled and the position opened + const position = await exchange.fetchPositions (symbol); + console.log (position) + + // close position (assuming it was already opened) by issuing an order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, 'market', 'sell', amount, undefined, params); + console.log (closePositionOrder); +} + +// ----------------------------------------------------------------------------------------- + +async function main () { + await example1 (); + await example2 (); +} + +main (); \ No newline at end of file diff --git a/docs/ccxt/examples/js/coinone-fetch-tickers.js b/docs/ccxt/examples/js/coinone-fetch-tickers.js new file mode 100644 index 0000000..ecee1b4 --- /dev/null +++ b/docs/ccxt/examples/js/coinone-fetch-tickers.js @@ -0,0 +1,54 @@ + + +import { nice as ansi } from 'ansicolor'; +import ololog from 'ololog'; +import asTable from 'as-table'; + +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +const table = asTable.configure ({ + delimiter: ' | '.dim, + right: true, + }); + +const exchange = new ccxt.coinone ({ + 'verbose': process.argv.includes ('--verbose'), +}) + +let printTickersAsTable = function (exchange, tickers) { + log (exchange.id.green, exchange.iso8601 (exchange.milliseconds ())) + log ('Fetched', Object.values (tickers).length.toString ().green, 'tickers:') + log (table (ccxt.sortBy (Object.values (tickers), 'symbol', false))) +} + +async function fetchAllAndPrint () { + const tickers = await exchange.fetchTickers () + log ('---------------------------------------- fetchTickers ----------------------------------------') + printTickersAsTable (exchange, tickers) +} + +async function fetchOneByOneAndPrint () { + const markets = await exchange.loadMarkets () + const symbols = Object.keys (markets) + const tickers = [] + + log ('---------------------------------------- fetchTicker (one by one) ----------------------------------------') + + for (let i = 0; i < symbols.length; i++) { + const ticker = await exchange.fetchTicker (symbols[i]) + tickers.push (ticker) + log (`${i+1} / ${symbols.length}`) + log ('\u001b[1A'.repeat (2)) // cursor up + } + + printTickersAsTable (exchange, tickers) +} + +(async () => { + await fetchAllAndPrint () + log ('\n') + await fetchOneByOneAndPrint () +}) () diff --git a/docs/ccxt/examples/js/coinone-markets.js b/docs/ccxt/examples/js/coinone-markets.js new file mode 100644 index 0000000..ee9e048 --- /dev/null +++ b/docs/ccxt/examples/js/coinone-markets.js @@ -0,0 +1,16 @@ + + +import log from 'ololog'; +import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.coinone ({ + 'verbose': process.argv.includes ('--verbose'), +}) + +;(async function main () { + + const markets = await exchange.loadMarkets () + log (markets) + log ('\n' + exchange['name'] + ' supports ' + Object.keys (markets).length + ' pairs') + +}) () diff --git a/docs/ccxt/examples/js/compare-two-exchanges-capabilities.js b/docs/ccxt/examples/js/compare-two-exchanges-capabilities.js new file mode 100644 index 0000000..a44f6a9 --- /dev/null +++ b/docs/ccxt/examples/js/compare-two-exchanges-capabilities.js @@ -0,0 +1,36 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const prefix = '-'; + const exchange_1 = new ccxt.okx(); + const exchange_2 = new ccxt.htx(); + const keys_1 = Object.keys(exchange_1.has); + const keys_2 = Object.keys(exchange_2.has); + // check missing from exchange-1 + console.log('### checking missing functionalities from exchange-1:', exchange_1.id); + for (let i = 0; i < keys_2.length; i++) { + const key = keys_2[i]; + if (exchange_2.has[key]) { + if (!keys_1.includes(key)) { + console.log(prefix, key, 'does not exist in', exchange_1.id, 'as opposed to', exchange_2.id); + } + else if (exchange_2.has[key] !== exchange_1.has[key]) { + console.log(prefix, key, '> ', exchange_1.id, ':', exchange_1.has[key], ',', exchange_2.id, ':', exchange_2.has[key]); + } + } + } + // check missing from exchange-2 + console.log('### checking missing functionalities from exchange-2:', exchange_2.id); + for (let i = 0; i < keys_1.length; i++) { + const key = keys_1[i]; + if (exchange_1.has[key]) { + if (!keys_2.includes(key)) { + console.log(prefix, key, 'does not exist in', exchange_2.id, 'as opposed to', exchange_1.id); + } + else if (exchange_1.has[key] !== exchange_2.has[key]) { + console.log(prefix, key, '> ', exchange_2.id, ':', exchange_2.has[key], ',', exchange_1.id, ':', exchange_1.has[key]); + } + } + } +} +await example(); diff --git a/docs/ccxt/examples/js/cors-proxy.js b/docs/ccxt/examples/js/cors-proxy.js new file mode 100644 index 0000000..6315cf4 --- /dev/null +++ b/docs/ccxt/examples/js/cors-proxy.js @@ -0,0 +1,5 @@ +// JavaScript CORS Proxy +// Save this in a file like cors.js and run with `node cors [port]` +// It will listen for your requests on the port you pass in command line or port 8080 by default +let port = (process.argv.length > 2) ? parseInt (process.argv[2]) : 8080 // default +require ('cors-anywhere').createServer ().listen (port, '0.0.0.0') diff --git a/docs/ccxt/examples/js/create-order-handle-errors.js b/docs/ccxt/examples/js/create-order-handle-errors.js new file mode 100644 index 0000000..f244e71 --- /dev/null +++ b/docs/ccxt/examples/js/create-order-handle-errors.js @@ -0,0 +1,55 @@ + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- + +(async () => { + + const exchange = new ccxt.bittrex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'verbose': false, // set to true to see more debugging output + 'timeout': 60000, + }) + + // try to load markets first, retry on request timeouts until it succeeds: + + while (true) { + + try { + + await exchange.loadMarkets (); + break; + + } catch (e) { + + if (e instanceof ccxt.RequestTimeout) + console.log (exchange.iso8601 (Date.now ()), e.constructor.name, e.message) + } + } + + const symbol = 'ETH/BTC' + const orderType = 'limit' + const side = 'sell' + const amount = 0.321; + const price = 0.123; + + // try just one attempt to create an order + + try { + + const response = await exchange.createOrder (symbol, orderType, side, amount, price); + console.log (response); + console.log ('Succeeded'); + + } catch (e) { + + console.log (exchange.iso8601 (Date.now ()), e.constructor.name, e.message) + console.log ('Failed'); + + } + +}) () diff --git a/docs/ccxt/examples/js/create-order-position-with-takeprofit-stoploss.js b/docs/ccxt/examples/js/create-order-position-with-takeprofit-stoploss.js new file mode 100644 index 0000000..6930e17 --- /dev/null +++ b/docs/ccxt/examples/js/create-order-position-with-takeprofit-stoploss.js @@ -0,0 +1,71 @@ +// @ts-nocheck +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +console.log('CCXT Version:', ccxt.version); +// ------------------------------------------------------------------------------ +async function example() { + // at this moment, only OKX support embedded stop-loss & take-profit orders in unified manner. other exchanges are being added actively and will be available soon. + const exchange = new ccxt.okx({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + "password": "YOUR_API_PASSWORD", // if exchange does not require password, comment out this line + }); + const symbol = 'DOGE/USDT:USDT'; + const side = 'buy'; // 'buy' | 'sell' + const order_type = 'limit'; // 'market' | 'limit' + const amount = 1; // how many contracts (see `market(symbol).contractSize` to find out coin portion per one contract) + await exchange.loadMarkets(); + const market = exchange.market(symbol); + const ticker = await exchange.fetchTicker(symbol); + const last_price = ticker['last']; + const ask_price = ticker['ask']; + const bid_price = ticker['bid']; + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + if (order_type === 'limit') { + price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + } + // set trigger price for stop-loss/take-profit to 2% from current price + // (note, across different exchanges "trigger" price can be also mentioned with different synonyms, like "activation price", "stop price", "conditional price", etc. ) + const stop_loss_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 0.98 : 1.02); + const take_profit_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 1.02 : 0.98); + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': stop_loss_trigger_price * 0.98, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': take_profit_trigger_price * 0.98, + }, + // note that some exchanges might require some exchange specific parameter when opening a position, i.e.: + // 'posSide': 'long', // for phemex hedge-mode api + }; + const position_amount = market['contractSize'] * amount; + const position_value = position_amount * last_price; + // log + console.log('Going to open a position', 'for', amount, 'contracts worth', position_amount, market['base'], '~', position_value, market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision(symbol, price) : ''), '), using the following params:'); + console.log(params); + console.log('-----------------------------------------------------------------------'); + // exchange.verbose = True // uncomment for debugging purposes if necessary + try { + const created_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + console.log("Created an order", created_order); + // Fetch all your open orders for this symbol + // - use 'fetchOpenOrders' or 'fetchOrders' and filter with 'open' status + // - note, that some exchanges might return one order object with embedded stoploss/takeprofit fields, while other exchanges might have separate stoploss/takeprofit order objects + const all_open_orders = await exchange.fetchOpenOrders(symbol); + console.log("Fetched all your orders for this symbol", all_open_orders); + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } + catch (e) { + console.log(e.toString()); + } +} +await example(); +// NOTES: +// - Sometimes you might experience, when their stop-loss/take-profit order might not become activated, even though on chart the price had crossed that "trigger-price" order was not executed . That happens because some exchange might be using mark-price (instead of last-price) as a reference-price, so that mark-price might reach your trigger-price and it would activate your SL/TP order (even though on your symbol's chart you are viewing the "last-price" by default, which could have different movements than the mark-price). diff --git a/docs/ccxt/examples/js/create-order-with-retry.js b/docs/ccxt/examples/js/create-order-with-retry.js new file mode 100644 index 0000000..ac48ab6 --- /dev/null +++ b/docs/ccxt/examples/js/create-order-with-retry.js @@ -0,0 +1,65 @@ + + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- + +const tryToCreateOrder = async function (exchange, symbol, type, side, amount, price, params) { + + try { + + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + return order + + } catch (e) { + + console.log (e.constructor.name, e.message) + + if (e instanceof ccxt.NetworkError) { + + // retry on networking errors + return false + + } else { + + throw e // break on all other exceptions + } + } +} + +// ---------------------------------------------------------------------------- + +const exchange = new ccxt.bytetrade ({ + 'apiKey': 'classic123', // edit here + 'secret': 'ebcefff7de475ffe15e864ca3e3e410edf7e94fffd1f9af34edf9434e2bfff1b', // edit here +}) + +// +// make a classic bytetrade account - one that is linked to an email or phone number +// then click on your username in the top right and then export +// you will get a file like this: +// +// future garage icon motion panda garage motion task science head garage notable +// ebcefff7de475ffe15e864ca3e3e410edf7e94fffd1f9af34edf9434e2bfff1b +// classic123 +// +// the second line is your secret and the third line is your apiKey +// + +const symbol = 'XRP/USDT' // edit here +const type = 'limit ' // edit here +const side = 'buy' // edit here +const amount = 10 // edit here +const price = 1 // edit here +const params = {} // edit here + +;(async () => { + let order = false + while (true) { + order = await tryToCreateOrder (exchange, symbol, type, side, amount, price, params) + if (order !== false) { + break + } + } + console.log (order) +}) () diff --git a/docs/ccxt/examples/js/create-order-ws-example.js b/docs/ccxt/examples/js/create-order-ws-example.js new file mode 100644 index 0000000..e93c78d --- /dev/null +++ b/docs/ccxt/examples/js/create-order-ws-example.js @@ -0,0 +1,25 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.pro.binance({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode(true); + exchange.verbose = true; // uncomment for debugging purposes if necessary + // load markets + await exchange.loadMarkets(); + const symbol = 'ETH/USDT'; + const type = 'limit'; + const side = 'buy'; + const amount = 0.01; + let price = 1000; + let orders = []; + for (let i = 1; i < 5; i++) { + const response = await exchange.createOrderWs(symbol, type, side, amount, price); + price += i; + orders.push(response); + } + console.log(orders); +} +await example(); diff --git a/docs/ccxt/examples/js/create-orders-example.js b/docs/ccxt/examples/js/create-orders-example.js new file mode 100644 index 0000000..ea5fdcc --- /dev/null +++ b/docs/ccxt/examples/js/create-orders-example.js @@ -0,0 +1,17 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.binance({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode(true); + await exchange.loadMarkets(); + exchange.verbose = true; // uncomment for debugging purposes if necessary + const orders = await exchange.createOrders([ + { 'symbol': 'LTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 10, 'price': 55 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'market', 'side': 'buy', 'amount': 0.5 }, + ]); + console.log(orders); +} +await example(); diff --git a/docs/ccxt/examples/js/create-trailing-amount-order.js b/docs/ccxt/examples/js/create-trailing-amount-order.js new file mode 100644 index 0000000..5478fb7 --- /dev/null +++ b/docs/ccxt/examples/js/create-trailing-amount-order.js @@ -0,0 +1,36 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.bingx({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets(); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingAmount = 100; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingAmount': trailingAmount, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log(create_order); + } + catch (e) { + console.log(e.toString()); + } +} +await example(); diff --git a/docs/ccxt/examples/js/create-trailing-percent-order.js b/docs/ccxt/examples/js/create-trailing-percent-order.js new file mode 100644 index 0000000..58097dc --- /dev/null +++ b/docs/ccxt/examples/js/create-trailing-percent-order.js @@ -0,0 +1,36 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.bingx({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets(); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingPercent = 10; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingPercent': trailingPercent, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingPercentOrder (symbol, order_type, side, amount, price, trailingPercent, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log(create_order); + } + catch (e) { + console.log(e.toString()); + } +} +await example(); diff --git a/docs/ccxt/examples/js/credentials.json b/docs/ccxt/examples/js/credentials.json new file mode 100644 index 0000000..10dc173 --- /dev/null +++ b/docs/ccxt/examples/js/credentials.json @@ -0,0 +1,5 @@ +{ + "hitbtc": { "apiKey": "b6aad581670b30fb25d1c91cdbe8ca5c", "secret": "fa394ced37a488f9b5826a2d9ce39ae3" }, + "bitso": { "apiKey": "xZnHRmdlgJ", "secret": "e156bb7f7ab3a831afbc7a80f7866b9e" }, + "coincheck": { "apiKey": "dCyzY2T6w0DFhaco", "secret": "JpI0eMmxfa0tEpk3X-dNwyclSASJkl-S" } +} diff --git a/docs/ccxt/examples/js/custom-proxy-agent-for-js.js b/docs/ccxt/examples/js/custom-proxy-agent-for-js.js new file mode 100644 index 0000000..bb46f92 --- /dev/null +++ b/docs/ccxt/examples/js/custom-proxy-agent-for-js.js @@ -0,0 +1,12 @@ +// @ts-nocheck +// to set custom "proxy-agent" for ccxt +import ccxt from 'ccxt'; +import HttpProxyAgent from 'http-proxy-agent'; +import HttpsProxyAgent from 'https-proxy-agent'; +const proxy = 'http://1.2.3.4:5678'; +const httpAgent = new HttpProxyAgent(proxy); +const httpsAgent = new HttpsProxyAgent(proxy); +// then pass it through constructor +const kraken = new ccxt.kraken({ agent: httpAgent /* or httpsAgent */ }); +// or set it later +kraken.agent = agent; diff --git a/docs/ccxt/examples/js/custom-proxy-url.js b/docs/ccxt/examples/js/custom-proxy-url.js new file mode 100644 index 0000000..85cbdd8 --- /dev/null +++ b/docs/ccxt/examples/js/custom-proxy-url.js @@ -0,0 +1,23 @@ + + +import ccxt from '../../js/ccxt.js'; + +(async function main () { + + const kraken1 = new ccxt.kraken ({ + proxy: function (url) { + return 'https://example.com/?url=' + encodeURIComponent (url) + }, + }) + + console.log (await kraken1.loadMarkets ()) + + const kraken2 = new ccxt.kraken ({ + proxy: function (url) { + return 'https://cors-anywhere.herokuapp.com/' + url + }, + }) + + console.log (await kraken2.loadMarkets ()) + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/delta-maintenance-margin-rate-max-leverage.js b/docs/ccxt/examples/js/delta-maintenance-margin-rate-max-leverage.js new file mode 100644 index 0000000..161aa96 --- /dev/null +++ b/docs/ccxt/examples/js/delta-maintenance-margin-rate-max-leverage.js @@ -0,0 +1,60 @@ +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version); + +function getMaxLeverage (market, positionSize) { + /** + * @description Equation taken from https://www.delta.exchange/contracts/ + * @param {object} market CCXT market + * @param {float} positionSize The value of the position in quote currency + * @returns The maximum leverage available for the market for the given position size + */ + const info = market['info']; + const maxLeverageNotional = Number (info['max_leverage_notional']); + const initialMarginScalingFactor = Number (info['initial_margin_scaling_factor']); + let initialMargin = Number (info['initial_margin']); + + if (positionSize <= maxLeverageNotional) { + const initialMarginRatio = initialMargin / 100; + return 1 / initialMarginRatio; + } else { + initialMargin = initialMargin + (initialMarginScalingFactor * (positionSize - maxLeverageNotional)); + const initialMarginRatio = initialMargin / 100; + return 1 / initialMarginRatio; + } +} + +function getMaintenanceMarginRate (market, positionSize) { + /** + * @description Equation taken from https://www.delta.exchange/contracts/ + * @param {object} market CCXT market + * @param {float} positionSize The value of the position in quote currency + * @returns The maintenance margin rate as a percentage for the market with the given position size + */ + const info = market['info']; + const maxLeverageNotional = Number (info['max_leverage_notional']); + const maintenanceMarginScalingFactor = Number (info['maintenance_margin_scaling_factor']); + const maintenanceMargin = Number (info['maintenance_margin']); + + if (positionSize <= maxLeverageNotional) { + return maintenanceMargin; + } else { + return maintenanceMargin + (maintenanceMarginScalingFactor * (positionSize - maxLeverageNotional)); + } +} + +async function main () { + + const exchange = new ccxt.delta(); + await exchange.loadMarkets (); + + const symbol = 'ADA/USDT:USDT'; + const market = exchange.market (symbol); + + // Gets the maximum leverage and maintenance margin rate for a position worth 100,000 USDT on the ADA/USDT:USDT market + const maxLeverage = getMaxLeverage(market, 100000); + const maintenanceMarginRate = getMaintenanceMarginRate(market, 100000); + console.log(maxLeverage, maintenanceMarginRate); +} + +main () diff --git a/docs/ccxt/examples/js/env-variables.js b/docs/ccxt/examples/js/env-variables.js new file mode 100644 index 0000000..62a8e90 --- /dev/null +++ b/docs/ccxt/examples/js/env-variables.js @@ -0,0 +1,26 @@ + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' + +// ---------------------------------------------------------------------------- + +const log = ololog.configure.handleNodeErrors (), asTable = require("as-table").configure({ delimiter: " | " }); + +// ---------------------------------------------------------------------------- + +(async () => { + + const exchange = new ccxt.coinbase ({ + verbose: process.argv.includes ('--verbose'), + timeout: 60000, + apiKey: process.env.KEY, + secret: process.env.SECRET + }); + + const balance = await exchange.fetchBalance () + log.green (balance) + +})() diff --git a/docs/ccxt/examples/js/error-handling.js b/docs/ccxt/examples/js/error-handling.js new file mode 100644 index 0000000..7436c80 --- /dev/null +++ b/docs/ccxt/examples/js/error-handling.js @@ -0,0 +1,89 @@ + + +import ccxt from '../../js/ccxt.js'; + +const verbose = process.argv.includes ('--verbose'); + +//----------------------------------------------------------------------------- + +const printSupportedExchanges = () => console.log ('Supported exchanges:', ccxt.exchanges.join (', ')) + +const printUsage = () => { + console.log ('Usage: node', process.argv[1], 'id'.green) + printSupportedExchanges () +} + +const run = async (id) => { + + // check if the exchange is supported by ccxt + const exchangeFound = ccxt.exchanges.indexOf (id) > -1 + + if (exchangeFound) { + + console.log ('Instantiating', id, 'exchange') + + // instantiate the exchange by id + const exchange = new ccxt[id] ({ verbose }) + + // try to load markets and catch the errors if any + try { + + await exchange.loadMarkets () + + } catch (e) { + + if (e instanceof ccxt.NetworkError) { + console.log (exchange.id, 'loadMarkets failed due to a network error:', e.message) + } else if (e instanceof ccxt.ExchangeError) { + console.log (exchange.id, 'loadMarkets failed due to exchange error:', e.message) + } else { + console.log (exchange.id, 'loadMarkets failed with:', e.message) + } + + // rethrow the error "higher up" the call chain + throw e + } + + // try to fetch a ticker and catch the errors if any + try { + + const symbol = 'ETH/BTC' + const response = await exchange.fetchTicker (symbol) + console.log (response) + + } catch (e) { + + if (e instanceof ccxt.NetworkError) { + console.log (exchange.id, 'fetchTicker failed due to a network error:', e.message) + } else if (e instanceof ccxt.ExchangeError) { + console.log (exchange.id, 'fetchTicker failed due to exchange error:', e.message) + } else { + console.log (exchange.id, 'fetchTicker failed with:', e.message) + } + + // rethrow the error "higher up" the call chain + throw e + } + + } else { + + console.log ('Exchange', id, 'not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 2) { + + let id = process.argv[2] + await run (id) + + } else { + + printUsage () + } + + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/exchange-capabilities.js b/docs/ccxt/examples/js/exchange-capabilities.js new file mode 100644 index 0000000..b6b28fb --- /dev/null +++ b/docs/ccxt/examples/js/exchange-capabilities.js @@ -0,0 +1,135 @@ + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import asTable from 'as-table'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice + + + +const csv = process.argv.includes ('--csv'), delimiter = csv ? ',' : '|', asTableConfig = { delimiter: ' ' + delimiter + ' ', /* print: require ('string.ify').noPretty */ } + +asTable.configure (asTableConfig); + +const sortCertified = process.argv.includes ('--sort-certified') || process.argv.includes ('--certified') +const exchangesArgument = process.argv.find (arg => arg.startsWith ('--exchanges=')) +const exchangesArgumentParts = exchangesArgument ? exchangesArgument.split ('=') : [] +const selectedExchanges = (exchangesArgumentParts.length > 1) ? exchangesArgumentParts[1].split (',') : [] + +console.log (ccxt.iso8601 (ccxt.milliseconds ())) +console.log ('CCXT v' + ccxt.version) + +async function main () { + + let total = 0 + let notImplemented = 0 + let inexistentApi = 0 + let implemented = 0 + let emulated = 0 + + const exchangeNames = ccxt.exchanges + let exchanges = exchangeNames.map (id => new ccxt[id] ()) + exchanges = exchanges.map (exchange => exchange.pro ? new ccxt.pro[exchange.id] () : exchange) + if (sortCertified) { + exchanges.sort((a, b) => { + if (a.certified && !b.certified) { + return -1; + } else if (!a.certified && b.certified) { + return 1; + } else { + return 0; + } + }); + } + const metainfo = ccxt.flatten (exchanges.map (exchange => Object.keys (exchange.has))) + const reduced = metainfo.reduce ((previous, current) => { + previous[current] = (previous[current] || 0) + 1 + return previous + }, {}) + const unified = Object.entries (reduced).filter (([ _, count ]) => count > 1) + const methods = unified.map (([ method, _ ]) => method).sort () + if (selectedExchanges.length > 0) { + exchanges = exchanges.filter ((exchange) => selectedExchanges.includes(exchange.id)) + } + const table = asTable (exchanges.map (exchange => { + let result = {}; + const basics = [ + 'CORS', + 'spot', + 'margin', + 'swap', + 'future', + 'option', + ]; + + ccxt.unique (basics.concat (methods)).forEach (key => { + + total += 1 + + let coloredString = ''; + + const feature = exchange.has[key] + const isFunction = (typeof exchange[key] === 'function') + const isBasic = basics.includes (key) + + if (feature === false) { + // if explicitly set to 'false' in exchange.has (to exclude mistake, we check if it's undefined too) + coloredString = exchange.id.red.dim + inexistentApi += 1 + } else if (feature === 'emulated') { + // if explicitly set to 'emulated' in exchange.has + coloredString = exchange.id.yellow + emulated += 1 + } else if (feature) { + if (isBasic) { + // if neither 'false' nor 'emulated', and if method exists + coloredString = exchange.id.green + implemented += 1 + } else { + if (isFunction) { + coloredString = exchange.id.green + implemented += 1 + } else { + // the feature is available in exchange.has and not implemented + // this is an error + coloredString = exchange.id.lightMagenta + } + } + } else { + coloredString = exchange.id.lightRed + notImplemented += 1 + } + + result[key] = coloredString + }) + + return result + })) + + if (csv) { + let lines = table.split ("\n") + lines = lines.slice (0, 1).concat (lines.slice (2)) + log (lines.join ("\n")) + } else { + log (table) + } + + log ('Summary: ', + ccxt.exchanges.length.toString (), 'exchanges; ', + 'Methods [' + total.toString () + ' total]: ', + implemented.toString ().green, 'implemented,', + emulated.toString ().yellow, 'emulated,', + (inexistentApi.toString ().red.dim), 'inexistentApi,', + (notImplemented.toString ().lightRed), 'notImplemented', + ) + + log("\nMessy? Try piping to less (e.g. node script.js | less -S -R --header=3 )\n".red) + +} + +main () diff --git a/docs/ccxt/examples/js/exchanges-by-volume.js b/docs/ccxt/examples/js/exchanges-by-volume.js new file mode 100644 index 0000000..c50e613 --- /dev/null +++ b/docs/ccxt/examples/js/exchanges-by-volume.js @@ -0,0 +1,60 @@ + + +import ccxt from '../../js/ccxt.js'; + +(async () => { + + // const exchanges = [ + // 'bittrex', + // 'poloniex', + // 'bitfinex' + // ] + + const exchanges = ccxt.exchanges + + const symbol = 'BTC/USDT' + const tickers = {} + const volumeField = 'baseVolume' + + console.log ('-----------------------------------------------------------') + + await Promise.all (exchanges.map (exchangeId => + + new Promise (async (resolve, reject) => { + + try { + + const exchange = new ccxt[exchangeId] () + + const ticker = await exchange.fetchTicker (symbol) + + if (ticker[volumeField] !== undefined) { + tickers[exchangeId] = ticker + } + + } catch (e) { + + console.log (exchangeId, e.message.slice (0, 100)) + } + + resolve () + + }) + + )) + + console.log ('-----------------------------------------------------------') + + console.log (Object + .keys (tickers) + .sort ((a, b) => + ((tickers[a][volumeField] > tickers[b][volumeField]) ? 1 : ((tickers[a][volumeField] < tickers[b][volumeField]) ? -1 : 0))) + .reverse () + .map (id => ({ + id, + symbol, + 'volume': tickers[id][volumeField], + })) + ) + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/exchanges.js b/docs/ccxt/examples/js/exchanges.js new file mode 100644 index 0000000..aaf65bf --- /dev/null +++ b/docs/ccxt/examples/js/exchanges.js @@ -0,0 +1,40 @@ + + +import ccxt from '../../js/ccxt.js'; +import countries from '../../build/countries.js'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +let exchanges = {} + +ccxt.exchanges.forEach (id => { exchanges[id] = new (ccxt)[id] () }) + +log ('The ccxt library supports', (ccxt.exchanges.length.toString ()).green, 'exchanges:') + +var countryName = function (code) { + return ((countries[code] !== undefined) ? countries[code] : code) +} + +log (asTable.configure ({ delimiter: ' | ' }) (Object.values (exchanges).map (exchange => { + + let countries = Array.isArray (exchange.countries) ? + exchange.countries.map (countryName).join (', ') : + countryName (exchange.countries) + + let website = Array.isArray (exchange.urls.www) ? exchange.urls.www[0] : exchange.urls.www + + return { + id: exchange.id, + name: exchange.name, + url: website, + countries: countries, + } + +}))) diff --git a/docs/ccxt/examples/js/fetch-all-balances.js b/docs/ccxt/examples/js/fetch-all-balances.js new file mode 100644 index 0000000..b86e1f6 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-all-balances.js @@ -0,0 +1,219 @@ +import { PAD_WITH_ZERO } from '../../js/src/base/functions/number.js'; + +//----------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; + +import fs from 'fs'; +import path from 'path'; +import ansicolor from 'ansicolor'; +import asTable from 'as-table'; +import ololog from 'ololog'; + +ansicolor.nice +//----------------------------------------------------------------------------- + +const table = asTable.configure ({ + delimiter: '|'.lightGray.dim, + right: true, + title: x => String (x).lightGray, + print: x => { + if (typeof x === 'object') { + const j = JSON.stringify (x).trim () + if (j.length < 100) return j + } + return String (x) + } + }), + { ROUND, DECIMAL_PLACES, decimalToPrecision, omit, unique, flatten, extend } = ccxt, + log = ololog.handleNodeErrors ().noLocate.unlimited; + +//----------------------------------------------------------------------------- + +// set up keys and settings, if any +const keysGlobal = path.resolve ('keys.json') +const keysLocal = path.resolve ('keys.local.json') + +const keysGlobalExists = fs.existsSync (keysGlobal) +const keysLocalExists = fs.existsSync (keysLocal) + +if (!(keysGlobalExists || keysLocalExists)) { + const lines = [ + 'This script requires a keys.json or a keys.local.json file containing the API keys in JSON format', + '{', + ' "binance": {', + ' "apiKey": "YOUR_API_KEY",', + ' "secret": "YOUR_SECRET"', + ' }', + ' "bitfinex": {', + ' "apiKey": "YOUR_API_KEY",', + ' "secret": "YOUR_SECRET"', + ' }', + '}' + ] + const errorMessage = lines.join ("\n") + log.red.bright (errorMessage) + process.exit () +} + +let globalKeysFile = keysGlobalExists ? keysGlobal : false +let localKeysFile = keysLocalExists ? keysLocal : globalKeysFile +const dynamicLocalKeysFile = JSON.parse (fs.readFileSync (localKeysFile)); +let settings = localKeysFile ? (dynamicLocalKeysFile || {}) : {} + +//----------------------------------------------------------------------------- + +const timeout = 30000 + +const coins = [ + 'BTC', + 'ETH', + 'BNB', + 'EUR', + 'LTC', + 'USD', + 'USDC', + 'USDT', + 'BUSD', + 'XRP', + 'DOGE', + 'YFI', + 'LINK', + 'XLM', + 'ADA', + 'SOL', +] + +function initializeAllExchanges () { + let numErrors = 0 + const ignore = [ + 'bcex', + 'bitsane', + 'chbtc', + 'coinbasepro', + 'jubi', + 'hitbtc', + 'bitstamp1', + 'bitfinex2', + 'upbit', + 'huobipro', + ] + const result = [] + ccxt.exchanges.filter (exchangeId => (!ignore.includes (exchangeId))).forEach (exchangeId => { + try { + const verbose = false + const exchange = new ccxt[exchangeId] ({ + timeout, + verbose, + ... (settings[exchangeId] || {}) + }) + exchange.checkRequiredCredentials () + result.push (exchange) + } catch (e) { + numErrors++ + log.red (exchangeId, 'initialization failed', e.constructor.name, e.message.slice (0, 100)); + } + }) + log ('Initialized', ccxt.exchanges.length - numErrors, 'of', ccxt.exchanges.length, 'exchanges,', + numErrors, 'error' + (((numErrors < 1) || (numErrors > 1)) ? 's' : '') + ',', + ignore.length, 'skipped') + return result +} + +(async () => { + + const exchanges = initializeAllExchanges () + console.log (exchanges.map (exchange => exchange.id)) + let results = [] + const priceOracle = new ccxt.gate () + const tickers = await priceOracle.fetchTickers () + await Promise.all (exchanges.map ((exchange) => (async function () { + + try { + + if (exchange.has['signIn']) { + await exchange.signIn () + } + + const balance = await exchange.fetchTotalBalance () + if (!balance) { + throw new Error (exchange.id + ' erroneous balance') + } + const keys = Object.keys (balance).sort () + const nonzeroBalance = {} + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + if (coins.includes (key)) { + const value = balance[key] + const valueToPrecision = decimalToPrecision (value, ROUND, 8, DECIMAL_PLACES) + if (valueToPrecision !== '0') { + nonzeroBalance[key] = valueToPrecision + } + } + } + const numNonzeroKeys = Object.keys (nonzeroBalance).length + if (numNonzeroKeys < 1) { + log.yellow (exchange.id + ' empty balance') + } else { + log.green (exchange.id, numNonzeroKeys, 'currencies') + results.push ({ exchange: exchange.id, ... nonzeroBalance }) + } + + } catch (e) { + log.red (exchange.id, e.constructor.name, e.message.split ("\n")[0].slice (0, 100)) + } + + }) ())) + + results = ccxt.sortBy (results, 'exchange') + + const currencies = unique (flatten (results.map (result => Object.keys (omit (result, 'exchange'))))) + currencies.sort () + + const total = {} + for (let i = 0; i < currencies.length; i++) { + const currency = currencies[i] + let sum = 0 + results.forEach (result => { + if (currency in result) { + sum += parseFloat (result[currency]) + } + }) + total[currency] = decimalToPrecision (sum, ROUND, 8, DECIMAL_PLACES) + } + + results.push (extend ({ 'exchange': 'total' }, total)) + + results = results.map (result => { + let value = 0; + const convertTo = 'USD' + currencies.forEach (currency => { + if (currency === convertTo) { + if (currency in result) { + value += parseFloat (result[currency]) + } + } else { + const symbol = currency + '/' + convertTo + if (symbol in tickers) { + if (currency in result) { + const ticker = tickers[symbol] + value += parseFloat (result[currency]) * ticker['last'] + } + } + } + }) + return extend ({ + 'exchange': result.exchange, + '$': decimalToPrecision (value, ROUND, 2, DECIMAL_PLACES, PAD_WITH_ZERO), + }, result); + }) + + const tableResults = table (results) + + log (tableResults) + + log.green ('Currencies:', currencies) + + console.log (new Date ()) + +}) () diff --git a/docs/ccxt/examples/js/fetch-all-tickers-to-files-2.js b/docs/ccxt/examples/js/fetch-all-tickers-to-files-2.js new file mode 100644 index 0000000..fdd52f0 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-all-tickers-to-files-2.js @@ -0,0 +1,53 @@ +import ccxt from '../../js/ccxt.js'; +import { writeFileSync } from 'fs'; +import path from 'path'; + +const enableRateLimit = true, exchanges = {}, tickers = {}; + + +ccxt.exchanges.forEach (id => { + try { + const exchange = new ccxt[id] () + if (exchange.has['fetchTickers']) { + exchanges[id] = exchange + } + } catch (e) { + console.log ('Failed to initialize', id, e.constructor.name, e.message) + } +}) + +async function main () { + + console.log ('Started') + const start = Date.now () + + try { + const promises = Object.values (exchanges).map (exchange => ( + (async () => { + console.log (exchange.id) + try { + const response = await exchange.fetchTickers () + tickers[exchange.id] = response + } catch (e) { + console.log ('Failed to fetchTickers() from', exchange.id) + } + }) () + )) + await Promise.all (promises) + } catch (e) { + console.log ('Failed awaiting all exchanges to complete') + } + + Object.entries (tickers).forEach (([ id, response ]) => { + const folder = 'C:/myproject/tickers' + const filename = `${id}-tickers.json` + console.log (path.join (folder, filename)) + writeFileSync (path.join (folder, filename), JSON.stringify (response)) + }) + + const end = Date.now () + console.log (`Fetched tickers in ${(end - start) / 1000} seconds`) + +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/fetch-all-tickers-to-files.js b/docs/ccxt/examples/js/fetch-all-tickers-to-files.js new file mode 100644 index 0000000..30a6879 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-all-tickers-to-files.js @@ -0,0 +1,77 @@ + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; + +const { noLocate } = ololog; +const log = noLocate; + +import fs from 'fs'; + +// the numWorkers constant defines the number of concurrent workers +// those aren't really threads in terms of the async environment +// set this to the number of cores in your CPU * 2 +// or play with this number to find a setting that works best for you + +const numWorkers = 8;(async () => { + + // make an array of all exchanges + const exchanges = ccxt.exchanges + + // filter coinmarketcap and theocean + // coinmarketcap isn't really an exchange + // theocean requires web3 dependencies to be installed + + .filter (id => ![ 'coinmarketcap', 'theocean' ].includes (id)) + + // instantiate each exchange and save it to the exchanges list + + .map (id => new ccxt[id] ()) + + // the worker function for each "async thread" + const worker = async function () { + + // while the array of all exchanges is not empty + while (exchanges.length > 0) { + + // pop one exchange from the array + const exchange = exchanges.pop () + + // check if it has the necessary method implemented + if (exchange.has['fetchTickers']) { + + // try to do "the work" and handle errors if any + try { + + // fetch the response for all tickers from the exchange + const tickers = await exchange.fetchTickers () + + // make a filename from exchange id + const filename = exchange.id + '.json' + + // save the response to a file + fs.writeFileSync (filename, JSON.stringify ({ tickers })); + + // print out a message on success + log.green (exchange.id, 'tickers saved to', filename) + + } catch (e) { + + // in case of error - print it out and ignore it further + log.red (e.constructor.name, e.message) + } + + } else { + + log.red (exchange.id, "has['fetchTickers'] = false"); + } + } + } + + // create numWorkers "threads" (they aren't really threads) + const workers = [ ... Array (numWorkers) ].map (_ => worker ()) + + // wait for all of them to execute or fail + await Promise.all (workers) + +}) () diff --git a/docs/ccxt/examples/js/fetch-balance.js b/docs/ccxt/examples/js/fetch-balance.js new file mode 100644 index 0000000..1f14c8c --- /dev/null +++ b/docs/ccxt/examples/js/fetch-balance.js @@ -0,0 +1,28 @@ +"use strict"; + +const ccxt = require ('../../ccxt.js'); + +// instantiate the exchange +let exchange = new ccxt.coinbasepro ({ + 'apiKey': 'XXXXXXXXXXXXXX', + 'secret': 'YYYYYYYYYYYYYY', + 'password': 'ZZZZZZ', // if exchange requires password +}); + + +async function checkMyBalance() { + try { + // fetch account balance from the exchange + let myBalance = await exchange.fetchBalance (); + + // output the result + console.log (exchange.id, 'fetched balance', myBalance); + + } catch (e) { + // fpr advanced error-handling, see the "advanced-error-handling.js" example file + console.log ('[' + e.constructor.name + '] ' + e.message); + throw e; + } +} + +checkMyBalance(); \ No newline at end of file diff --git a/docs/ccxt/examples/js/fetch-create-deposit-address.js b/docs/ccxt/examples/js/fetch-create-deposit-address.js new file mode 100644 index 0000000..086508f --- /dev/null +++ b/docs/ccxt/examples/js/fetch-create-deposit-address.js @@ -0,0 +1,101 @@ +// ---------------------------------------------------------------------------- +// setup + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- +// setup + +const // change me + defaultCurrencyCode = 'BTC', + // change me + // currency code specified in commandline args ↓ + // you can call this script like node examples/js/fetch-create-deposit-address ETH + exchangeId = 'poloniex', + currencyCode = process.argv[3] || defaultCurrencyCode, + exchange = new ccxt[exchangeId] ({ + + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + + 'enableRateLimit': true, // ←- required! https://github.com/ccxt/ccxt/wiki/Manual#rate-limit + + // 'verbose': true, // ←- uncomment this for verbose output + + // additional credentials might be required in exchange-specific cases: + // uid or password for Coinbase Pro, etc... + }); + +// ---------------------------------------------------------------------------- + +if (!exchange.has['fetchDepositAddress']) { + + console.log ('The exchange does not support fetchDepositAddress() yet') + process.exit () +} + +// ---------------------------------------------------------------------------- + +;(async () => { + + try { + + console.log ('Trying to fetch deposit address for ' + currencyCode + ' from ' + exchangeId + '...') + + let fetchResult = await exchange.fetchDepositAddress (currencyCode) + + console.log ('Successfully fetched deposit address for ' + currencyCode) + console.log (fetchResult) + + } catch (e) { + + // never skip proper error handling, whatever it is you're building + // actually, with crypto error handling should be the largest part of your code + + if (e instanceof ccxt.InvalidAddress) { + + console.log ('The address for ' + currencyCode + ' does not exist yet') + + if (exchange.has['createDepositAddress']) { + + console.log ('Attempting to create a deposit address for ' + currencyCode + '...') + + try { + + const createResult = await exchange.createDepositAddress (currencyCode) + + // console.log (createResult) // for debugging + + console.log ('Successfully created a deposit address for ' + currencyCode + ', fetching the deposit address now...') + + try { + + let fetchResult = await exchange.fetchDepositAddress (currencyCode) + + console.log ('Successfully fetched deposit address for ' + currencyCode) + console.log (fetchResult); + + + } catch (e) { + + console.log ('Failed to fetch deposit address for ' + currencyCode, e.constructor.name, e.message) + } + + } catch (e) { + + console.log ('Failed to create deposit address for ' + currencyCode, e.constructor.name, e.message) + + } + + } else { + + console.log ('The exchange does not support createDepositAddress()') + } + + } else { + + console.log ('There was an error while fetching deposit address for ' + currencyCode, e.constructor.name, e.message) + } + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/fetch-first-ohlcv-timestamp.js b/docs/ccxt/examples/js/fetch-first-ohlcv-timestamp.js new file mode 100644 index 0000000..ca9779f --- /dev/null +++ b/docs/ccxt/examples/js/fetch-first-ohlcv-timestamp.js @@ -0,0 +1,79 @@ +// eslint-disable-next-line no-unused-vars +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// ###### Description ###### +// +// This function tries to fetch the "listing time" of a symbol by fetching the earliest available bar in daily resolution. +// Top-tier exchanges also support fetching smaller timeframes (eg. 1 minute) even several years back, so for those exchanges you can also use `useMinuteTimeframe = true` argument to get the timestamp rounded to the earliest minute bar (instead of daily bar timestamp). +// See usage in the end of this file +async function fetchFirstBarTimestamp(exchange, symbol, useMinuteTimeframe = false) { + // set some constants + const millisecondsPerDay = 86400000; + const minutesPerDay = 1440; + const minimumTimestamp = 1230768000000; // 2009-01-01 (bitcoin created year) + // get market features + const market = exchange.market(symbol); + const marketType = exchange.safeString(market, 'type'); + let features = exchange.safeDict(exchange.features, marketType, {}); + if (market['subType'] !== undefined) { + features = exchange.safeDict(features, market['subType'], {}); + } + const ohlcv = exchange.safeDict(features, 'fetchOHLCV'); + if (ohlcv === undefined) { + return undefined; + } + const limit = exchange.safeInteger(ohlcv, 'limit'); + const fetchParams = { 'maxRetriesOnFailure': 3 }; + // start loop + let currentSince = exchange.milliseconds() - millisecondsPerDay * (limit - 1); + let foundStartTime = 0; + // eslint-disable-next-line + while (true) { + currentSince = Math.max(currentSince, minimumTimestamp); + const dailyBars = await exchange.fetchOHLCV(symbol, '1d', currentSince, limit, fetchParams); + if (dailyBars.length <= 0) { + break; // if no days returned, then probably start date was passed + } + const firstTs = dailyBars[0][0]; + if (firstTs === foundStartTime) { + // if the first timestamp is equal to the last-fetched timestamp, then break here, because some exchanges still return initial bar even if since is much ahead to listing time + break; + } + foundStartTime = firstTs; + currentSince = foundStartTime - millisecondsPerDay * (limit - 1); // shift 'since' one step back + if (dailyBars.length === 1) { + // in some cases, some exchanges might still return first bar of chart when endtime overlaps previous day + break; + } + } + // if minute resolution needed + if (useMinuteTimeframe) { + const maxIteration = Math.ceil(minutesPerDay / limit) * 2; + const allPromises = []; + for (let i = 0; i < maxIteration; i++) { + currentSince = foundStartTime - millisecondsPerDay + i * limit * 60 * 1000; // shift one-duration back for more accuracy for different kind of exchanges, like OKX, where first daily bar is offset by one day, but minute bars present + allPromises.push(exchange.fetchOHLCV(symbol, '1m', currentSince, limit, fetchParams)); + } + const allResponses = await Promise.all(allPromises); + // find earliest bar + for (let i = 0; i < allResponses.length; i++) { + const response = allResponses[i]; + if (response.length > 0) { + foundStartTime = response[0][0]; + break; + } + } + } + return foundStartTime; +} +// ###### Usage ###### +const runExample = false; // set to true to run example +if (runExample) { + const myEx = new ccxt.binance(); + await myEx.loadMarkets(); + const symbol = 'TRUMP/USDT'; + const earliest_timestamp = await fetchFirstBarTimestamp(myEx, symbol, true); + console.log('- Earliest bar timestamp:', earliest_timestamp, ', readable: ', myEx.iso8601(earliest_timestamp)); + console.log('- market.created value:', myEx.market(symbol)['created']); +} +export default fetchFirstBarTimestamp; diff --git a/docs/ccxt/examples/js/fetch-from-many-exchanges-simultaneously.js b/docs/ccxt/examples/js/fetch-from-many-exchanges-simultaneously.js new file mode 100644 index 0000000..b3949aa --- /dev/null +++ b/docs/ccxt/examples/js/fetch-from-many-exchanges-simultaneously.js @@ -0,0 +1,21 @@ + + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; + +const symbol = 'ETH/BTC' +const exchanges = [ 'coinbasepro', 'hitbtc2', 'poloniex' ] + +;(async () => { + + const result = await Promise.all (exchanges.map (async id => { + + const exchange = new ccxt[id] () + const ticker = await exchange.fetchTicker (symbol) + return exchange.extend ({ 'exchange': id }, ticker) + + })) + + log (result); + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/fetch-funding-rate-history.js b/docs/ccxt/examples/js/fetch-funding-rate-history.js new file mode 100644 index 0000000..3835839 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-funding-rate-history.js @@ -0,0 +1,25 @@ +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; + +const table = asTable.configure ({ delimiter: ' | ' }); + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.binanceusdm() + , symbol = 'ETH/USDT' + , since = undefined + , limit = undefined + , params = {} + + // ------------------------------------------------------------------------ + // fetch the history of the funding rate for a symbol + + const response = await exchange.fetchFundingRateHistory (symbol, since, limit, params) + + console.log (table (response)) + +} + +main () diff --git a/docs/ccxt/examples/js/fetch-futures/prettier.config.js b/docs/ccxt/examples/js/fetch-futures/prettier.config.js new file mode 100644 index 0000000..f02c22e --- /dev/null +++ b/docs/ccxt/examples/js/fetch-futures/prettier.config.js @@ -0,0 +1,5 @@ +"use strict"; +module.exports = { + singleQuote: true, + trailingComma: 'es5', +}; diff --git a/docs/ccxt/examples/js/fetch-futures/src/index.js b/docs/ccxt/examples/js/fetch-futures/src/index.js new file mode 100644 index 0000000..727d107 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-futures/src/index.js @@ -0,0 +1,25 @@ +// Example code in typescript +// Based on /examples/js/fetch-okex-futures.js +import * as ccxt from 'ccxt'; +const log = require('ololog'); +const fetchFutures = async () => { + const exchange = new ccxt.bitmex(); + exchange.markets = await exchange.loadMarkets(true); + for (let symbol in exchange.markets) { + log('----------------------------------------------------'); + log(`symbol = ${symbol}`); + try { + const market = exchange.markets[symbol]; + if (market['future']) { + const ticker = await exchange.fetchTicker(symbol); + log('----------------------------------------------------'); + log(symbol, ticker); + await ccxt.sleep(exchange.rateLimit); // Missing type information. + } + } + catch (error) { + log('error =', error); + } + } +}; +fetchFutures(); diff --git a/docs/ccxt/examples/js/fetch-ohlcv-from-to-mark-index-premium.js b/docs/ccxt/examples/js/fetch-ohlcv-from-to-mark-index-premium.js new file mode 100644 index 0000000..5a74d56 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-ohlcv-from-to-mark-index-premium.js @@ -0,0 +1,72 @@ +"use strict"; + +const ccxt = require ('../../ccxt') + +const exchange = new ccxt.binance (); + +const symbols = [ 'BTC/USDT', 'ETH/USDT', 'ADA/USDT']; +// start from i.e. 01 february 2022 +// you can use milliseconds integer or also parse uniform datetime string, i.e. exchange.parse8601 ('2020-02-01T00:00:00Z') +const fromTimestamp = 1643659200000; +const tillTimestamp = exchange.milliseconds (); +const timeframe = '1h'; +const itemsLimit = 1000; +const fetchMethod = 'fetchOHLCV'; // if using swap exchanges, you can also use fetchMarkOHLCV, fetchIndexOHLCV, fetchPremiumIndexOHLCV + +async function myDataFetch (symbol) { + + await exchange.loadMarkets (); + + // get the duration of one timeframe period in milliseconds + const duration = exchange.parseTimeframe (timeframe) * 1000; + console.log ('Fetching', symbol, timeframe, 'candles', 'from', exchange.iso8601 (fromTimestamp), 'to', exchange.iso8601 (tillTimestamp), '...'); + + let result = []; + let since = fromTimestamp; + do { + + try { + + const candles = await exchange[fetchMethod] (symbol, timeframe, since, itemsLimit); + + const message = '[' + symbol + '] Fetched ' + candles.length + ' ' + timeframe + ' candles since ' + exchange.iso8601 (since); + + if (candles.length) { + + const first = candles[0]; + const last = candles[candles.length - 1]; + console.log ( message, ' | first', exchange.iso8601 (first[0]), ' | last', exchange.iso8601 (last[0]) ); + + // store your candles to a database or to a file here + // ... + result = result.concat (candles); + since = last[0] + duration // next start from last candle timestamp + duration + + } else { + console.log ( message, ' | moving into next period'); + since = since + duration * itemsLimit; // next start from the current period's end + } + + } catch (e) { + + console.log (symbol, e.constructor.name, e.message, ' Taking small pause...'); + await exchange.sleep (2000); + // retry on next iteration + } + + } while (since + duration <= tillTimestamp) + + console.log (symbol + ' completed !'); + return result; +} + + + +async function checkAllSymbols() { + // download in parallel + await Promise.all (symbols.map (symbol => myDataFetch (symbol))); + // you can also do one by one (but that is not much optimal) + //for (const symbol of symbols) { + // const data = await myDataFetch (symbol); +} +checkAllSymbols(); diff --git a/docs/ccxt/examples/js/fetch-ohlcv-many-exchanges-continuosly.js b/docs/ccxt/examples/js/fetch-ohlcv-many-exchanges-continuosly.js new file mode 100644 index 0000000..ea03c3f --- /dev/null +++ b/docs/ccxt/examples/js/fetch-ohlcv-many-exchanges-continuosly.js @@ -0,0 +1,39 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// fetch and handle constinuosly +async function fetchOHLCVContinuously(exchange, symbol) { + while (true) { + try { + const ohlcv = await exchange.fetchOHLCV(symbol); + const ohlcvLength = ohlcv.length; + console.log('Fetched ', exchange.id, ' - ', symbol, ' candles. last candle: ', ohlcv[ohlcvLength - 1]); + } + catch (e) { + console.log(e); + break; + } + } +} +// start exchanges and fetch OHLCV loop +async function startExchange(exchangeName, symbols) { + const ex = new ccxt[exchangeName]({}); + const promises = []; + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i]; + promises.push(fetchOHLCVContinuously(ex, symbol)); + } + await Promise.all(promises); + await ex.close(); +} +// main function +async function example() { + const exchanges = ['binance', 'okx', 'kraken']; + const symbols = ['BTC/USDT', 'ETH/USDT']; + const promises = []; + for (let i = 0; i < exchanges.length; i++) { + const exchangeName = exchanges[i]; + promises.push(startExchange(exchangeName, symbols)); + } + await Promise.all(promises); +} +await example(); diff --git a/docs/ccxt/examples/js/fetch-ohlcv.js b/docs/ccxt/examples/js/fetch-ohlcv.js new file mode 100644 index 0000000..659a889 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-ohlcv.js @@ -0,0 +1,16 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const myex = new ccxt.okx({}); + const fromTimestamp = myex.milliseconds() - 86400 * 1000; // last 24 hrs + const ohlcv = await myex.fetchOHLCV('BTC/USDT', '1m', fromTimestamp, 3, { 'whatever': 123 }); + const length = ohlcv.length; + if (length > 0) { + const lastPrice = ohlcv[length - 1][4]; + console.log('Fetched ', length, ' candles for ', myex.id, ': last close ', lastPrice); + } + else { + console.log('No candles have been fetched'); + } +} +await example(); diff --git a/docs/ccxt/examples/js/fetch-okex-futures.js b/docs/ccxt/examples/js/fetch-okex-futures.js new file mode 100644 index 0000000..e6fd63c --- /dev/null +++ b/docs/ccxt/examples/js/fetch-okex-futures.js @@ -0,0 +1,22 @@ + + +import ccxt from '../../js/ccxt.js'; + +async function test () { + + const exchange = new ccxt.okex () + await exchange.loadMarkets () + + for (let symbol in exchange.markets) { + + const market = exchange.markets[symbol] + + if (market['future']) { + console.log ('----------------------------------------------------') + console.log (symbol, await exchange.fetchTicker (symbol)) + await ccxt.sleep (exchange.rateLimit) + } + } +} + +test () diff --git a/docs/ccxt/examples/js/fetch-orders.js b/docs/ccxt/examples/js/fetch-orders.js new file mode 100644 index 0000000..d656bf8 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-orders.js @@ -0,0 +1,27 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; +import ansicolor from 'ansicolor'; + + +ansicolor.nice + +const exchange = new ccxt.bittrex ({ + apiKey: "YOUR_API_KEY", + secret: "YOUR_SECRET", +}) + +async function test () { + + const orders = await exchange.fetchOrders () + + log (asTable (orders.map (order => ccxt.omit (order, [ 'timestamp', 'info' ])))) + + const order = await exchange.fetchOrder (orders[0]['id']) + + log (order) +} + +test () \ No newline at end of file diff --git a/docs/ccxt/examples/js/fetch-ticker-from-multiple-exchanges.js b/docs/ccxt/examples/js/fetch-ticker-from-multiple-exchanges.js new file mode 100644 index 0000000..1f29588 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-ticker-from-multiple-exchanges.js @@ -0,0 +1,35 @@ + + +import ccxt from '../../js/ccxt.js'; +(async () => { + + const exchanges = [ + 'bittrex', + 'poloniex', + ] + + const symbol = 'BTC/USDT' + const tickers = {} + + await Promise.all (exchanges.map (exchangeId => + + new Promise (async (resolve, reject) => { + + const exchange = new ccxt[exchangeId] () + + while (true) { + + const ticker = await exchange.fetchTicker (symbol) + tickers[exchangeId] = ticker + + Object.keys (tickers).map (exchangeId => { + const ticker = tickers[exchangeId] + console.log (ticker['datetime'], exchangeId, ticker['bid'], ticker['ask']) + }) + } + + }) + + )) + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/fetch-ticker-where-available.js b/docs/ccxt/examples/js/fetch-ticker-where-available.js new file mode 100644 index 0000000..e35fd5a --- /dev/null +++ b/docs/ccxt/examples/js/fetch-ticker-where-available.js @@ -0,0 +1,75 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; +import ansicolor from 'ansicolor'; + + +ansicolor.nice + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'symbol'.green) +} + +;(async function main () { + + if (process.argv.length > 2) { + + let symbol = process.argv[2].toUpperCase () + + for (let i = 0; i < ccxt.exchanges.length; i++) { + + let id = ccxt.exchanges[i] + + const exchange = new ccxt[id] () + if (exchange.has.fetchTicker) { + + try { + + await exchange.loadMarkets () + + if (exchange.symbols.includes (symbol)) { + + log (id.green) + + const ticker = await exchange.fetchTicker (symbol) + + log.dim (ticker) + + if (ticker['baseVolume'] && ticker['quoteVolume']) { + + if (ticker['bid'] > 1) { + + if (ticker['baseVolume'] > ticker['quoteVolume']) + log (id.bright, 'baseVolume > quoteVolume ← !'.bright) + + } else { + + if (ticker['baseVolume'] < ticker['quoteVolume']) + log (id.bright, 'baseVolume < quoteVolume ← !'.bright) + + } + + } + + } else { + + log (id.yellow) + } + + } catch (e) { + + log.error (id.red, e.toString ().red) + } + } + } + + } else { + + printUsage () + } + + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/fetch-tickers/build/index.js b/docs/ccxt/examples/js/fetch-tickers/build/index.js new file mode 100644 index 0000000..5925815 --- /dev/null +++ b/docs/ccxt/examples/js/fetch-tickers/build/index.js @@ -0,0 +1,19 @@ +"use strict"; +// Example code in typescript +// Based on /examples/js/fetch-from-many-exchanges-simultaneously.js +Object.defineProperty(exports, "__esModule", { value: true }); +const ccxt = require("ccxt"); +const log = require('ololog'); +const symbol = 'BTC/USD'; +const exchanges = ['coinbasepro', 'gemini', 'kraken']; +const fetchTickers = async (symbol) => { + const result = await Promise.all(exchanges.map(async (id) => { + const CCXT = ccxt; // Hack! + const exchange = new CCXT[id]({ 'enableRateLimit': true }); + const ticker = await exchange.fetchTicker(symbol); + const exchangeExtended = exchange.extend({ 'exchange': id }, ticker); + return exchangeExtended; + })); + log(result); +}; +fetchTickers(symbol); diff --git a/docs/ccxt/examples/js/fetch-tickers/prettier.config.js b/docs/ccxt/examples/js/fetch-tickers/prettier.config.js new file mode 100644 index 0000000..f02c22e --- /dev/null +++ b/docs/ccxt/examples/js/fetch-tickers/prettier.config.js @@ -0,0 +1,5 @@ +"use strict"; +module.exports = { + singleQuote: true, + trailingComma: 'es5', +}; diff --git a/docs/ccxt/examples/js/fetch-tickers/src/index.js b/docs/ccxt/examples/js/fetch-tickers/src/index.js new file mode 100644 index 0000000..49cb36b --- /dev/null +++ b/docs/ccxt/examples/js/fetch-tickers/src/index.js @@ -0,0 +1,17 @@ +// Example code in typescript +// Based on /examples/js/fetch-from-many-exchanges-simultaneously.js +import * as ccxt from 'ccxt'; +const log = require('ololog'); +const symbol = 'BTC/USD'; +const exchanges = ['coinbasepro', 'gemini', 'kraken']; +const fetchTickers = async (symbol) => { + const result = await Promise.all(exchanges.map(async (id) => { + const CCXT = ccxt; // Hack! + const exchange = new CCXT[id]({ 'enableRateLimit': true }); + const ticker = await exchange.fetchTicker(symbol); + const exchangeExtended = exchange.extend({ 'exchange': id }, ticker); + return exchangeExtended; + })); + log(result); +}; +fetchTickers(symbol); diff --git a/docs/ccxt/examples/js/gateio-create-batch-order.js b/docs/ccxt/examples/js/gateio-create-batch-order.js new file mode 100755 index 0000000..0dce09d --- /dev/null +++ b/docs/ccxt/examples/js/gateio-create-batch-order.js @@ -0,0 +1,43 @@ +const ccxt = require ('../../ccxt'); + +console.log ('CCXT Version:', ccxt.version); + +async function main () { + + const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + await exchange.loadMarkets (); + + const ada = exchange.market ('ADA/USDT'); + const xrp = exchange.market ('XRP/USDT'); + + const orders = await exchange.privateSpotPostBatchOrders ( + [ + { + text: "t-123456", + currency_pair: ada['id'], + type: "limit", + account: "spot", + side: "buy", + amount: "3", + price: "0.4", + }, + { + text: "t-123456", + currency_pair: xrp['id'], + type: "limit", + account: "spot", + side: "buy", + amount: "3", + price: "0.47", + }, + ] + ); + + console.log (orders); + +}; + +main (); \ No newline at end of file diff --git a/docs/ccxt/examples/js/gateio-futures.js b/docs/ccxt/examples/js/gateio-futures.js new file mode 100644 index 0000000..8f58672 --- /dev/null +++ b/docs/ccxt/examples/js/gateio-futures.js @@ -0,0 +1,49 @@ +import ccxt from '../../js/ccxt.js'; + + +const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'future', + }, +}) + +;(async () => { + // exchange.setSandboxMode (true) + + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example 1: Creating a future (market) order + try { + + // find a future + const futures = [] + for (const [key, market] of Object.entries(markets)) { + if (market['future']) { + futures.push(market); + } + } + if (futures.length > 0) { + const market = futures[0]; + const symbol = market['symbol'] // example: BTC/USDT:USDT-220318 + const type = 'market' + const side = 'buy' + const amount = 1 + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + } + + } catch (e) { + console.log (e.constructor.name, e.message) + } + +}) () diff --git a/docs/ccxt/examples/js/gateio-open-close-contract.js b/docs/ccxt/examples/js/gateio-open-close-contract.js new file mode 100644 index 0000000..13acbba --- /dev/null +++ b/docs/ccxt/examples/js/gateio-open-close-contract.js @@ -0,0 +1,49 @@ +const ccxt = require ('../../ccxt'); + + +const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'swap', + 'marginMode': 'cross' + }, +}) + + +;(async () => { + + // exchange.setSandboxMode (true) + + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example: creating and closing a contract + let symbol = 'LTC/USDT:USDT' + let type = 'market' + let side = 'buy' + let amount = 1 + let price = undefined + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + console.log(balance) + + // placing an order / opening contract position + const order = await exchange.createOrder (symbol, type, side, amount, price) + console.log (order) + + // closing it by issuing an oposite contract + // and therefore close our previous position + side = 'sell' + type = 'market' + reduce_only = true + params = {'reduce_only': reduce_only} + const opositeOrder = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (opositeOrder) + } catch (e) { + console.log (e.constructor.name, e.message) + } +}) () diff --git a/docs/ccxt/examples/js/gateio-swaps.js b/docs/ccxt/examples/js/gateio-swaps.js new file mode 100644 index 0000000..dcaefe3 --- /dev/null +++ b/docs/ccxt/examples/js/gateio-swaps.js @@ -0,0 +1,74 @@ +import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) + +;(async () => { + // exchange.setSandboxMode (true) + + const markets = await exchange.loadMarkets () + + exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example 1: Creating and canceling a linear swap (limit) order + try { + const symbol = 'LTC/USDT:USDT' + const type = 'limit' + const side = 'buy' + const amount = 1 + const price = 55 + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + + // canceling an order + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + + // Example 2: Creating and canceling a linear swap (stop-limit) order with leverage + try { + const symbol = 'LTC/USDT:USDT' + const type = 'limit' + const side = 'buy' + const amount = 1 + const price = 55 + + const stopPrice = 130 + const params = { + 'stopPrice': stopPrice, + } + //set leverage + const leverage = await exchange.setLeverage(3, symbol); + console.log(leverage) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // canceling an order + const cancelParams = { + isStop: true, + }; + const cancel = await exchange.cancelOrder (order['id'], symbol, cancelParams) + console.log (cancel) + + //reset leverage + exchange.setLeverage(1, symbol); + } catch (e) { + console.log (e.constructor.name, e.message) + } + +}) () diff --git a/docs/ccxt/examples/js/gdax-fetch-trades-pagination.js b/docs/ccxt/examples/js/gdax-fetch-trades-pagination.js new file mode 100644 index 0000000..7b8e32d --- /dev/null +++ b/docs/ccxt/examples/js/gdax-fetch-trades-pagination.js @@ -0,0 +1,29 @@ +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; + +const { noLocate } = ololog; +const log = noLocate; + +const exchange = new ccxt.coinbasepro () + +;(async () => { + + const symbol = 'ETH/BTC' + const params = {} + await exchange.loadMarkets () + while (true) { + const trades = await exchange.fetchTrades (symbol, undefined, undefined, params) + if (trades.length) { + const firstTrade = trades[0] + const lastTrade = trades[trades.length - 1] + log.yellow ('Fetched', trades.length, symbol, 'trades from', firstTrade['datetime'], 'to', lastTrade['datetime']) + if ('Cb-After' in exchange.last_response_headers) { + params['after'] = exchange.last_response_headers['Cb-After']; + } + } else { + log.green ('Done.') + break; + } + } + +}) () diff --git a/docs/ccxt/examples/js/hibachi-example.js b/docs/ccxt/examples/js/hibachi-example.js new file mode 100644 index 0000000..88b37e0 --- /dev/null +++ b/docs/ccxt/examples/js/hibachi-example.js @@ -0,0 +1,113 @@ +import { hibachi } from '../../js/ccxt.js'; +import fs from 'fs'; +/* + In order to run the examples, you need to setup keys.local.json file like this: + ``` + { + "hibachi": { + "accountId": 111, + "apiKey": "1111111111111111111111111111111111111111111=", + "privateKey": "0x1111111111111111111111111111111111111111111111111111111111111111", + "publicKey": "0x11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", + "withdrawAddress": "0x1111111111111111111111111111111111111111" + } + } + ``` + You can get the accountId, apiKey and privateKey from Hibachi App by creating an API key + After that you can view the API key, it will show the publicKey (only for trustless account, you can ignore it for exchange managed account) + Note: if you are using exchange managed account, the privateKey's length will be 44 instead + The withdrawAddress can be any ethereum wallet address, that is used to receive funds for withdraw tests +*/ +async function example() { + const keys = JSON.parse(fs.readFileSync('keys.local.json', 'utf-8')); + const exchange = new hibachi(keys.hibachi); + exchange.verbose = true; + const markets = await exchange.fetchMarkets(); + console.log('fetchMarkets', markets.length, markets[0]); + const currencies = await exchange.fetchCurrencies(); + console.dir(currencies, { depth: null, colors: true }); + const trades = await exchange.fetchTrades("BTC/USDT:USDT"); + console.log('fetchTrades', trades.length, trades[0]); + const tenMinutes = 10 * 60 * 1000; + const until = Date.now(); + const since = until - tenMinutes; + const ohlcv = await exchange.fetchOHLCV('BTC/USDT:USDT', '5min', since, 100, { until }); + console.log('fetchOHLCV', ohlcv.length, ohlcv[0]); + const balance = await exchange.fetchBalance(); + console.dir(balance, { depth: null, colors: true }); + const ticker = await exchange.fetchTicker('BTC/USDT:USDT'); + console.log('fetchTicker', ticker); + // createOrder, editOrder and cancelOrder + const order1 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const order2 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002); + console.log('create market order', order1.id, order2.id); + const order3 = await exchange.createOrder('ETH/USDT:USDT', 'limit', 'buy', 1.234, 1.234); + const order4 = await exchange.editOrder(order3.id, 'ETH/USDT:USDT', 'limit', 'buy', 0.987, 1.123); + const order5 = await exchange.cancelOrder(order3.id); + console.log('create, edit and cancel limit order', order3.id, order4.id, order5.id); + // advanced order parameters + const postOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, { 'timeInForce': 'PO' }); + await exchange.cancelOrder(postOnlyOrder.id); + const iocOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, { 'timeInForce': 'IOC' }); + await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const reduceOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002, undefined, { 'reduceOnly': true }); + const triggerOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'sell', 2.0, 2.0, { 'triggerPrice': '2.0' }); + await exchange.cancelOrder(triggerOrder.id); + console.log('postOnly, IOC, reduceOnly, trigger order', postOnlyOrder.id, iocOrder.id, reduceOnlyOrder.id, triggerOrder.id); + const order1_info = await exchange.fetchOrder(order1.id, 'BTC/USDT:USDT'); + console.log('fetchOrder', order1_info); + const orderbook = await exchange.fetchOrderBook('BTC/USDT:USDT'); + console.log('fetchOrderBook', orderbook); + const withdrawResponse = await exchange.withdraw('USDT', 0.02, keys.hibachi.withdrawAddress); + console.log(withdrawResponse); + const myTrades = await exchange.fetchMyTrades('BTC/USDT:USDT', undefined, 1); + console.log('fetchMyTrades', myTrades); + const tradingFees = await exchange.fetchTradingFees(); + console.log('fetchTradingFees', tradingFees); + const openOrders = await exchange.fetchOpenOrders(); + console.log('fetchOpenOrders', openOrders); + const openOrdersWithLimit = await exchange.fetchOpenOrders(undefined, undefined, 1); + console.log('fetchOpenOrdersWithLimit', openOrdersWithLimit); + const openOrdersBTC = await exchange.fetchOpenOrders('BTC/USDT:USDT'); + console.log('fetchOpenOrdersBTC', openOrdersBTC); + const openOrdersSince = await exchange.fetchOpenOrders(undefined, 1752552000000); // 7/15/2025 00:00 UTC + console.log('fetchOpenOrdersSince', openOrdersSince); + if (keys.hibachi.publicKey !== undefined) { + const depositAddress = await exchange.fetchDepositAddress('USDT', { 'publicKey': keys.hibachi.publicKey }); + console.log('fetchDepositAddress', depositAddress); + } + const ledger = await exchange.fetchLedger('USDT', undefined, 2); + console.log('fetchLedger', ledger); + const deposits = await exchange.fetchDeposits(); + console.log('fetchDeposits', deposits); + const withdrawals = await exchange.fetchWithdrawals(); + console.log('fetchWithdrawals', withdrawals); + const timestamp = await exchange.fetchTime(); + console.log('fetchTime', timestamp); + const openInterest = await exchange.fetchOpenInterest('BTC/USDT:USDT'); + console.log('fetchOpenInterest', openInterest); + const fundingRate = await exchange.fetchFundingRate('BTC/USDT:USDT'); + console.log('fetchFundingRate', fundingRate); + const fundingRateHistory = await exchange.fetchFundingRateHistory('BTC/USDT:USDT', undefined, 2); + console.log('fetchFundingRateHistory', fundingRateHistory); + // Batch orders + const createOrders = await exchange.createOrders([ + { 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.234, 'price': 1.234 }, + { 'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.001, 'price': 1.001 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.002, 'price': 1.002 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.003, 'price': 1.003 }, + ]); + console.log('createOrders', createOrders); + const editOrders = await exchange.editOrders([ + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + { 'id': createOrders[0].id, 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.111, 'price': 0.999 }, + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + { 'id': createOrders[1].id, 'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.112, 'price': 0.998 }, + ]); + console.log('editOrders', editOrders); + const cancelOrders = await exchange.cancelOrders([createOrders[0].id, createOrders[1].id]); + console.log('cancelOrders', cancelOrders); + const cancelAll = await exchange.cancelAllOrders('ETH/USDT:USDT'); + console.log(cancelAll); +} +example(); diff --git a/docs/ccxt/examples/js/hitbtc2-withdraw.js b/docs/ccxt/examples/js/hitbtc2-withdraw.js new file mode 100644 index 0000000..9ad3729 --- /dev/null +++ b/docs/ccxt/examples/js/hitbtc2-withdraw.js @@ -0,0 +1,61 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +const log = ololog.configure ({ locate: false }) + +require ('ansicolor').nice + +const getPositiveAccounts = function (balance) { + const result = {} + Object.keys (balance) + .filter (currency => balance[currency] && (balance[currency] > 0)) + .forEach (currency => { + result[currency] = balance[currency] + }) + return result +} + +;(async () => { + + // instantiate the exchange + let exchange = new ccxt.hitbtc2 ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }) + + try { + + let tradingBalance = await exchange.fetchBalance () + let accountBalance = await exchange.fetchBalance ({ type: 'account' }) + + log.cyan ('Trading balance:', getPositiveAccounts (tradingBalance.total)) + log.magenta ('Account balance:', getPositiveAccounts (accountBalance.total)) + + // withdraw + let withdraw = await exchange.withdraw ('ETH', 0.01, '0x811DCfeb6dC0b9ed825808B6B060Ca469b83fB81') + + // output the result + log (exchange.name.green, 'withdraw', withdraw) + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + log.bright.yellow ('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow ('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow ('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow ('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow ('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow ('[Network Error] ' + e.message) + } else { + throw e + } + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/how-to-import-one-exchange-esm.js b/docs/ccxt/examples/js/how-to-import-one-exchange-esm.js new file mode 100644 index 0000000..03ff5da --- /dev/null +++ b/docs/ccxt/examples/js/how-to-import-one-exchange-esm.js @@ -0,0 +1,10 @@ +import { binance } from '../../js/ccxt.js'; +async function example() { + const exchange = new binance({}); + const ob = await exchange.fetchOrderBook('BTC/USDT', 3); + const asks = ob['asks']; + const bids = ob['bids']; + console.log(asks); + console.log(bids); +} +example(); diff --git a/docs/ccxt/examples/js/huobi-futures.js b/docs/ccxt/examples/js/huobi-futures.js new file mode 100644 index 0000000..a83e23d --- /dev/null +++ b/docs/ccxt/examples/js/huobi-futures.js @@ -0,0 +1,71 @@ +import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'future', + }, +}) + +;(async () => { + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // creating and canceling a linear future (limit) order + let symbol = 'ETH/USDT:USDT-220121' // the last segment is the date of expiration (can be next week, next quarter, ...) adjust it accordingly + let type = 'limit' + let side = 'buy' + let offset= 'open' + let leverage = 1 + let amount = 1 + let price = 1 + let params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + // console.log(balance) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + + // canceling an order + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + + // creating and canceling a inverse future (limit) order + symbol = 'ADA/USD:ADA-220121' // the last segment is the date of expiration (can be next week, next quarter, ...) adjust it accordingly + type = 'limit' + side = 'buy' + offset= 'open' + leverage = 1 + amount = 1 + price = 1 // 1 contract = 10 ADA = 10 usd in this case + params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + +}) () diff --git a/docs/ccxt/examples/js/huobi-open-close-contract.js b/docs/ccxt/examples/js/huobi-open-close-contract.js new file mode 100644 index 0000000..d408be0 --- /dev/null +++ b/docs/ccxt/examples/js/huobi-open-close-contract.js @@ -0,0 +1,63 @@ +import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'swap', + 'marginMode': 'cross' + }, +}) + +;(async () => { + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example: creating and closing a contract + let symbol = 'ADA/USDT:USDT' // market positions for contracts not available + let type = 'limit' + let side = 'buy' + let offset= 'open' + let leverage = 1 + let amount = 1 + let price = 1 + let clientOrderId = 6; + let params = { + 'offset': offset, + 'lever_rate': leverage, + 'client_order_id': clientOrderId + } + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + console.log(balance) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // fetching position + const position = await exchange.fetchPosition(symbol) + console.log(position) + + + // closing it by issuing an oposite contract + // warning: since we can only place limit orders + // it might take a while (depending on the price we choose and market fluctuations) + // to the order be fulfilled + // and therefore close our previous position + side = 'sell' + type = 'limit' + offset = 'close' + reduce_only = 1 // 1 : yes, 0: no + clientOrderId = 9 + price = 1.147 // adjust this accordingly + params = {'offset': offset, 'reduce_only': reduce_only, 'client_order_id': clientOrderId} + const opositeOrder = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (opositeOrder) + } catch (e) { + console.log (e.constructor.name, e.message) + } +}) () diff --git a/docs/ccxt/examples/js/huobi-swaps.js b/docs/ccxt/examples/js/huobi-swaps.js new file mode 100644 index 0000000..c62356a --- /dev/null +++ b/docs/ccxt/examples/js/huobi-swaps.js @@ -0,0 +1,70 @@ +import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) + +;(async () => { + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // creating and canceling a linear swap (limit) order + let symbol = 'ADA/USDT:USDT' + let type = 'limit' + let side = 'buy' + let offset= 'open' + let leverage = 1 + let amount = 1 + let price = 1 // 1 contract = 10 ADA = 10 usd in this case + let params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + // console.log(balance) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + + // canceling an order + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + + // creating and canceling an inverse swap (limit) order + symbol = 'ADA/USD:ADA' + type = 'limit' + side = 'buy' + offset = 'open' + leverage = 1 + amount = 1 + price = 1 // 1 contract = 10 ADA = 10 usd in this case + params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } +}) () diff --git a/docs/ccxt/examples/js/huobipro-market-buy-sell-fetch-trading-limits.js b/docs/ccxt/examples/js/huobipro-market-buy-sell-fetch-trading-limits.js new file mode 100644 index 0000000..d7743df --- /dev/null +++ b/docs/ccxt/examples/js/huobipro-market-buy-sell-fetch-trading-limits.js @@ -0,0 +1,98 @@ +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' + +const log = ololog.configure .unlimited.handleNodeErrors (), + { NotSupported } = ccxt, + enableRateLimit = true, + symbol = 'ADA/BTC', + side = 'buy', + // set createMarketBuyOrderRequiresPrice to true or false to see the difference + type = 'market', + // default is true + createMarketBuyOrderRequiresPrice = true, + amount = 191.03, + price = 0.000011, + options = { createMarketBuyOrderRequiresPrice }, + exchange = new ccxt.huobipro ({ enableRateLimit, options }); + +// This is an example that demonstrates the issues discussed here: +// https://github.com/ccxt/ccxt/issues/564 +// https://github.com/ccxt/ccxt/issues/3427 +// https://github.com/ccxt/ccxt/issues/3460 +// https://github.com/ccxt/ccxt/issues/4799 + +log.green ('CCXT', ccxt.version) + +;(async () => { + + // preload them first + await exchange.loadMarkets () + + // huobipro has this + if (!exchange.has['fetchTradingLimits']) { + throw new NotSupported (exchange.id + ' does not have fetchTradingLimits() yet, make sure your version of CCXT is up to date'); + } + + // In this particular case it requires an array of symbols + // otherwise it will load all of them one by one. + // Loading all limits without specifying + // the array of symbols might take a lot of time. + + // The array of symbols will contain just one symbol of interest. + const arrayOfSymbols = [ symbol ] + + const allLimits = await exchange.fetchTradingLimits (arrayOfSymbols) + + // { 'ADA/BTC': { info: { symbol: "adabtc", + // 'buy-limit-must-less-than': 1.1, + // 'sell-limit-must-greater-than': 0.9, + // 'limit-order-must-greater-than': 0.1, + // 'limit-order-must-less-than': 5000000, + // 'market-buy-order-must-greater-than': 0.0001, + // 'market-buy-order-must-less-than': 100, + // 'market-sell-order-must-greater-than': 0.1, + // 'market-sell-order-must-less-than': 500000, + // 'limit-order-before-open-greater-than': 999999999, + // 'limit-order-before-open-less-than': 0, + // 'circuit-break-when-greater-than': 10000, + // 'circuit-break-when-less-than': 10, + // 'market-sell-order-rate-must-less-than': 0.1, + // 'market-buy-order-rate-must-less-than': 0.1 }, + // limits: { amount: { min: 0.1, max: 5000000 } } } } + + const limits = allLimits[symbol] + log.yellow (symbol, 'limits:') + log.yellow (limits) + + // To make things a bit more complicated huobipro specifies + // different minimums for market and limit orders + // and different minimums for buy/sell directions + // therefore we have to work with it in an exchange-specific way + // using the 'info' field from the response – that is + // until this aspect is completely unified in ccxt. + + const info = limits['info'] + const typeSide = type + '-' + side + + const min = info[typeSide + '-order-must-greater-than'] + const max = info[typeSide + '-order-must-less-than'] + + // huobipro requires the amount in quote currency for market sell orders + // huobipro requires the cost in quote currency for market buy orders + // cost = amount * price + + const cost = createMarketBuyOrderRequiresPrice ? (amount * price) : amount + + let color = 'red' + + if ((min !== undefined) && (cost < min)) { + log[color] ('The cost is below minimum:', cost, '<', min) + } else if ((max !== undefined) && (cost > max)) { + log[color] ('The cost is above maximum:', cost, '>', max) + } else { + color = 'green' + } + + log[color] ({ min, max, cost }) + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/hybridCJSExample.cjs b/docs/ccxt/examples/js/hybridCJSExample.cjs new file mode 100644 index 0000000..af424e5 --- /dev/null +++ b/docs/ccxt/examples/js/hybridCJSExample.cjs @@ -0,0 +1,19 @@ + +const ccxt = require('ccxt'); + +console.log('--------------------------------------------') +console.log('Yey importing ccxt as a cjs module!!!!!') +console.log('Version:', ccxt.version) +console.log('--------------------------------------------') + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) +;(async () => { +const result = await exchange.fetchBalance(); +console.log(result) +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/hybridESMExample.js b/docs/ccxt/examples/js/hybridESMExample.js new file mode 100644 index 0000000..77f90fc --- /dev/null +++ b/docs/ccxt/examples/js/hybridESMExample.js @@ -0,0 +1,19 @@ +import {version, huobi} from 'ccxt'; + +console.log('--------------------------------------------') +console.log('Yey importing ccxt as an ESM module!!!!!') +console.log('Version:', version) +console.log('--------------------------------------------') + +const exchange = new huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) + +;(async () => { + const result = await exchange.fetchBalance(); + console.log(result) + }) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/idex-fetch-balance.js b/docs/ccxt/examples/js/idex-fetch-balance.js new file mode 100644 index 0000000..8275023 --- /dev/null +++ b/docs/ccxt/examples/js/idex-fetch-balance.js @@ -0,0 +1,13 @@ +import ccxt from '../../js/ccxt.js'; + +const idex = ccxt.idex ({ + 'apiKey': 'YOUR_IDEX_API_KEY', + 'secret': 'YOUR_IDEX_SECRET', + 'walletAddress': '0xYOUR_ETHEREUM_WALLET_ADDRESS', + 'privateKey': '0xYOUR_ETHEREUM_PRIVATE_KEY', + 'verbose': 0, +}) + +;(async () => { + console.log (await idex.fetchBalance ()) +}) () diff --git a/docs/ccxt/examples/js/instantiate-all-at-once.js b/docs/ccxt/examples/js/instantiate-all-at-once.js new file mode 100644 index 0000000..c784171 --- /dev/null +++ b/docs/ccxt/examples/js/instantiate-all-at-once.js @@ -0,0 +1,46 @@ + + +import ccxt from '../../js/ccxt.js'; + +async function test () { + + let exchanges = { + "bittrex": { + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }, + "bitfinex": { + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET" + }, + } + + let ids = ccxt.exchanges.filter (id => id in exchanges) + + await Promise.all (ids.map (async id => { + + console.log (exchanges[id]) + + // instantiate the exchange + let exchange = new ccxt[id] (exchanges[id]) + console.log (exchange.id, exchange.apiKey) + exchanges[id] = exchange + + // load markets + await exchange.loadMarkets () + console.log (exchange.id, 'loaded') + + // check the balance + if (exchange.apiKey) { + let balance = await exchange.fetchBalance () + console.log (exchange.id, balance) + } + + return exchange + })) + + // when all of them are ready, do your other things + console.log ('Loaded exchanges:', ids.join (', ')) +} + +test () diff --git a/docs/ccxt/examples/js/instantiate-all-from-json.js b/docs/ccxt/examples/js/instantiate-all-from-json.js new file mode 100644 index 0000000..d058252 --- /dev/null +++ b/docs/ccxt/examples/js/instantiate-all-from-json.js @@ -0,0 +1,31 @@ + + +import ccxt from '../../js/ccxt.js'; +import settings from './credentials.json'; + +async function test () { + + const ids = ccxt.exchanges.filter (id => id in settings) + + const exchanges = ccxt.indexBy (await Promise.all (ids.map (async id => { + + // instantiate the exchange + let exchange = new ccxt[id] (settings[id]) + + // load markets + await exchange.loadMarkets () + + // check the balance + if (exchange.apiKey) { + let balance = await exchange.fetchBalance () + console.log (exchange.id, balance['free']) + } + + return exchange + })), 'id') + + // when all of them are ready, do your other things + console.log ('Loaded exchanges:', Object.keys (exchanges).join (', ')) +} + +test () diff --git a/docs/ccxt/examples/js/kraken-create-and-close-position.js b/docs/ccxt/examples/js/kraken-create-and-close-position.js new file mode 100644 index 0000000..de0c10f --- /dev/null +++ b/docs/ccxt/examples/js/kraken-create-and-close-position.js @@ -0,0 +1,54 @@ +// @ts-nocheck +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +console.log('CCXT Version:', ccxt.version); +// ------------------------------------------------------------------------------ +async function example() { + const exchange = new ccxt.kraken({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + }); + const symbol = 'UNI/USD'; + let side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'market'; // set it to 'market' or 'limit' + const amount = 1; + const leverage = 2; + await exchange.loadMarkets(); + const market = exchange.market(symbol); + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + // you can fetch the ticker and update price + // const ticker = await exchange.fetchTicker (symbol); + // const last_price = ticker['last']; + // const ask_price = ticker['ask']; + // const bid_price = ticker['bid']; + // if (order_type === 'limit') { + // price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + // } + const params = { + 'leverage': leverage, + }; + // log + console.log('Going to open a position', 'for', amount, 'worth', amount, market['base'], '~', market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision(symbol, price) : ''), '), using the following params:'); + console.log(params); + console.log('-----------------------------------------------------------------------'); + // exchange.verbose = True // uncomment for debugging purposes if necessary + try { + const created_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + console.log("Created an order", created_order); + // Fetch all your closed orders for this symbol (because we used market order) + // - use 'fetchClosedOrders' or 'fetchOrders' and filter with 'closed' status + const all_closed_orders = await exchange.fetchClosedOrders(symbol); + console.log("Fetched all your closed orders for this symbol", all_closed_orders); + const all_open_positions = await exchange.fetchPositions(symbol); + console.log("Fetched all your positions for this symbol", all_open_positions); + // To close a position: + // - long position (buy), you can create a sell order: exchange.createOrder (symbol, order_type, 'sell', amount, price, params); + // - short position (sell), you can create a buy order: exchange.createOrder (symbol, order_type, 'buy', amount, price, params); + } + catch (e) { + console.log(e.toString()); + } +} +await example(); diff --git a/docs/ccxt/examples/js/kraken-fetch-order-trades.js b/docs/ccxt/examples/js/kraken-fetch-order-trades.js new file mode 100644 index 0000000..0c934e6 --- /dev/null +++ b/docs/ccxt/examples/js/kraken-fetch-order-trades.js @@ -0,0 +1,33 @@ +import ccxt from '../../js/ccxt.js'; + +(async () => { + + const exchange = new ccxt.kraken ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + // 'verbose': true, + }) + + const orders = await exchange.fetchClosedOrders (); + + for (let i = 0; i < orders.length; i++) { + const order = await exchange.fetchOrder (orders[i]['id']); + const trades = await exchange.fetchOrderTrades (order['id'], undefined, undefined, undefined, order); + console.log (trades); + } + + // + // alternatively: + // + // const params = { + // 'trades': [ + // 'TT5UC3-GOIRW-6AZZ6R', + // 'TIY6G4-LKLAI-Y3GD4A', + // 'T57FVC-OB4LN-Z55WUL', + // 'TIMIRG-WUNNE-RRJ6GT', + // ] + // } + // + // const trades = await exchange.fetchOrderTrades (order['id'], undefined, undefined, undefined, params); + +}) () diff --git a/docs/ccxt/examples/js/kraken-margin-trading.js b/docs/ccxt/examples/js/kraken-margin-trading.js new file mode 100644 index 0000000..23ee548 --- /dev/null +++ b/docs/ccxt/examples/js/kraken-margin-trading.js @@ -0,0 +1,89 @@ + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.kraken ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }) + + console.log ('-----------------------------------------------------------') + + console.log ('Loading markets...') + const markets = await exchange.loadMarkets () + console.log ('Markets loaded') + + // exchange.verbose = true // uncomment for debugging purposes + + try { + + const symbol = 'ETH/USDT' + , market = exchange.market (symbol) + , { base, quote } = market + , type = 'market' + , amount = market['limits']['amount']['min'] + , price = undefined + , params = { + 'leverage': 2, + } + + console.log ('-----------------------------------------------------------') + + // https://www.kraken.com/en-us/features/api#add-standard-order + + console.log ('Placing order...') + let order = await exchange.createOrder (symbol, type, 'buy', amount, price, params) + console.log ('Order placed:') + console.log (order) + + console.log ('-----------------------------------------------------------') + + // https://www.kraken.com/en-us/features/api#get-open-positions + + console.log ('Fetching open positions...') + const positionsParams = { 'docalcs': true } + let openPositions = await exchange.fetchPositions (positionsParams) + console.log ('Current positions:') + console.log (openPositions) + + console.log ('-----------------------------------------------------------') + + console.log ('Fetching balance...') + let balance = await exchange.fetchTotalBalance () + console.log ('Fetched balance:') + console.log (base, balance[base], '(base)') + console.log (quote, balance[quote], '(quote)') + + console.log ('-----------------------------------------------------------') + + console.log ('Closing the position...') + order = await exchange.createOrder (symbol, type, 'sell', amount, price, params) + console.log ('Got a response:') + console.log (order) + + console.log ('-----------------------------------------------------------') + + console.log ('Fetching open positions again...') + openPositions = await exchange.fetchPositions (positionsParams) + console.log ('Current positions:') + console.log (openPositions) + + console.log ('-----------------------------------------------------------') + + console.log ('Fetching balance...') + balance = await exchange.fetchTotalBalance () + console.log ('Fetched balance:') + console.log (base, balance[base], '(base)') + console.log (quote, balance[quote], '(quote)') + + } catch (e) { + + console.log (e.constructor.name, e.message) + } +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/kucoin-rate-limit.js b/docs/ccxt/examples/js/kucoin-rate-limit.js new file mode 100644 index 0000000..88fec1f --- /dev/null +++ b/docs/ccxt/examples/js/kucoin-rate-limit.js @@ -0,0 +1,38 @@ + + +import ccxt from '../../js/ccxt.js'; + +async function main () { + + const exchange = new ccxt.kucoin() + const markets = await exchange.loadMarkets () + const timeframe = '5m' + const symbol = 'BTC/USDT' + const since = undefined + const limit = 1000 + + let i = 0 + while (true) { + try { + const ohlcvs = await exchange.fetchOHLCV(symbol, timeframe, since, limit) + const now = exchange.milliseconds() + const datetime = exchange.iso8601(now) + console.log(datetime, i, 'fetched', ohlcvs.length, symbol, timeframe, 'candles', + 'from', exchange.iso8601(ohlcvs[0][0]), + 'to', exchange.iso8601(ohlcvs[ohlcvs.length-1][0])) + } catch (e) { + if (e instanceof ccxt.RateLimitExceeded) { + const now = exchange.milliseconds() + const datetime = exchange.iso8601(now) + console.log(datetime, i, e.constructor.name, e.message) + await exchange.sleep(10000) + } else { + console.log(e.constructor.name, e.message) + throw e + } + } + i += 1 + } +} + +main () diff --git a/docs/ccxt/examples/js/latoken-example.js b/docs/ccxt/examples/js/latoken-example.js new file mode 100644 index 0000000..8956614 --- /dev/null +++ b/docs/ccxt/examples/js/latoken-example.js @@ -0,0 +1,108 @@ + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; +import asTable from 'as-table'; + + +const table = asTable.configure ({ delimiter: ' | ' }), + //----------------------------------------------------------------------------- + log = ololog.unlimited.noLocate.handleNodeErrors ();(async function main () { + + const symbol = 'BTC/USDT' + + const exchange = new ccxt.latoken ({ + 'verbose': process.argv.includes ('--verbose'), + // uncomment and change for your keys to enable private calls + // 'apiKey': 'YOUR_API_KEY', + // 'secret': 'YOUR_API_SECRET', + }) + + await exchange.loadMarkets () + + log ('-------------------------------------------------------------------') + + log (exchange.id, 'has', exchange.has) + + // public API + + log ('-------------------------------------------------------------------') + + const markets = Object.values (exchange.markets) + log ('Loaded', markets.length, exchange.id, 'markets:') + log (table (markets.map (x => exchange.omit (x, [ 'info', 'limits', 'precision' ])))) + + log ('-------------------------------------------------------------------') + + const currencies = Object.values (exchange.currencies) + log ('Loaded', currencies.length, exchange.id, 'currencies:') + log (table (currencies.map (x => exchange.omit (x, [ 'info', 'limits' ])))) + + log ('-------------------------------------------------------------------') + + const time = await exchange.fetchTime () + log ('Exchange time:', exchange.iso8601 (time)) + + log ('-------------------------------------------------------------------') + + const ticker = await exchange.fetchTicker (symbol) + log (ticker) + + log ('-------------------------------------------------------------------') + + const tickers = await exchange.fetchTickers () + log (table (Object.values (tickers).map (x => + exchange.omit (x, [ 'info', 'bid', 'ask', 'bidVolume', 'askVolume', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const orderbook = await exchange.fetchOrderBook (symbol) + log (orderbook) + + log ('-------------------------------------------------------------------') + + const trades = await exchange.fetchTrades (symbol) + log (table (trades.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + // private API + + if (exchange.checkRequiredCredentials (false)) { + + const balance = await exchange.fetchBalance () + log (exchange.omit (balance, [ 'info' ])) + + log ('-------------------------------------------------------------------') + + const order = await exchange.createOrder (symbol, 'limit', 'buy', 0.001, 10000) + log (order) + + log ('-------------------------------------------------------------------') + + const openOrders = await exchange.fetchOpenOrders (symbol) + log (table (openOrders.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const canceled = await exchange.cancelOrder (order['id'], order['symbol']) + log (canceled) + + log ('-------------------------------------------------------------------') + + const closedOrders = await exchange.fetchClosedOrders (symbol) + log (table (closedOrders.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const canceledOrders = await exchange.fetchCanceledOrders (symbol) + log (table (canceledOrders.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const myTrades = await exchange.fetchMyTrades (symbol) + log (table (myTrades.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/live-orderbook.js b/docs/ccxt/examples/js/live-orderbook.js new file mode 100644 index 0000000..f742bec --- /dev/null +++ b/docs/ccxt/examples/js/live-orderbook.js @@ -0,0 +1,106 @@ + + +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'exchange'.green, 'symbol'.yellow, 'depth'.cyan) + printSupportedExchanges () +} + +let printOrderBook = async (id, symbol, depth) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] () + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + // output a list of all market symbols + // log (id.green, 'has', exchange.symbols.length, 'symbols:', exchange.symbols.join (', ').yellow) + + if (symbol in exchange.markets) { + + const market = exchange.markets[symbol] + const pricePrecision = market.precision ? market.precision.price : 8 + const amountPrecision = market.precision ? market.precision.amount : 8 + + // Object.values (markets).forEach (market => log (market)) + + // make a table of all markets + // const table = asTable.configure ({ delimiter: ' | ' }) (Object.values (markets)) + // log (table) + + const priceVolumeHelper = color => ([price, amount]) => ({ + price: price.toFixed (pricePrecision)[color], + amount: amount.toFixed (amountPrecision)[color], + ' ': ' ', + }) + + const cursorUp = '\u001b[1A' + const tableHeight = depth * 2 + 4 // bids + asks + headers + + log (' ') // empty line + + while (true) { + + const orderbook = await exchange.fetchOrderBook (symbol) + + log (symbol.green, exchange.iso8601 (exchange.milliseconds ())) + + log (asTable.configure ({ delimiter: ' | '.dim, right: true }) ([ + ... orderbook.asks.slice (0, depth).reverse ().map (priceVolumeHelper ('red')), + // { price: '--------'.dim, amount: '--------'.dim }, + ... orderbook.bids.slice (0, depth).map (priceVolumeHelper ('green')), + ])) + + log (cursorUp.repeat (tableHeight)) + } + + } else { + + log.error ('Symbol', symbol.bright, 'not found') + } + + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 4) { + + const id = process.argv[2] + const symbol = process.argv[3].toUpperCase () + const depth = parseInt (process.argv[4]) + await printOrderBook (id, symbol, depth) + + } else { + + printUsage () + } + + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/live-ticker.js b/docs/ccxt/examples/js/live-ticker.js new file mode 100644 index 0000000..c653977 --- /dev/null +++ b/docs/ccxt/examples/js/live-ticker.js @@ -0,0 +1,80 @@ + + +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'exchange'.green, 'symbol'.yellow, '[rateLimit]'.magenta) + printSupportedExchanges () +} + +let printTicker = async (id, symbol, rateLimit = undefined) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] () + + exchange.rateLimit = rateLimit ? rateLimit : exchange.rateLimit + + log.green ('Rate limit:', exchange.rateLimit.toString ().bright) + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + if (symbol in exchange.markets) { + + while (true) { + + const ticker = await exchange.fetchTicker (symbol) + + log ('--------------------------------------------------------') + log (exchange.id.green, symbol.yellow, exchange.iso8601 (exchange.milliseconds ())) + log (ccxt.omit (ticker, 'info')) + } + + } else { + + log.error ('Symbol', symbol.bright, 'not found') + } + + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 3) { + + const id = process.argv[2] + const symbol = process.argv[3].toUpperCase () + const rateLimit = process.argv[4] ? parseInt (process.argv[4]) : undefined + await printTicker (id, symbol, rateLimit) + + } else { + + printUsage () + } + + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/live-tickers.js b/docs/ccxt/examples/js/live-tickers.js new file mode 100644 index 0000000..d70dddd --- /dev/null +++ b/docs/ccxt/examples/js/live-tickers.js @@ -0,0 +1,74 @@ + + +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +ansicolor.nice + +const { noLocate } = ololog; +const log = noLocate; + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'exchange'.green) + printSupportedExchanges () +} + +let printTickers = async (id) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] () + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + while (true) { + + const tickers = await exchange.fetchTickers () + + log ('--------------------------------------------------------') + log (exchange.id.green, exchange.iso8601 (exchange.milliseconds ())) + log ('Fetched', Object.values (tickers).length.toString ().green, 'tickers:') + log (asTable.configure ({ delimiter: ' | '.dim, right: true }) ( + ccxt.sortBy (Object.values (tickers), 'quoteVolume', true) + .slice (0,20) + .map (ticker => ({ + symbol: ticker['symbol'], + price: ticker['last'].toFixed (8), + datetime: ticker['datetime'], + })))) + } + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 2) { + + const id = process.argv[2] + await printTickers (id) + + } else { + + printUsage () + } + + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/load-all-contracts.js b/docs/ccxt/examples/js/load-all-contracts.js new file mode 100644 index 0000000..f00c65f --- /dev/null +++ b/docs/ccxt/examples/js/load-all-contracts.js @@ -0,0 +1,41 @@ +"use strict"; + +const ccxt = require ('../../js/ccxt.js') + +console.log ('CCXT Version:', ccxt.version) + +async function loadExchange (exchange) { + try { + await exchange.loadMarkets () + exchange.symbols.map (symbol => { + const market = exchange.market (symbol) + if (market['contract']) { + console.log (exchange.id, 'loaded', market['type'], symbol, 'market') + } + }) + } catch (e) { + console.log (e.constructor.name, e.message) + } +} + +async function loadAllExchanges (exchangeId) { + try { + + const exchanges = []; + [ 'swap', 'future', 'options' ].forEach (defaultType => { + const exchange = new ccxt[exchangeId]() + if (exchange.has[defaultType]) { + exchanges.push (exchange); + } + }) + await Promise.all (exchanges.map (exchange => loadExchange (exchange))) + } catch (e) { + console.log (e.constructor.name, e.message) + } +} + +async function main () { + await Promise.all (ccxt.exchanges.map (exchangeId => loadAllExchanges (exchangeId))) +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/load-all-symbols-at-once.js b/docs/ccxt/examples/js/load-all-symbols-at-once.js new file mode 100644 index 0000000..7fd732e --- /dev/null +++ b/docs/ccxt/examples/js/load-all-symbols-at-once.js @@ -0,0 +1,69 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +//----------------------------------------------------------------------------- + +let test = async function (exchange) { + + try { + + await exchange.loadMarkets () + log (exchange.id.green, 'loaded', exchange.symbols.length.toString ().bright.green, 'symbols') + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection) { + log.bright.yellow (exchange.id, '[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id, '[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id, '[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id, '[Exchange Not Available] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id, '[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow (exchange.id, '[Network Error] ' + e.message) + } else { + throw e + } + } +} + +//----------------------------------------------------------------------------- + +let exchanges = [] + +async function main () { + + // instantiate all exchanges + await Promise.all (ccxt.exchanges.map (async id => { + let exchange = new (ccxt)[id] () + exchanges.push (exchange) + await test (exchange) + })) + + let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green + let failed = exchanges.filter (exchange => exchange.markets ? false : true).length + let total = ccxt.exchanges.length.toString ().bright.white + let numSymbols = 0; + exchanges.map (exchange => { + numSymbols += exchange.symbols ? exchange.symbols.length : 0; + }) + log (numSymbols, 'symbols from', succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) + +} + +main () diff --git a/docs/ccxt/examples/js/load-all-tickers-at-once.js b/docs/ccxt/examples/js/load-all-tickers-at-once.js new file mode 100644 index 0000000..68916ed --- /dev/null +++ b/docs/ccxt/examples/js/load-all-tickers-at-once.js @@ -0,0 +1,91 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +//----------------------------------------------------------------------------- + +let human_value = function (price) { + return price === undefined ? 'N/A' : price +} + +//----------------------------------------------------------------------------- + +let test = async function (exchange, symbol) { + + try { + + await exchange.loadMarkets () + + if (symbol in exchange.markets) { + + let ticker = await exchange.fetchTicker (symbol) + + log (exchange.id.green, symbol.green, 'ticker', + ticker['datetime'], + 'high: ' + human_value (ticker['high']), + 'low: ' + human_value (ticker['low']), + 'bid: ' + human_value (ticker['bid']), + 'ask: ' + human_value (ticker['ask']), + 'volume: ' + human_value (ticker['quoteVolume'])) + } else { + + // do nothing or throw an error + log.bright.yellow (exchange.id + ' does not have ' + symbol) + } + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection) { + log.bright.yellow (exchange.id, '[DDoS Protection]') + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id, '[Request Timeout]') + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id, '[Authentication Error]') + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id, '[Exchange Not Available]') + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id, '[Exchange Error]') + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow (exchange.id, '[Network Error]') + } else { + throw e + } + } +} + +//----------------------------------------------------------------------------- + +const symbol = 'BTC/USD' + +//----------------------------------------------------------------------------- + +async function main () { + + let exchanges = [] + + // instantiate all exchanges + await Promise.all (ccxt.exchanges.map (async id => { + let exchange = new (ccxt)[id] () + exchanges.push (exchange) + await test (exchange, symbol) + })) + + let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green + let failed = exchanges.filter (exchange => exchange.markets ? false : true).length + let total = ccxt.exchanges.length.toString ().bright.white + console.log (succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) +} + +main () diff --git a/docs/ccxt/examples/js/load-markets-to-files.js b/docs/ccxt/examples/js/load-markets-to-files.js new file mode 100644 index 0000000..8ff33bf --- /dev/null +++ b/docs/ccxt/examples/js/load-markets-to-files.js @@ -0,0 +1,57 @@ + + +import ccxt from '../../js/ccxt.js'; +import path from 'path'; +import fs from 'fs'; + +const enableRateLimit = true, + // exchange defaults + // ------------------------------------------------------------------------ + // path to your folder, for example '/myproject/markets' or 'C:/myproject/markets' + options = { enableRateLimit }, + // writes to current working directory if left empty + // ------------------------------------------------------------------------ + // use a reasonable value for maxConcurrency to avoid network congestion + // a burst of requests in a short period of time will cause + // excessive competition for networking resources within the application + folder = '', + maxConcurrency = 7; + +async function main () { + + const allExchanges = ccxt.exchanges.map (id => { + try { + return new ccxt[id] (options) + } catch (e) { + console.log ('Failed to initialize', id, e.constructor.name) + } + }).filter (x => x) + , allExchangesByIds = ccxt.indexBy (allExchanges, 'id') + , exchangeIds = Object.keys (allExchangesByIds) + + const load = async () => { + while (exchangeIds.length > 0) { + const id = exchangeIds.pop () + const exchange = allExchangesByIds[id] + const file = path.join (folder, `saved-markets-${exchange.id}.json`) + try { + await exchange.loadMarkets () + const { id, markets } = exchange + await writeFile (file, JSON.stringify ({ id, markets })) + console.log ('Loaded markets from', id, 'to', file) + } catch (e) { + console.log ('Failed to load markets from', id, 'to', file, e.constructor.name) + } + } + } + + const started = ccxt.milliseconds () + const loaders = Array (maxConcurrency).fill ().map (x => load ()) + await Promise.all (loaders) + const stopped = ccxt.milliseconds () + console.log ('Done loading', allExchanges.length, 'exchanges in', ((stopped - started) / 1000).toFixed (2), 'seconds') + + // other code... +} + +main () diff --git a/docs/ccxt/examples/js/looping-over-all-symbols-of-specific-exchanges.js b/docs/ccxt/examples/js/looping-over-all-symbols-of-specific-exchanges.js new file mode 100644 index 0000000..d29ba29 --- /dev/null +++ b/docs/ccxt/examples/js/looping-over-all-symbols-of-specific-exchanges.js @@ -0,0 +1,61 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'); + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async () => { + + const exchanges = [ 'bittrex', 'poloniex', 'hitbtc2' ] + + for (let exchangeId of exchanges) { + + // create the exchange instance + const exchange = new ccxt[exchangeId] () + + // preload all markets first, as explained in the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { + + await exchange.loadMarkets (); + + } catch (e) { + + log.red ('Could not load markets from', exchange.id + ':', e.constructor.name, e.message) + + continue; // skip this exchange if markets failed to load + + } + + for (let symbol in exchange.markets) { + + console.log (exchange.id, symbol) + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { // try fetching the ticker for a symbol existing with that exchange + + const ticker = await exchange.fetchTicker (symbol) + log.green (ticker) + + } catch (e) { // catch the error (if any) and handle it or ignore it + + log.red ('Could not fetch', symbol, 'ticker from', exchange.id + ':', e.constructor.name, e.message) + + } + } + } + +}) () diff --git a/docs/ccxt/examples/js/looping-over-specific-symbols-of-all-exchanges.js b/docs/ccxt/examples/js/looping-over-specific-symbols-of-all-exchanges.js new file mode 100644 index 0000000..7498915 --- /dev/null +++ b/docs/ccxt/examples/js/looping-over-specific-symbols-of-all-exchanges.js @@ -0,0 +1,91 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'); + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async () => { + + const exchanges = {}; + const symbols = [ 'ETH/BTC', 'XRP/BTC', 'BTC/USDT' ] + + for (let symbol of symbols) { + + for (let exchangeId of ccxt.exchanges) { + + let exchange = undefined + + try { // try creating the exchange instance first and handle errors if any + + // check if we have created an instance of this exchange already + + exchange = exchanges[exchangeId] + + if (exchange === undefined) { + + // create the exchange instance + exchange = new ccxt[exchangeId] () + } + + exchanges[exchangeId] = exchange // save it for later use + + } catch (e) { + + log.red ('Could not create exchange', exchangeId + ':', e.constructor.name, e.message) + + // uncomment the following line to interrupt program execution on error + // or leave it commented out to do nothing + + // process.exit () + + } + + if (exchange !== undefined) { + + // preload all markets first, as explained in the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { + + await exchange.loadMarkets (); + + } catch (e) { + + log.red ('Could not load markets from', exchange.id + ':', e.constructor.name, e.message) + continue; // skip this exchange if markets failed to load + + } + + for (let symbol of symbols) { + + console.log (exchange.id, symbol) + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { // try fetching the ticker for a symbol existing with that exchange + + const ticker = await exchange.fetchTicker (symbol) + log.green (ticker) + + } catch (e) { // catch the error (if any) and handle it or ignore it + + log.red ('Could not fetch', symbol, 'ticker from', exchange.id + ':', e.constructor.name, e.message) + + } + } + } + } + } + +}) () diff --git a/docs/ccxt/examples/js/margin-loan-borrow-buy-sell-repay.js b/docs/ccxt/examples/js/margin-loan-borrow-buy-sell-repay.js new file mode 100644 index 0000000..3524f42 --- /dev/null +++ b/docs/ccxt/examples/js/margin-loan-borrow-buy-sell-repay.js @@ -0,0 +1,70 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// Note, this is just an example and might not yet work on other exchanges, which are being still unified. +async function example() { + // ########## user inputs ########## + const exchange = new ccxt['binance']({ 'apiKey': 'xxx', 'secret': 'xxx' }); + const symbol = 'BUSD/USDT'; // set target symbol + const marginMode = 'isolated'; // margin mode (cross or isolated) + const collateral_coin = 'USDT'; // which asset you want to use for margin-borrow collateral + const borrow_coin = 'BUSD'; // which coin to borrow + const order_side = 'sell'; // which side to trade + const amount_to_trade = 14; // how many coins to sell + const order_type = 'limit'; // order type (can be market, limit or etc) + const limit_price = 0.99; // price to sell at (set undefined/null/None if market-order) + const margin_magnitude = 5; // target margin (aka 'leverage'). This might also be obtainable using other unified methods, but for example purposes, we set here manually + // ########## end of user-inputs ########## + // + // for example purposes, let's also check available balance at first + const balance_margin = await exchange.fetchBalance({ 'defaultType': 'margin', 'marginMode': marginMode }); // use `defaultType` because of temporary bug, otherwise, after several days, you can use `type` too. + // if we don't have enought coins, then we have to borrow at first + let needed_amount_to_borrow = undefined; // will be auto-set below + if (amount_to_trade > balance_margin[symbol][borrow_coin]['free']) { + needed_amount_to_borrow = amount_to_trade - balance_margin[symbol][borrow_coin]['free']; + console.log('hmm, I have only ', balance_margin[symbol][borrow_coin]['free'], ' ', borrow_coin, ' in margin balance, and still need additional ', needed_amount_to_borrow, ' to make an order. Lets borrow it.'); + // To initate a borrow, at first, check if we have enough collateral (for this example, as we make a sell-short, we need '-1' to keep for collateral currency) + const needed_collateral_amount = needed_amount_to_borrow / (margin_magnitude - 1); + // Check if we have any collateral to get permission for borrow + if (balance_margin[symbol][collateral_coin]['free'] < needed_collateral_amount) { + // If we don't have enough collateral, then let's try to transfer collateral-asset from spot-balance to margin-balance + console.log('hmm, I have only ', balance_margin[symbol][collateral_coin]['free'], ' in balance, but ', needed_collateral_amount, ' collateral is needed. I should transfer ', needed_collateral_amount, ' from spot'); + // let's check if we have spot balance at all + const balance_spot = await exchange.fetchBalance({ 'type': 'spot' }); + if (exchange.parseNumber(balance_spot[collateral_coin]['free']) < needed_collateral_amount) { + console.log('hmm, I neither do have enough balance on spot - only ', balance_spot[collateral_coin]['free'], '. Script can not continue...'); + return; + } + else { + console.log('Transferring ', needed_collateral_amount, ' to margin account'); + await exchange.transfer(collateral_coin, needed_collateral_amount, 'spot', marginMode, { 'symbol': symbol }); + } + } + // now, as we have enough margin collateral, initiate borrow + console.log('Initiating margin borrow of ', needed_amount_to_borrow, ' ', borrow_coin); + const borrowResult = await exchange.borrowMargin(borrow_coin, needed_amount_to_borrow, symbol, { 'marginMode': marginMode }); + } + console.log('Submitting order.'); + const order = await exchange.createOrder(symbol, order_type, order_side, amount_to_trade, limit_price, { 'marginMode': marginMode }); + console.log('Order was submitted !', order['id']); + // + // + // ... + // ... + // some time later, if you want to repay the loan back (like 'close the position')... + // ... + // ... + // + // + // set the "repay-back" amount (for this example snippet, this will be same amount that we borrowed above) + if (needed_amount_to_borrow !== undefined) { + const amount_to_repay_back = needed_amount_to_borrow; + // At first, you need to get back the borrowed coin, by making an opposide trade + console.log('Making purchase back of ', amount_to_repay_back, ' ', borrow_coin, ' to repay it back.'); + const purchase_back_price = 1.01; + const order_back = await exchange.createOrder(symbol, order_type, (order_side === 'buy' ? 'sell' : 'buy'), amount_to_repay_back, purchase_back_price, { 'marginMode': marginMode }); + console.log('Now, repaying the loan.'); + const repayResult = await exchange.repayMargin(borrow_coin, amount_to_repay_back, symbol, { 'marginMode': marginMode }); + console.log('finished.'); + } +} +await example(); diff --git a/docs/ccxt/examples/js/market-status-and-currency-status.js b/docs/ccxt/examples/js/market-status-and-currency-status.js new file mode 100644 index 0000000..a344503 --- /dev/null +++ b/docs/ccxt/examples/js/market-status-and-currency-status.js @@ -0,0 +1,29 @@ + + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import asTable from 'as-table'; + +(async function main () { + + let kraken = new ccxt.kraken () + await kraken.loadMarkets () + + const markets = Object.values (kraken.markets).map (market => ({ + symbol: market.symbol, + active: market.active, + })) + + log.bright.green.noLocate ('Markets:') + log.green.noLocate (asTable (markets), '\n') + + const currencies = Object.values (kraken.currencies).map (currency => ({ + code: currency.code, + active: currency.active, + status: currency.status, + })) + + log.bright.yellow.noLocate ('Currencies:') + log.yellow.noLocate (asTable (currencies)) + +}) () diff --git a/docs/ccxt/examples/js/ohlcv-console-chart.js b/docs/ccxt/examples/js/ohlcv-console-chart.js new file mode 100644 index 0000000..b5781a9 --- /dev/null +++ b/docs/ccxt/examples/js/ohlcv-console-chart.js @@ -0,0 +1,29 @@ + + +import ccxt from '../../js/ccxt.js'; +import asciichart from 'asciichart'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async function main () { + + // experimental, not yet implemented for all exchanges + // your contributions are welcome ;) + + const indexOfClose = 4 // [ timestamp, open, high, low, close, volume ] + const ohlcv = await new ccxt.cex ().fetchOHLCV ('BTC/USD', '1m') + const lastPrice = ohlcv[ohlcv.length - 1][indexOfClose] // closing price + const plotSeriesData = ohlcv.slice (-80).map (x => x[indexOfClose]) // closing price + const bitcoinRate = ('₿ = $' + lastPrice).green + const chart = asciichart.plot (plotSeriesData, { height: 15, padding: ' ' }) + log.yellow ("\n" + chart, bitcoinRate, "\n") + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/okex-fetch-closed-orders-archive.js b/docs/ccxt/examples/js/okex-fetch-closed-orders-archive.js new file mode 100644 index 0000000..78f7749 --- /dev/null +++ b/docs/ccxt/examples/js/okex-fetch-closed-orders-archive.js @@ -0,0 +1,31 @@ + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +// https://github.com/ccxt/ccxt/issues/10179 + +async function main () { + + const exchange = new ccxt.okex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_PASSWORD', + 'options': { + 'fetchClosedOrders': { + 'method': 'privateGetTradeOrdersHistoryArchive' + } + } + }) + + const markets = await exchange.loadMarkets () + + exchange.verbose = true + + const orders = await exchange.fetchClosedOrders () + console.log (orders) + +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/okex-transfer.js b/docs/ccxt/examples/js/okex-transfer.js new file mode 100644 index 0000000..fd6c640 --- /dev/null +++ b/docs/ccxt/examples/js/okex-transfer.js @@ -0,0 +1,51 @@ + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT version:', ccxt.version) +console.log ('This example requires CCXT version 1.54.92 or higher') + +async function main () { + + const exchange = new ccxt.okex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_API_KEY_PASSWORD', + }) + + await exchange.loadMarkets () + + const code = 'USDT' + let tradingBalance = await exchange.fetchFreeBalance (/* { 'type': 'trading' } */) + let fundingBalance = await exchange.fetchFreeBalance ({ 'type': 'funding' }) + console.log ('Trading:', tradingBalance[code], code) + console.log ('Funding:', fundingBalance[code], code) + + const oldVerboseMode = exchange.verbose + exchange.verbose = process.argv.includes ('--verbose') || process.argv.includes ('-v') + + // https://www.okex.com/docs-v5/en/#rest-api-funding-funds-transfer + // + // 'spot' == '1' + // 'futures' == '3', + // 'margin' == '5', + // 'swap' == '9', + // 'option' == '12', + // 'trading' == '18', // unified trading account + // 'unified' == '18', + // + const from = 'trading' + const to = 'funding' + const amount = 1 + const transfer = await exchange.transfer (code, amount, from, to) + console.log (transfer) + + exchange.verbose = oldVerboseMode + + tradingBalance = await exchange.fetchFreeBalance (/* { 'type': 'spot' } */) + fundingBalance = await exchange.fetchFreeBalance ({ 'type': 'funding' }) + console.log ('Trading:', tradingBalance[code], code) + console.log ('Funding:', fundingBalance[code], code) +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/okx-poll-fetch-my-trades.js b/docs/ccxt/examples/js/okx-poll-fetch-my-trades.js new file mode 100644 index 0000000..068ba48 --- /dev/null +++ b/docs/ccxt/examples/js/okx-poll-fetch-my-trades.js @@ -0,0 +1,37 @@ +import ccxt from '../../js/ccxt.js' + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.okx ({ + + // edit for your credentials + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + }) + + await exchange.loadMarkets () + + // if this script fails with a rate limiter error + // uncomment the following line for debugging purposes + + // exchange.verbose = true + + while (true) { + + try { + + const trades = await exchange.fetchMyTrades () + console.log (new Date(), 'fetched', trades.length, 'trades') + + } catch (e) { + + console.log (e.constructor.name, e.message) + break; + } + } +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/okx-poll-rate-limit.js b/docs/ccxt/examples/js/okx-poll-rate-limit.js new file mode 100644 index 0000000..d9ddaf4 --- /dev/null +++ b/docs/ccxt/examples/js/okx-poll-rate-limit.js @@ -0,0 +1,48 @@ +import ccxt from '../../js/ccxt.js' + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.okx ({ + + // edit for your credentials + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + + 'api': { + 'private': { + 'get': { + 'trade/fills-history': 2.2, + }, + }, + }, + + }) + + await exchange.loadMarkets () + + // if this script fails with a rate limiter error + // uncomment the following line for debugging purposes + + // exchange.verbose = true + + const promises=[]; + for(let i=0;i<100;i++){ + promises.push(exchange.fetchMyTrades()); + } + + const allResponses = await Promise.allSettled(promises); + allResponses.forEach((result, i) => { + + if(result.status == "fulfilled"){ + console.log (new Date(), i + 6, 'fetched', result.value.length, 'trades') + } else { + console.log ("Rejected:", i + 6, result.reason); + } + }); + +} + +main () diff --git a/docs/ccxt/examples/js/order-book-extra-level-depth-param.js b/docs/ccxt/examples/js/order-book-extra-level-depth-param.js new file mode 100644 index 0000000..134791c --- /dev/null +++ b/docs/ccxt/examples/js/order-book-extra-level-depth-param.js @@ -0,0 +1,20 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; +import ansicolor from 'ansicolor'; + +ansicolor.nice + +;(async function test () { + + const exchange = new ccxt.bitfinex () + const limit = 5 + const orders = await exchange.fetchOrderBook ('BTC/USD', limit, { + // this parameter is exchange-specific, all extra params have unique names per exchange + 'group': 1, // 1 = orders are grouped by price, 0 = orders are separate + }) + + log (orders) +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/phemex-create-order-position-with-takeprofit-stoploss.js b/docs/ccxt/examples/js/phemex-create-order-position-with-takeprofit-stoploss.js new file mode 100644 index 0000000..e1d12a9 --- /dev/null +++ b/docs/ccxt/examples/js/phemex-create-order-position-with-takeprofit-stoploss.js @@ -0,0 +1,49 @@ +// @ts-nocheck +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// ------------------------------------------------------------------------------ +async function example() { + const exchange = new ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + const symbol = 'XRP/USDT:USDT'; + const side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'limit'; // set it to 'market' or 'limit' + const amount = 1; // how many contracts + const price = 0.5; // set a price at your desired level + // take profit and stop loss prices and types + const take_profit_trigger_price = 0.6; + const stop_loss_trigger_price = 0.4; + const take_profit_limit_price = 0.7; + const stop_loss_limit_price = 0.3; + await exchange.loadMarkets(); + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'posSide': 'Long', + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + 'type': 'limit', + 'price': stop_loss_limit_price, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + 'type': 'limit', + 'price': take_profit_limit_price, + }, + }; + console.log('-----------------------------------------------------------------------'); + // exchange.verbose = True // uncomment for debugging purposes if necessary + try { + const created_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + console.log('Created an order', created_order); + // Fetch all your open orders for this symbol + const all_open_orders = await exchange.fetchOpenOrders(symbol); + console.log('Fetched all your orders for this symbol', all_open_orders); + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } + catch (e) { + console.log(e.toString()); + } +} +await example(); diff --git a/docs/ccxt/examples/js/poll-ohlcv.js b/docs/ccxt/examples/js/poll-ohlcv.js new file mode 100644 index 0000000..34c330a --- /dev/null +++ b/docs/ccxt/examples/js/poll-ohlcv.js @@ -0,0 +1,43 @@ + + +import ccxt from '../../js/ccxt.js'; + +const ohlcvsBySymbol = {} + +function handleAllOHLCVs (exchange, ohlcvs, symbol, timeframe) { + console.log ('----------------------------------------------------------') + console.log ('Last updated:', exchange.iso8601 (exchange.milliseconds ())) + const symbols = Object.keys (ohlcvsBySymbol) + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i] + const ohlcvs = ohlcvsBySymbol[symbol] + const lastCandle = exchange.safeValue (ohlcvs, ohlcvs.length - 1) + const lastTimestamp = lastCandle[0] + console.log (exchange.iso8601 (lastTimestamp), symbol, timeframe, lastCandle.slice (1)) + } +} + +async function pollOHLCV (exchange, symbol, timeframe) { + while (true) { + try { + const response = await exchange.fetchOHLCV (symbol, timeframe) + ohlcvsBySymbol[symbol] = response + handleAllOHLCVs(exchange, response, symbol, timeframe) + } catch (e) { + console.log (e.constructor.name, e.message) + } + } +} + +async function main () { + + const exchange = new ccxt.binance() + const markets = await exchange.loadMarkets () + const timeframe = '5m' + + const firstOneHundredSymbols = exchange.symbols.slice (0, 100) + + await Promise.all (firstOneHundredSymbols.map (symbol => pollOHLCV (exchange, symbol, timeframe))) +} + +main () \ No newline at end of file diff --git a/docs/ccxt/examples/js/poloniex-fetch-order-books.js b/docs/ccxt/examples/js/poloniex-fetch-order-books.js new file mode 100644 index 0000000..4a51a5c --- /dev/null +++ b/docs/ccxt/examples/js/poloniex-fetch-order-books.js @@ -0,0 +1,35 @@ + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- + +(async () => { + + const exchange = new ccxt.poloniex ({ + 'verbose': process.argv.includes ('--verbose'), + 'timeout': 60000, + }) + + try { + + const response = await exchange.fetchOrderBooks ([ + 'ETH/BTC', + 'LTC/BTC', + 'OMG/BTC', + ]) + console.log (response); + console.log ('Succeeded.') + + } catch (e) { + + console.log ('--------------------------------------------------------') + console.log (e.constructor.name, e.message) + console.log ('--------------------------------------------------------') + console.log (exchange.last_http_response) + console.log ('Failed.') + } + +}) () diff --git a/docs/ccxt/examples/js/poloniex-limits-amount-min.js b/docs/ccxt/examples/js/poloniex-limits-amount-min.js new file mode 100644 index 0000000..b2a3c8f --- /dev/null +++ b/docs/ccxt/examples/js/poloniex-limits-amount-min.js @@ -0,0 +1,62 @@ +import ccxt from '../../js/ccxt.js'; +import fs from 'fs'; +import ololog from 'ololog' + +const log = ololog.configure.unlimited.noLocate, + verbose = process.argv.includes ('--verbose'), + keysGlobal = 'keys.json', + keysLocal = 'keys.local.json', + keysFile = fs.existsSync (keysLocal) ? keysLocal : (fs.existsSync (keysGlobal) ? keysGlobal : false), + config = keysFile ? require ('../../' + keysFile) : {}, + exchange = new ccxt.poloniex (ccxt.extend ({ + enableRateLimit: true, + verbose, + }, config.poloniex || {}));(async () => { + + const test = async function (symbol) { + + try { + + await exchange.createOrder (symbol, 'limit', 'buy', 0, 0) + + } catch (e) { + + if (e instanceof ccxt.InvalidOrder) { + + const words = e.message.split (' ') + let minAmount = parseFloat (words[words.length - 1]) + log.green ("'" + symbol + "': " + minAmount.toString () + ',') + + } else { + + throw e + } + } + } + + await exchange.loadMarkets () + + for (let i = 0; i < exchange.symbols.length; i++) { + + try { + + await test (exchange.symbols[i]) + + } catch (e) { + + if (e instanceof ccxt.InvalidNonce) { + + log.yellow (e) + + } else { + + log.red (e) + throw e + } + } + + + await ccxt.sleep (5000) // sleep 5 seconds, no rush, safe delay + } + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/proxy-round-robin.js b/docs/ccxt/examples/js/proxy-round-robin.js new file mode 100644 index 0000000..e8e5049 --- /dev/null +++ b/docs/ccxt/examples/js/proxy-round-robin.js @@ -0,0 +1,98 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +// this script loads markets from all exchanges +// if it cannot connect to an exchange, it falls back to an alternative route via proxy +// it will retry to load a exchange until it either reaches the exchange or runs out of proxies + +//----------------------------------------------------------------------------- + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +//----------------------------------------------------------------------------- + +let loadExchange = async exchange => { + await exchange.loadMarkets () + log (exchange.id.green, 'loaded', + exchange.symbols.length.toString ().bright.green, 'symbols', + (exchange.proxy ? exchange.proxy : '_').blue) +} + +//----------------------------------------------------------------------------- + +let tryAllProxies = async function (exchange, proxies) { + + let currentProxy = 0 + let maxRetries = proxies.length + + // a special case for ccex + if (exchange.id == 'ccex') + currentProxy = 1 + + for (let numRetries = 0; numRetries < maxRetries; numRetries++) { + + try { + + exchange.proxy = proxies[currentProxy] + await loadExchange (exchange) + break + + } catch (e) { + + currentProxy = ++currentProxy % proxies.length + if (e instanceof ccxt.DDoSProtection) { + log.bright.yellow (exchange.id, '[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id, '[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id, '[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id, '[Exchange Not Available] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id, '[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow (exchange.id, '[Network Error] ' + e.message) + } else { + throw e; + } + } + + } +} + +//----------------------------------------------------------------------------- + +let proxies = [ + '', + 'https://cors-anywhere.herokuapp.com/', + 'https://crossorigin.me/', +] + +let exchanges = [] + +async function main () { + // instantiate all exchanges + await Promise.all (ccxt.exchanges.map (async id => { + let exchange = new (ccxt)[id] () + exchanges.push (exchange) + await tryAllProxies (exchange, proxies) + })) + + let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green + let failed = exchanges.filter (exchange => exchange.markets ? false : true).length + let total = ccxt.exchanges.length.toString ().bright.white + console.log (succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) +} + +main () diff --git a/docs/ccxt/examples/js/proxy-usage.js b/docs/ccxt/examples/js/proxy-usage.js new file mode 100644 index 0000000..3e48016 --- /dev/null +++ b/docs/ccxt/examples/js/proxy-usage.js @@ -0,0 +1,40 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// 1) ABOUT CCXT PROXIES, READ MORE AT: https://docs.ccxt.com/#/README?id=proxy +// 2) in python, uncomment the below: +// if sys.platform == 'win32': +// asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) +async function example_proxyUrl() { + const myEx = new ccxt.kucoin(); + myEx.proxyUrl = 'http://188.245.226.105:8090/proxy_url.php?caller=https://ccxt.com&url='; + console.log(await myEx.fetch('https://api.ipify.org/')); +} +async function example_httpProxy() { + const myEx = new ccxt.kucoin(); + myEx.httpProxy = 'http://188.245.226.105:8911'; // "httpProxy" or "httpsProxy" (depending on your proxy protocol) + console.log(await myEx.fetch('https://api.ipify.org/')); +} +async function example_socksProxy() { + const myEx = new ccxt.kucoin(); + myEx.socksProxy = 'socks5://127.0.0.1:1080'; // from protocols: socks, socks5, socks5h + console.log(await myEx.fetch('https://api.ipify.org/')); +} +async function example_webSockets() { + const myEx = new ccxt.pro.kucoin(); + myEx.httpProxy = 'http://188.245.226.105:8911'; // even though you are using WebSockets, you might also need to set up proxy for the exchange's REST requests + myEx.wsProxy = 'http://188.245.226.105:8911'; // "wsProxy" or "wssProxy" or "wsSocksProxy" (depending on your proxy protocol) + await myEx.loadMarkets(); + // + // To ensure your WS proxy works, uncomment below code and watch the log + // + // myEx.verbose = true; + // await myEx.loadHttpProxyAgent (); + // await myEx.watch ('ws://188.245.226.105:9876/', 'myip'); // in the incoming logs, confirm that you see the proxy IP in "hello" message + // + console.log(await myEx.watchTicker('BTC/USDT')); + await myEx.close(); +} +// await example_proxyUrl (); +await example_httpProxy(); +// await example_socksProxy (); +// await example_webSockets (); diff --git a/docs/ccxt/examples/js/sample-local-proxy-server-with-cors.js b/docs/ccxt/examples/js/sample-local-proxy-server-with-cors.js new file mode 100644 index 0000000..841f250 --- /dev/null +++ b/docs/ccxt/examples/js/sample-local-proxy-server-with-cors.js @@ -0,0 +1,12 @@ +// @ts-nocheck +// JavaScript sample Proxy with CORS support +// Save this in a file like cors.js and run with: +// node cors [port] +// It will listen for your requests on the port you pass in command line (or port 8080 by default) +import cors from 'cors-anywhere'; // npm install cors-anywhere +const port = (process.argv.length > 2) ? parseInt(process.argv[2]) : 8080; // if not provided from cli, default to 8080 +cors.createServer({ +// you can set origin, if needed by exchange +// setHeaders: { 'origin': 'https://www.bitmex.com' } +}).listen(port, 'localhost'); +console.log('Running CORS Anywhere on localhost:' + port); diff --git a/docs/ccxt/examples/js/search-all-exchanges.js b/docs/ccxt/examples/js/search-all-exchanges.js new file mode 100644 index 0000000..d1ae8ac --- /dev/null +++ b/docs/ccxt/examples/js/search-all-exchanges.js @@ -0,0 +1,166 @@ +import asTable from 'as-table'; +import ololog from 'ololog'; +import path from 'path'; +import fs from 'fs'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice +/* ------------------------------------------------------------------------ */ + +const [processPath, , argument = null] = process.argv.filter (x => !x.startsWith ('--')) + , verbose = process.argv.includes ('--verbose') + , strict = process.argv.includes ('--strict') + , detailed = process.argv.includes ('--detailed') || process.argv.includes ('-v') + , debug = process.argv.includes ('--debug') + , marketsOnly = process.argv.includes ('--markets') + , currenciesOnly = process.argv.includes ('--currencies') + +/* ------------------------------------------------------------------------ */ + +const warn = log.bright.yellow.error // .error → stderr + +/* ------------------------------------------------------------------------ */ + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +/* ------------------------------------------------------------------------ */ + +let printUsage = function () { + log (' Non-strict search: node', process.argv[1], 'symbol'.green) + log (' Non-strict search: node', process.argv[1], 'currency'.green) + log (' Strict search: node', process.argv[1], '--strict', 'argument'.green) + log (' Search markets only: node', process.argv[1], '--markets', 'argument'.green) + log ('Search currencies only: node', process.argv[1], '--currencies', 'argument'.green) + +} + +if (process.argv.length < 3) { + printUsage () + process.exit () +} + +/* ------------------------------------------------------------------------ */ + +const keysGlobal = path.resolve ('keys.json') +const keysLocal = path.resolve ('keys.local.json') +let globalKeysFile = fs.existsSync (keysGlobal) ? keysGlobal : false +let localKeysFile = fs.existsSync (keysLocal) ? keysLocal : globalKeysFile + +const keys = JSON.parse (fs.readFileSync (localKeysFile)) + +/* ------------------------------------------------------------------------ */ + +log ('Looking up for:', argument.bright, strict ? '(strict search)' : '(non-strict search)') + +const checkAgainst = strict ? + (a, b) => (a.toString () || '').toUpperCase ().includes ((b.toString () || '').toUpperCase ()) : + (a, b) => (a.toString () || '').toLowerCase ().includes ((b.toString () || '').toLowerCase ()) + +;(async function test () { + + let exchanges = await Promise.all (ccxt.exchanges.map (async id => { + + // instantiate the exchange + let exchange = new ccxt[id] (ccxt.extend (localKeysFile ? (keys[id] || {}) : {}, { + // agent, // set up keys and settings, if any + })) + + if (exchange.has.fetchMarkets) { + + try { + + // load markets + await exchange.loadMarkets () + return exchange + + } catch (e) { + + if (debug) { + log.red (exchange.id, e.constructor.name) + } + return undefined + } + } + })) + + // filter out exchanges that failed to load + exchanges = exchanges.filter (exchange => exchange) + + if (!currenciesOnly) { + + log ("---------------------------------------------------------------") + + log ("Markets And Symbols:") + + let markets = ccxt.flatten (exchanges + .map (exchange => + Object.values (exchange.markets).map (market => + exchange.extend (market, { + exchange: exchange.id[(market.active !== false) ? 'green' : 'yellow'], + })))) + .filter (market => { + try { + return ( + checkAgainst (market['base'], argument) || + checkAgainst (market['quote'], argument) || + (market['baseId'] ? checkAgainst (market['baseId'].toString (), argument) : false) || + (market['quoteId'] ? checkAgainst (market['quoteId'].toString (), argument) : false) || + checkAgainst (market['symbol'], argument) || + checkAgainst (market['id'].toString (), argument) || + checkAgainst (market['type'], argument) + ) + } catch (e) { + if (debug) { + log.red (e.constructor.name, e.message) + } + return false + } + }) + + log (asTable (markets.map (market => { + market = ccxt.omit (market, [ 'info', 'limits', 'precision', 'tiers' ]) + return (detailed) ? market : { + 'symbol': market['symbol'], + 'exchange': market['exchange'], + }; + }))) + + log (markets.length.toString ().yellow, 'markets') + } + + if (!marketsOnly) { + + log ("---------------------------------------------------------------") + + log ("Currencies:") + + let currencies = ccxt.flatten (exchanges + .map (exchange => + Object.values (exchange.currencies).map (currency => + exchange.extend (currency, { + exchange: exchange.id[(currency.active !== false) ? 'green' : 'yellow'], + })))) + .filter (currency => ( + checkAgainst (currency['code'], argument) || + checkAgainst (currency['id'], argument) + )) + + log (asTable (currencies.map (currency => { + currency = ccxt.omit (currency, [ 'info', 'limits', 'precision' ]) + return (detailed) ? currency : { + 'code': currency['code'], + 'exchange': currency['exchange'], + }; + }))) + + log (currencies.length.toString ().yellow, 'currencies') + } + + process.exit () + +}) () diff --git a/docs/ccxt/examples/js/shared-load-markets.js b/docs/ccxt/examples/js/shared-load-markets.js new file mode 100644 index 0000000..12915ab --- /dev/null +++ b/docs/ccxt/examples/js/shared-load-markets.js @@ -0,0 +1,80 @@ +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- +// an example of how to load markets for each exchange just once +// in order to save memory and time for initializing multiple exchange instances +// see https://github.com/ccxt/ccxt/issues/7312 for details +// ---------------------------------------------------------------------------- + +const globalIds = [ 'binance', 'poloniex', 'bittrex', 'bitstamp' ] +const globalExchanges = {} + +async function loadExchange (id) { + try { + const exchange = new ccxt[id] () + await exchange.loadMarkets () + globalExchanges[id] = exchange + } catch (e) { + // throw e // uncomment to break the entire program on any error + // console.log (e) // print the exception and ignore this exchange + } +} + +async function main () { + + // initialize unique global exchange instances first + await Promise.all (globalIds.map (async (id) => loadExchange (id))) + console.log ('Loaded global exchanges:', Object.keys (globalExchanges)) + + // load user exchanges and keys from a database or configure these via JSON + const users = { + 'user1': { + 'binance': { 'apiKey': 'USER1_BINANCE_API_KEY', 'secret': 'USER1_BINANCE_SECRET' }, + 'poloniex': { 'apiKey': 'USER1_POLONIEX_API_KEY', 'secret': 'USER1_POLONIEX_SECRET' } + }, + 'user2': { + 'poloniex': { 'apiKey': 'USER2_POLONIEX_API_KEY', 'secret': 'USER2_POLONIEX_SECRET' }, + 'bittrex': { 'apiKey': 'USER2_BITTREX_API_KEY', 'secret': 'USER2_BITTREX_SECRET' } + }, + 'user3': { + 'bittrex': { 'apiKey': 'USER3_BITTREX_API_KEY', 'secret': 'USER3_BITTREX_SECRET' }, + 'bitstamp': { 'apiKey': 'USER3_BITSTAMP_API_KEY', 'secret': 'USER3_BITSTAMP_SECRET' } + } + } + + // initialize local exchanges per user + const localExchanges = {} + for (const userId in users) { + const userExchanges = {} + for (const exchangeId in users[userId]) { + if (exchangeId in globalExchanges) { + const globalExchange = globalExchanges[exchangeId] + const exchange = new ccxt[exchangeId] ({ + // 'verbose': true, // uncomment for debug output + ... users[userId][exchangeId], + }); + [ + 'ids', + 'markets', + 'markets_by_id', + 'currencies', + 'currencies_by_id', + 'baseCurrencies', + 'quoteCurrencies', + 'symbols', + ].forEach ((propertyName) => { + exchange[propertyName] = globalExchange[propertyName] + }) + userExchanges[exchangeId] = exchange + } + } + localExchanges[userId] = userExchanges + } + + // print the loaded exchanges per user + for (const userId in localExchanges) { + console.log ('Loaded', userId, Object.keys (localExchanges[userId])) + } +} + +main () diff --git a/docs/ccxt/examples/js/sort-swap-markets-by-hourly-price-change.js b/docs/ccxt/examples/js/sort-swap-markets-by-hourly-price-change.js new file mode 100644 index 0000000..786cec9 --- /dev/null +++ b/docs/ccxt/examples/js/sort-swap-markets-by-hourly-price-change.js @@ -0,0 +1,55 @@ +'use strict'; + +const ccxt = require ('../../js/ccxt.js'); + +const exchange = new ccxt.binanceusdm (); +const timeframe = '1h'; +const type = 'swap'; + +async function fetchOHLCV (symbol) { + /** + * @description Wrapper around exchange.fetchOHLCV method + * @param {string} symbol CCXT unified symbol + * @returns {[float|str]} 1d array with a single ohlcv record with the market symbol appended + */ + try { + const ohlcv = await exchange.fetchOHLCV (symbol, timeframe, undefined, 1); + ohlcv[0].push (symbol); + return ohlcv[0]; + } catch (err) { + console.log (symbol + ' failed fetchOHLCV with error ' + err) + } +} + +function getPriceChangePercent (ohlcv) { + /** + * @description Gets the price change of a market as a percentage + * @param {[float]} ohlcv A single ohlcv record with the market symbol appended + * @returns {[float, str]} The price change as a percent with the symbol for the market + */ + const open = ohlcv[1]; + const close = ohlcv[4]; + const symbol = ohlcv[6]; + const priceIncrease = close - open; + const increaseAsRatio = priceIncrease / open; + const increaseAsPercent = increaseAsRatio * 100; + return [increaseAsPercent, symbol] +} + +function sort (a, b) { + return a[0] - b[0]; +} + +async function main () { + /** + * @description Gets the price change as a percent of every market matching type over the last timeframe matching timeframe and prints a sorted list. The most immediate candle is ignored because it is incomplete + */ + await exchange.loadMarkets (); + const allSwapSymbols = exchange.symbols.filter (symbol => exchange.market (symbol)[type] ); + const ohlcvs = await Promise.all (allSwapSymbols.map (symbol => fetchOHLCV (symbol))); + const priceChanges = ohlcvs.map (ohlcv => getPriceChangePercent (ohlcv)); + const sorted = priceChanges.sort (sort); + console.dir(sorted, {'maxArrayLength': null}) +} + +main () diff --git a/docs/ccxt/examples/js/symbols.js b/docs/ccxt/examples/js/symbols.js new file mode 100644 index 0000000..99937a0 --- /dev/null +++ b/docs/ccxt/examples/js/symbols.js @@ -0,0 +1,110 @@ + + +import ccxt from '../../js/ccxt.js'; +import fs from 'fs'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import asTable from 'as-table'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice +const table = asTable.configure ({ delimiter: ' | ' }), verbose = process.argv.includes ('--verbose'), debug = process.argv.includes ('--debug'); + +//----------------------------------------------------------------------------- + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'id'.green) + printSupportedExchanges () +} + +let printSymbols = async (id) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // set up keys and settings, if any + const keysGlobal = 'keys.json' + const keysLocal = 'keys.local.json' + + let keysFile = fs.existsSync (keysLocal) ? keysLocal : (fs.existsSync (keysGlobal) ? keysGlobal : false) + let settings = keysFile ? (require ('../../' + keysFile)[id] || {}) : {} + + // instantiate the exchange by id + let exchange = new ccxt[id] (ccxt.extend ({ + verbose, + // 'proxy': 'https://cors-anywhere.herokuapp.com/', + // 'proxy': 'https://crossorigin.me/', + }, settings)) + + // Object.assign (exchange, settings) + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + // debug log + if (debug) + Object.values (markets).forEach (market => log (market)) + + log ("\nSymbols:\n") + + // make a table of all markets + + const marketsList = + ccxt.sortBy (Object.values (markets), 'symbol') + .map (market => + ccxt.omit (market, [ 'info', 'limits', 'precision', 'fees' ])) + + let table = table (marketsList) + log (table) + + log ("\n---------------------------------------------------------------") + + log ("\nCurrencies:\n") + + // make a table of all currencies + + const currenciesList = + ccxt.sortBy (Object.values (exchange.currencies), 'code') + .map (currency => + ccxt.omit (currency, [ 'info', 'limits' ])) + + const currenciesTable = table (currenciesList) + log (currenciesTable) + + log ("\n---------------------------------------------------------------") + + // output a summary + log (id.green, 'has', exchange.symbols.length.toString ().yellow, 'symbols and', + Object.keys (exchange.currencies).length.toString ().yellow, "currencies\n") + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 2) { + + let id = process.argv[2] + await printSymbols (id) + + } else { + + printUsage () + } + + process.exit () + +}) () \ No newline at end of file diff --git a/docs/ccxt/examples/js/theocean.js b/docs/ccxt/examples/js/theocean.js new file mode 100644 index 0000000..1eaeba0 --- /dev/null +++ b/docs/ccxt/examples/js/theocean.js @@ -0,0 +1,41 @@ + + +import ccxt from '../../js/ccxt.js'; +(async function main () { + const walletAddress = process.env['WALLET_ADDRESS'] + const privateKey = process.env['PRIVATE_KEY'] + const apiKey = process.env['API_KEY'] + const secret = process.env['SECRET'] + + const ocean = new ccxt.theocean({ + walletAddress, + privateKey, + apiKey, + secret + }); + + // get balance + const balance = await ocean.fetchBalanceByCode('REP'); + console.log('REP balance: ', balance); + + // get order book + const orderBook = await ocean.fetchOrderBook('REP/ZRX'); + console.log('REP/ZRX orderbook: ', orderBook); + + // placing order + const placeResult = await ocean.createOrder('REP/ZRX', 'limit', 'sell', '0.5', '30'); + const id = placeResult['id']; + console.log('result of placing order: ', placeResult); + + // cancel order + if (placeResult['remaining'] > 0) { + const cancelResult = await ocean.cancelOrder(id); + console.log('cancel result: ', cancelResult); + } + + // cancel all open user orders + const cancelAllOrderssResult = await ocean.cancelAllOrders(); + console.log('cancel all orders result: ', cancelAllOrderssResult); + + process.exit (); +}) () diff --git a/docs/ccxt/examples/js/tickers.js b/docs/ccxt/examples/js/tickers.js new file mode 100644 index 0000000..f28cef5 --- /dev/null +++ b/docs/ccxt/examples/js/tickers.js @@ -0,0 +1,106 @@ + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'); + +ansicolor.nice + +//----------------------------------------------------------------------------- + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'id'.green, '[symbol]'.yellow) + printSupportedExchanges () +} + +let printSymbols = function (exchange) { + log (id.green, 'has', exchange.symbols.length, 'symbols:', exchange.symbols.join (', ').yellow) +} + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)) + +let printTicker = async (exchange, symbol) => { + let ticker = await exchange.fetchTicker (symbol) + log (exchange.id.green, symbol.yellow, 'ticker', + ticker['datetime'], + 'high: ' + ticker['high'], + 'low: ' + ticker['low'], + 'bid: ' + ticker['bid'], + 'ask: ' + ticker['ask'], + 'volume: ' + ticker['baseVolume']) + return ticker +} + +//----------------------------------------------------------------------------- + +let printTickers = async (id) => { + + log ('Instantiating', id.green, 'exchange exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] ({ verbose }) + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + if (process.argv.length > 3) { // if a symbol was supplied, get that symbol only + + let symbol = process.argv[3] + + await printTicker (exchange, symbol) + + } else { // otherwise run through all symbols one by one + + for (let symbol of exchange.symbols) + if ((symbol.indexOf ('.d') < 0)) { // skip darkpool symbols + + const market = exchange.markets[symbol]; + + if (!market['active']) { + log.red (exchange.id + ' ' + symbol + ' inactive'); + continue; + } + + await sleep (exchange.rateLimit) + await printTicker (exchange, symbol) + } + } +} + +//----------------------------------------------------------------------------- + +;(async function main () { + + if (process.argv.length > 2) { + + let id = process.argv[2] + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + + if (exchangeFound) { + + await printTickers (id) + + } else { + + log ('Exchange ' + id.red + ' not found') + printUsage () + } + + } else { + + printUsage () + + } + + process.exit () + +}) () diff --git a/docs/ccxt/examples/js/validate-paginated-data.js b/docs/ccxt/examples/js/validate-paginated-data.js new file mode 100644 index 0000000..6c30c21 --- /dev/null +++ b/docs/ccxt/examples/js/validate-paginated-data.js @@ -0,0 +1,61 @@ + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +/* +* Warning: Sometimes the exchanges have gaps in their OHLCV data, so it does not mean +* that CCXT is broken if you see gaps in the chart. +*/ + +async function fetchData(exchange, symbol, timeframe) { + await exchange.loadMarkets() + // exchange.verbose = true; + const duration = exchange.parseTimeframe (timeframe) *1000; // in milliseconds + const ohlcv = await exchange.fetchOHLCV (symbol, timeframe, undefined, undefined, {'paginate': true, 'paginationCalls': 5}) + validateTimeframes(ohlcv, duration, exchange, symbol) +} + +function validateTimeframes(ohlcv, duration, exchange, symbol) { + for (let j = 0; j < ohlcv.length; j++) { + const [timestamp, open, high, low, close, volume] = ohlcv[j] + if (j > 0) { + const [prevTimestamp, prevOpen, prevHigh, prevLow, prevClose, prevVolume] = ohlcv[j - 1] + if (timestamp - prevTimestamp !== duration) { + log.red ('[' + j + ']',exchange.id, symbol, 'OHLCV data is not continuous, at', exchange.iso8601 (timestamp), 'diff:', ((timestamp - prevTimestamp) / 1000), 's expected:', duration/ 1000, 's') + } + } + } + log.green(exchange.id, symbol, `All the ${ohlcv.length} candles returned are continuous`) +} + +async function main () { + + const exchanges = { + 'binance': 'BTC/USDT', + 'bitget': 'BTC/USDT', + 'kucoin': 'BTC/USDT', + 'kucoinfutures': 'BTC/USDT:USDT', + 'okex': 'BTC/USDT', + 'bybit': 'BTC/USDT' + } + const timeframe = '1m'; + const keys = Object.keys (exchanges) + const promises = []; + for (let i = 0; i < keys.length; i++) { + const name = keys[i] + const symbol = exchanges[name] + const exchange = new ccxt[name] ({ enableRateLimit: true }) + promises.push(fetchData(exchange, symbol, timeframe)) + } + await Promise.all(promises) +} + +main() \ No newline at end of file diff --git a/docs/ccxt/examples/js/watch-OHLCV-For-Symbols.js b/docs/ccxt/examples/js/watch-OHLCV-For-Symbols.js new file mode 100644 index 0000000..4b8e2df --- /dev/null +++ b/docs/ccxt/examples/js/watch-OHLCV-For-Symbols.js @@ -0,0 +1,15 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const subscriptions = [ + ['BTC/USDT', '5m'], + ['ETH/USDT', '5m'], + ['BTC/USDT', '1h'], + ]; + while (true) { + const ohlcv = await binance.watchOHLCVForSymbols(subscriptions); + console.log(ohlcv); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watch-OHLCV.js b/docs/ccxt/examples/js/watch-OHLCV.js new file mode 100644 index 0000000..4692e36 --- /dev/null +++ b/docs/ccxt/examples/js/watch-OHLCV.js @@ -0,0 +1,12 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbol = 'BTC/USDT'; + const timeframe = '1m'; + while (true) { + const ohlcv = await binance.watchOHLCV(symbol, timeframe); + console.log(ohlcv); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watch-OrderBook-For-Symbols.js b/docs/ccxt/examples/js/watch-OrderBook-For-Symbols.js new file mode 100644 index 0000000..9261582 --- /dev/null +++ b/docs/ccxt/examples/js/watch-OrderBook-For-Symbols.js @@ -0,0 +1,11 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const orderbook = await binance.watchOrderBookForSymbols(symbols); + console.log(orderbook['symbol'], orderbook['asks'][0], orderbook['bids'][0]); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watch-Trades-For-Symbols.js b/docs/ccxt/examples/js/watch-Trades-For-Symbols.js new file mode 100644 index 0000000..2d5af59 --- /dev/null +++ b/docs/ccxt/examples/js/watch-Trades-For-Symbols.js @@ -0,0 +1,11 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const trades = await binance.watchTradesForSymbols(symbols); + console.log(trades); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watch-tickers.js b/docs/ccxt/examples/js/watch-tickers.js new file mode 100644 index 0000000..573b874 --- /dev/null +++ b/docs/ccxt/examples/js/watch-tickers.js @@ -0,0 +1,11 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const tickers = await binance.watchTickers(symbols); + console.log(tickers['BTC/USDT'], tickers['ETH/USDT'], tickers['DOGE/USDT']); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watchOHLCVForSymbols.js b/docs/ccxt/examples/js/watchOHLCVForSymbols.js new file mode 100644 index 0000000..4b8e2df --- /dev/null +++ b/docs/ccxt/examples/js/watchOHLCVForSymbols.js @@ -0,0 +1,15 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const subscriptions = [ + ['BTC/USDT', '5m'], + ['ETH/USDT', '5m'], + ['BTC/USDT', '1h'], + ]; + while (true) { + const ohlcv = await binance.watchOHLCVForSymbols(subscriptions); + console.log(ohlcv); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watchOrderBookForSymbols.js b/docs/ccxt/examples/js/watchOrderBookForSymbols.js new file mode 100644 index 0000000..b8e82cd --- /dev/null +++ b/docs/ccxt/examples/js/watchOrderBookForSymbols.js @@ -0,0 +1,11 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbol = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const orderbook = await binance.watchOrderBookForSymbols(symbol); + console.log(orderbook['symbol'], orderbook['asks'][0], orderbook['bids'][0]); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts b/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts new file mode 100644 index 0000000..6856944 --- /dev/null +++ b/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=watchPositions-many-exchanges-continuosly.d.ts.map \ No newline at end of file diff --git a/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts.map b/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts.map new file mode 100644 index 0000000..9eaa21a --- /dev/null +++ b/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"watchPositions-many-exchanges-continuosly.d.ts","sourceRoot":"","sources":["../ts/watchPositions-many-exchanges-continuosly.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.js b/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.js new file mode 100644 index 0000000..f69a83f --- /dev/null +++ b/docs/ccxt/examples/js/watchPositions-many-exchanges-continuosly.js @@ -0,0 +1,49 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// watch and handle constinuosly +async function watchPositionsContinuously(exchange) { + while (true) { + try { + const positions = await exchange.watchPositions(); + console.log('Fetched ', exchange.id, ' - Positions: ', positions); + } + catch (e) { + console.log(e); + break; + } + } +} +// start exchanges and fetch OHLCV loop +async function startExchange(exchangeName, config) { + const ex = new ccxt[exchangeName](config); + const promises = []; + promises.push(watchPositionsContinuously(ex)); + await Promise.all(promises); + await ex.close(); +} +// main function +async function example() { + const exchanges = { + 'binanceusdm': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'okx': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'huobi': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + }; + const promises = []; + const exchangeIds = Object.keys(exchanges); + for (let i = 0; i < exchangeIds.length; i++) { + const exchangeName = exchangeIds[i]; + const config = exchanges[exchangeName]; + promises.push(startExchange(exchangeName, config)); + } + await Promise.all(promises); +} +await example(); diff --git a/docs/ccxt/examples/js/watchPositions.d.ts b/docs/ccxt/examples/js/watchPositions.d.ts new file mode 100644 index 0000000..05f8f3b --- /dev/null +++ b/docs/ccxt/examples/js/watchPositions.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=watchPositions.d.ts.map \ No newline at end of file diff --git a/docs/ccxt/examples/js/watchPositions.d.ts.map b/docs/ccxt/examples/js/watchPositions.d.ts.map new file mode 100644 index 0000000..5ec4a05 --- /dev/null +++ b/docs/ccxt/examples/js/watchPositions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"watchPositions.d.ts","sourceRoot":"","sources":["../ts/watchPositions.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/docs/ccxt/examples/js/watchPositions.js b/docs/ccxt/examples/js/watchPositions.js new file mode 100644 index 0000000..0720d54 --- /dev/null +++ b/docs/ccxt/examples/js/watchPositions.js @@ -0,0 +1,13 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.pro.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET' + }); + while (true) { + const trades = await exchange.watchPositions(); + console.log(trades); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watchPositionsForSymbols.d.ts b/docs/ccxt/examples/js/watchPositionsForSymbols.d.ts new file mode 100644 index 0000000..cdad8ef --- /dev/null +++ b/docs/ccxt/examples/js/watchPositionsForSymbols.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=watchPositionsForSymbols.d.ts.map \ No newline at end of file diff --git a/docs/ccxt/examples/js/watchPositionsForSymbols.d.ts.map b/docs/ccxt/examples/js/watchPositionsForSymbols.d.ts.map new file mode 100644 index 0000000..6d59ef9 --- /dev/null +++ b/docs/ccxt/examples/js/watchPositionsForSymbols.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"watchPositionsForSymbols.d.ts","sourceRoot":"","sources":["../ts/watchPositionsForSymbols.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/docs/ccxt/examples/js/watchPositionsForSymbols.js b/docs/ccxt/examples/js/watchPositionsForSymbols.js new file mode 100644 index 0000000..f8433bd --- /dev/null +++ b/docs/ccxt/examples/js/watchPositionsForSymbols.js @@ -0,0 +1,14 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.pro.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'Your_API_SECRET' + }); + const symbols = ['BTC/USDT:USDT', 'ETH/USDT:USDT', 'DOGE/USDT:USDT']; + while (true) { + const trades = await exchange.watchPositions(symbols); + console.log(trades); + } +} +await example(); diff --git a/docs/ccxt/examples/js/watchTradesForSymbols.js b/docs/ccxt/examples/js/watchTradesForSymbols.js new file mode 100644 index 0000000..2d5af59 --- /dev/null +++ b/docs/ccxt/examples/js/watchTradesForSymbols.js @@ -0,0 +1,11 @@ +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const trades = await binance.watchTradesForSymbols(symbols); + console.log(trades); + } +} +await example(); diff --git a/docs/ccxt/examples/js/withdraw-from-one-exchange-to-another.js b/docs/ccxt/examples/js/withdraw-from-one-exchange-to-another.js new file mode 100644 index 0000000..3404a3a --- /dev/null +++ b/docs/ccxt/examples/js/withdraw-from-one-exchange-to-another.js @@ -0,0 +1,50 @@ +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version', ccxt.version) + +async function main () { + + const binance = new ccxt.binance ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'fetchCurrencies': true, + }, + }) + + const kucoin = new ccxt.kucoin ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_API_PASSWORD', + }) + + await binance.loadMarkets () + await kucoin.loadMarkets () + + binance.verbose = true + kucoin.verbose = true + + const code = 'COTI' + const amount = 40 + + // https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params + // https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data + const deposit = await binance.fetchDepositAddress (code, { 'network': 'ETH' }) + + console.log ('-----------------------------------------------------------') + + console.log (depositAddress) + + console.log ('-----------------------------------------------------------') + + // https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params + // https://docs.kucoin.com/#apply-withdraw-2 + const withdrawal = await kucoin.withdraw (code, amount, deposit['address'], deposit['tag'], { 'chain': 'ERC20' }) + + console.log ('-----------------------------------------------------------') + + console.log (withdrawal) + +} + +main () diff --git a/docs/ccxt/examples/ts/.eslintrc b/docs/ccxt/examples/ts/.eslintrc new file mode 100644 index 0000000..f4c1774 --- /dev/null +++ b/docs/ccxt/examples/ts/.eslintrc @@ -0,0 +1,111 @@ +{ + "env": { + "es2021": true, + "node": true + }, + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module" + }, + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], + "extends": ["eslint:recommended", "airbnb-base", "plugin:import/typescript"], + "ignorePatterns": ["*/*", "cli.ts"], + "rules": { + "no-console": "off", + "import/no-unresolved":"off", // tmp until typescript decides to properly resolve names + "import/named": "off", + "strict": "off", + "semi": "error", + "indent": ["error", 4], + "init-declarations": "error", + "no-undef-init": "off", + "comma-dangle": ["error", { + "arrays": "always-multiline", + "objects": "always-multiline", + "imports": "always-multiline", + "exports": "always-multiline", + "functions": "never" + }], + "import/extensions": "off", + "brace-style": ["error", "1tbs"], + "multiline-comment-style": ["error", "separate-lines"], + "dot-notation": "off", + "quote-props": ["error", "always"], + "no-multi-spaces": ["error", { "ignoreEOLComments": true }], + "no-whitespace-before-property": "error", + "space-before-blocks": ["error", "always"], + "space-before-function-paren": ["error", "always"], + "no-spaced-func": "off", + "func-call-spacing": ["error", "always"], + "block-spacing": ["error", "always"], + "keyword-spacing": ["error", { "before": true, "after": true }], + "object-curly-spacing": ["error", "always", { "objectsInObjects": false }], + "object-curly-newline": ["error", { "consistent": true }], + "space-infix-ops": "error", + "space-unary-ops": "error", + "space-in-parens": "error", + "no-nested-ternary": "error", + "eqeqeq": "error", + "quotes": ["error", "single", { "avoidEscape": true }], + "no-unused-vars": ["warn", { "argsIgnorePattern": "^(headers|body|account|info|symbol|price|tag|side|since|limit|params|market|timeframe|api|path|code|currency|statusCode|statusText|url|method|response|requestHeaders|requestBody|bidsKey|asksKey|context|config|type|priceKey|amountKey|networkCode|marginMode|subscription|message|client)" }], + "new-parens": "error", + "new-cap": "off", + "no-var": "error", + "prefer-const": ["error", { + "destructuring": "any", + "ignoreReadBeforeAssign": false + }], + "no-warning-comments": ["warn", { "terms": ["fixme"] }], + "padded-blocks": ["error", "never"], + "lines-between-class-members": "error", + "no-multiple-empty-lines": ["error", { "max": 2 }], + "padding-line-between-statements": ["warn", + // { "blankLine": "never", "prev":"*", "next": "*" }, // comment this to allow blank-lines + { "blankLine": "always", "prev":"directive", "next": "*" }, + { "blankLine": "always", "prev":"*", "next": "cjs-export" }, + { "blankLine": "always", "prev":"*", "next": "export" }, + { "blankLine": "always", "prev":"*", "next": "function" } + ], + "prefer-template": "off", + "curly": "error", + "no-plusplus": "off", + "no-restricted-properties": "off", + "prefer-destructuring": "off", + "class-methods-use-this": "off", + "no-param-reassign": "off", + "max-len": "off", + "no-return-await": "off", + "array-bracket-spacing": ["error", "always"], + "radix": "off", + "camelcase": "off", + "no-lonely-if": "off", + "no-mixed-operators": "off", + "no-shadow": "off", + "no-useless-concat": "off", + "no-continue": "off", + "no-else-return": "off", + "no-unneeded-ternary": "off", + "operator-assignment": "off", + "no-underscore-dangle": "off", + "consistent-return": "off", + "no-await-in-loop": "off", + "prefer-exponentiation-operator": "off", + "no-use-before-define": ["error", { + "functions": false, + "classes": true, + "variables": true, + "allowNamedExports": false + }] + }, + "settings": { + "import/resolver": { + "node": { + "extensions": [".js", ".ts"] + } + }, + "import/parsers": { + "@typescript-eslint/parser": [".ts", ".js"] + } + } +} diff --git a/docs/ccxt/examples/ts/benchmark.ts b/docs/ccxt/examples/ts/benchmark.ts new file mode 100644 index 0000000..3484d2f --- /dev/null +++ b/docs/ccxt/examples/ts/benchmark.ts @@ -0,0 +1,134 @@ +import { spawn } from 'child_process'; +import asTable from 'as-table'; +import ccxt, { version } from '../../js/ccxt.js'; + +interface Stats { + min: number; + average: number; + max: number; + median: number; + iterations: number; +} + +interface Test { + language: string; + method: string; + command: string; +} + +interface Benchmark extends Omit, Stats { } + +const stats = (times: number[]): Stats => { + // calculate statistics + const sum = times.reduce ((a, b) => a + b, 0); + const avg = Math.round (sum / times.length); + const min = Math.min (...times); + const max = Math.max (...times); + times.sort ((a, b) => a - b); + const median = times.length % 2 === 0 ? (times[times.length / 2 - 1] + times[times.length / 2]) / 2 : times[Math.floor (times.length / 2)]; + return { min, 'average': avg, max, median, 'iterations': times.length }; +}; + +async function benchmark (exchangeId, method, args, verbose = false, minIterations = 10, argsv = '') { + const exchange = new ccxt.pro[exchangeId] ({}); + const languages = [ 'js', 'py', 'php', 'cs' ]; + const commands: Test[] = languages.map ((language) => ({ + 'language': language, + 'method': method, + 'command': `npm run cli.${language} ${exchangeId} ${method} ${args.join (' ')} -- ${argsv} --poll`, + })); + const wsMethod = method + 'Ws'; + if (exchange.has[wsMethod]) { + const wsCommands: Test[] = languages.map ((language) => ({ + 'language': language, + 'method': wsMethod, + 'command': `npm run cli.${language} ${exchangeId} ${wsMethod} ${args.join (' ')} -- ${argsv} --poll`, + })); + commands.push (...wsCommands); + } + const regex = /iteration (\d+) passed in (\d+) ms/g; + + async function runCommand (command: string) { + if (verbose) { + console.log (exchange.iso8601 (new Date ().getTime ()), ' running command:', command); + } + return new Promise<{ times: number[] }> ((resolve, reject) => { + const [ cmd, ...args ] = command.split (' '); + + const child = spawn (cmd, args); + const matches = []; + const language = command.slice (8, 15); + child.stdout.on ('data', (data: Buffer) => { + const message = data.toString (); + matches.push (...Array.from (message.matchAll (regex))); + const match = matches[matches.length - 1]; + + if (match && match[1] && match[2]) { + const iteration = parseInt (match[1]); + const time = parseInt (match[2]); + + if (iteration <= minIterations) { + if (verbose) { + console.log (exchange.iso8601 (new Date ().getTime ()), `${language} iteration ${iteration} passed in ${time} ms`); + } + } else { + const times = matches.map ((m) => parseInt (m[2])); + child.kill (); + if (verbose) { + console.log (exchange.iso8601 (new Date ().getTime ()), `killed process - ${language} iteration ${iteration} passed in ${time} ms`); + } + resolve ({ times }); + } + } + }); + + child.stderr.on ('data', (data: Buffer) => { + const message = data.toString (); + console.error (exchange.iso8601 (new Date ().getTime ()), `command ${command} failed. stderr: ${message}`); + const times = matches.map ((m) => parseInt (m[2])); + resolve ({ times }); + }); + + child.on ('close', (code: number) => { + const times = matches.map ((m) => parseInt (m[2])); + resolve ({ times }); + console.log (exchange.iso8601 (new Date ().getTime ()), `${language} child process exited with code ${code}`); + }); + + child.on ('error', (err) => { + console.error (exchange.iso8601 (new Date ().getTime ()), `command ${command} failed. error: ${err}`); + reject (err); + }); + }); + } + + const benchmarks: Benchmark[] = []; + const results = await Promise.all (commands.map ((c) => runCommand (c.command))); + for (let i = 0; i < results.length; i++) { + const result = results[i]; + benchmarks.push ({ 'language': commands[i].language, 'method': commands[i].method, ...stats (result.times) }); + } + if (verbose) { + const rawResults = results.map ((r, i) => ({ 'language': commands[i].language, 'method': commands[i].method, ...stats (r.times), 'times': r.times })); + console.log (rawResults); + } + console.log (asTable (benchmarks)); +} + +const [ _, , exchangeId, methodName, ...params ] = process.argv.filter ((x) => !x.startsWith ('--')); +const verbose = process.argv.includes ('--verbose'); +const minIterationsString = process.argv.find ((x) => x.startsWith ('--min-iterations='))?.slice (18); +const minIterations = minIterationsString ? parseInt (minIterationsString) : 10; +const argsv = process.argv.filter ((x) => x.startsWith ('--') && !x.startsWith ('--min-iterations')).join (' '); + + +console.log ((new Date ()).toISOString ()); +console.log ('Node.js:', process.version); +console.log ('CCXT v' + version); + +const start = new Date ().getTime (); +await benchmark (exchangeId, methodName, params, verbose, minIterations, argsv); +const end = new Date ().getTime (); + +console.log ((new Date ().toISOString ()), 'Total time:', end - start, 'ms'); +process.exit (0); diff --git a/docs/ccxt/examples/ts/build-ohlcv-bars.ts b/docs/ccxt/examples/ts/build-ohlcv-bars.ts new file mode 100644 index 0000000..0d6d5e6 --- /dev/null +++ b/docs/ccxt/examples/ts/build-ohlcv-bars.ts @@ -0,0 +1,53 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// Bulding OHLCV array from trades (executions) data is a bit tricky. For example, if you want to build 100 ohlcv bars of 1-minute timeframe, then you have to fetch the 100 minutes of trading data. So, higher timeframe bars require more trading data (i.e. building 100 bars of 1-day timeframe OHLCV would require massive amount of trading data, which might not be desirable for user, because of data-usage rate limits) + +async function example_with_fetch_trades () { + const exch = new ccxt.binance ({}); + const timeframe = '1m'; + const symbol = 'OGN/USDT'; + const since = exch.milliseconds () - 1000 * 60 * 30; // last 30 mins + const limit = 1000; + const trades = await exch.fetchTrades (symbol, since, limit); + const generatedBars = exch.buildOHLCVC (trades, timeframe, since, limit); + // you can ignore 6th index ("count" field) from ohlcv entries, which is not part of OHLCV standard structure and is just added internally by `buildOHLCVC` method + console.log ('[REST] Constructed', generatedBars.length, 'bars from trades: ', generatedBars); +} + +async function example_with_watch_trades () { + const exch = new ccxt.pro.binance ({}); + const timeframe = '1m'; + const symbol = 'DOGE/USDT'; + const limit = 1000; + const since = exch.milliseconds () - 10 * 60 * 1000 * 1000; // last 10 hrs + let collectedTrades = []; + const collectedBars = []; + while (true) { + const wsTrades = await exch.watchTrades (symbol, since, limit, {}); + collectedTrades = collectedTrades.concat (wsTrades); + const generatedBars = exch.buildOHLCVC (collectedTrades, timeframe, since, limit); + // Note: first bar would be partially constructed bar and its 'open' & 'high' & 'low' prices (except 'close' price) would probably have different values compared to real bar on chart, because the first obtained trade timestamp might be somewhere in the middle of timeframe period, so the pre-period would be missing because we would not have trades data. To fix that, you can get older data with `fetchTrades` to fill up bars till start bar. + for (let i = 0; i < generatedBars.length; i++) { + const bar = generatedBars[i]; + const barTimestamp = bar[0]; + const collectedBarsLength = collectedBars.length; + const lastCollectedBarTimestamp = collectedBarsLength > 0 ? collectedBars[collectedBarsLength - 1][0] : 0; + if (barTimestamp === lastCollectedBarTimestamp) { + // if timestamps are same, just updarte the last bar + collectedBars[collectedBarsLength - 1] = bar; + } else if (barTimestamp > lastCollectedBarTimestamp) { + collectedBars.push (bar); + // remove the trades from saved array, which were till last collected bar's open timestamp + collectedTrades = exch.filterBySinceLimit (collectedTrades, barTimestamp); + } + } + // Note: first bar would carry incomplete values, please read comment in "buildOHLCVCFromWatchTrades" method definition for further explanation + console.log ('[WS] Constructed', collectedBars.length, 'bars from', symbol, 'trades: ', collectedBars); + } +} + + +await example_with_fetch_trades (); +await example_with_watch_trades (); diff --git a/docs/ccxt/examples/ts/compare-two-exchanges-capabilities.ts b/docs/ccxt/examples/ts/compare-two-exchanges-capabilities.ts new file mode 100644 index 0000000..fcd2a71 --- /dev/null +++ b/docs/ccxt/examples/ts/compare-two-exchanges-capabilities.ts @@ -0,0 +1,36 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const prefix = '-'; + const exchange_1 = new ccxt.okx (); + const exchange_2 = new ccxt.htx (); + const keys_1 = Object.keys (exchange_1.has); + const keys_2 = Object.keys (exchange_2.has); + // check missing from exchange-1 + console.log ('### checking missing functionalities from exchange-1:', exchange_1.id); + for (let i = 0; i < keys_2.length; i++) { + const key = keys_2[i]; + if (exchange_2.has[key]) { + if (!keys_1.includes (key)) { + console.log (prefix, key, 'does not exist in', exchange_1.id, 'as opposed to', exchange_2.id); + } else if (exchange_2.has[key] !== exchange_1.has[key]) { + console.log (prefix, key, '> ', exchange_1.id, ':', exchange_1.has[key], ',', exchange_2.id, ':', exchange_2.has[key]); + } + } + } + // check missing from exchange-2 + console.log ('### checking missing functionalities from exchange-2:', exchange_2.id); + for (let i = 0; i < keys_1.length; i++) { + const key = keys_1[i]; + if (exchange_1.has[key]) { + if (!keys_2.includes (key)) { + console.log (prefix, key, 'does not exist in', exchange_2.id, 'as opposed to', exchange_1.id); + } else if (exchange_1.has[key] !== exchange_2.has[key]) { + console.log (prefix, key, '> ', exchange_2.id, ':', exchange_2.has[key], ',', exchange_1.id, ':', exchange_1.has[key]); + } + } + } +} +await example (); diff --git a/docs/ccxt/examples/ts/create-order-position-with-takeprofit-stoploss.ts b/docs/ccxt/examples/ts/create-order-position-with-takeprofit-stoploss.ts new file mode 100644 index 0000000..c570dd4 --- /dev/null +++ b/docs/ccxt/examples/ts/create-order-position-with-takeprofit-stoploss.ts @@ -0,0 +1,89 @@ +// @ts-nocheck +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +console.log ('CCXT Version:', ccxt.version); + +// ------------------------------------------------------------------------------ + +async function example () { + // at this moment, only OKX support embedded stop-loss & take-profit orders in unified manner. other exchanges are being added actively and will be available soon. + const exchange = new ccxt.okx ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + "password": "YOUR_API_PASSWORD", // if exchange does not require password, comment out this line + }); + + const symbol = 'DOGE/USDT:USDT'; + const side = 'buy'; // 'buy' | 'sell' + const order_type = 'limit'; // 'market' | 'limit' + const amount = 1; // how many contracts (see `market(symbol).contractSize` to find out coin portion per one contract) + + await exchange.loadMarkets (); + const market = exchange.market (symbol); + + const ticker = await exchange.fetchTicker (symbol); + + const last_price = ticker['last']; + const ask_price = ticker['ask']; + const bid_price = ticker['bid']; + + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + if (order_type === 'limit') { + price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + } + + // set trigger price for stop-loss/take-profit to 2% from current price + // (note, across different exchanges "trigger" price can be also mentioned with different synonyms, like "activation price", "stop price", "conditional price", etc. ) + const stop_loss_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 0.98 : 1.02); + const take_profit_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 1.02 : 0.98); + + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': stop_loss_trigger_price * 0.98, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': take_profit_trigger_price * 0.98, + }, + // note that some exchanges might require some exchange specific parameter when opening a position, i.e.: + // 'posSide': 'long', // for phemex hedge-mode api + }; + + const position_amount = market['contractSize'] * amount; + const position_value = position_amount * last_price; + // log + console.log ('Going to open a position', 'for', amount, 'contracts worth', position_amount, market['base'], '~', position_value, market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision (symbol, price) : ''), '), using the following params:'); + console.log (params); + console.log ('-----------------------------------------------------------------------'); + + // exchange.verbose = True // uncomment for debugging purposes if necessary + + try { + const created_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + console.log ("Created an order", created_order); + + // Fetch all your open orders for this symbol + // - use 'fetchOpenOrders' or 'fetchOrders' and filter with 'open' status + // - note, that some exchanges might return one order object with embedded stoploss/takeprofit fields, while other exchanges might have separate stoploss/takeprofit order objects + const all_open_orders = await exchange.fetchOpenOrders (symbol); + console.log ("Fetched all your orders for this symbol", all_open_orders); + + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } catch (e) { + console.log (e.toString ()); + } +} + + +await example (); + +// NOTES: +// - Sometimes you might experience, when their stop-loss/take-profit order might not become activated, even though on chart the price had crossed that "trigger-price" order was not executed . That happens because some exchange might be using mark-price (instead of last-price) as a reference-price, so that mark-price might reach your trigger-price and it would activate your SL/TP order (even though on your symbol's chart you are viewing the "last-price" by default, which could have different movements than the mark-price). diff --git a/docs/ccxt/examples/ts/create-order-ws-example.ts b/docs/ccxt/examples/ts/create-order-ws-example.ts new file mode 100644 index 0000000..84cc756 --- /dev/null +++ b/docs/ccxt/examples/ts/create-order-ws-example.ts @@ -0,0 +1,33 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.pro.binance ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode (true); + exchange.verbose = true; // uncomment for debugging purposes if necessary + // load markets + await exchange.loadMarkets (); + const symbol = 'ETH/USDT'; + const type = 'limit'; + const side = 'buy'; + const amount = 0.01; + let price = 1000; + let orders = []; + for (let i=1; i<5; i++) { + const response = await exchange.createOrderWs ( + symbol, + type, + side, + amount, + price + ); + price += i; + orders.push (response); + } + console.log (orders); +} +await example (); diff --git a/docs/ccxt/examples/ts/create-orders-example.ts b/docs/ccxt/examples/ts/create-orders-example.ts new file mode 100644 index 0000000..f810518 --- /dev/null +++ b/docs/ccxt/examples/ts/create-orders-example.ts @@ -0,0 +1,21 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.binance ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode (true); + await exchange.loadMarkets (); + exchange.verbose = true; // uncomment for debugging purposes if necessary + const orders = await exchange.createOrders ( + [ + { 'symbol': 'LTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 10, 'price': 55 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'market', 'side': 'buy', 'amount': 0.5 }, + ] + ); + console.log (orders); +} +await example (); diff --git a/docs/ccxt/examples/ts/create-trailing-amount-order.ts b/docs/ccxt/examples/ts/create-trailing-amount-order.ts new file mode 100644 index 0000000..9d04e28 --- /dev/null +++ b/docs/ccxt/examples/ts/create-trailing-amount-order.ts @@ -0,0 +1,37 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.bingx ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets (); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingAmount = 100; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingAmount': trailingAmount, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log (create_order); + } catch (e) { + console.log (e.toString ()); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/create-trailing-percent-order.ts b/docs/ccxt/examples/ts/create-trailing-percent-order.ts new file mode 100644 index 0000000..71832f9 --- /dev/null +++ b/docs/ccxt/examples/ts/create-trailing-percent-order.ts @@ -0,0 +1,37 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.bingx ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets (); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingPercent = 10; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingPercent': trailingPercent, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingPercentOrder (symbol, order_type, side, amount, price, trailingPercent, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log (create_order); + } catch (e) { + console.log (e.toString ()); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/custom-proxy-agent-for-js.ts b/docs/ccxt/examples/ts/custom-proxy-agent-for-js.ts new file mode 100644 index 0000000..bf3f36f --- /dev/null +++ b/docs/ccxt/examples/ts/custom-proxy-agent-for-js.ts @@ -0,0 +1,12 @@ +// @ts-nocheck +// to set custom "proxy-agent" for ccxt +import ccxt from 'ccxt'; +import HttpProxyAgent from 'http-proxy-agent'; +import HttpsProxyAgent from 'https-proxy-agent'; +const proxy = 'http://1.2.3.4:5678'; +const httpAgent = new HttpProxyAgent (proxy); +const httpsAgent = new HttpsProxyAgent (proxy); +// then pass it through constructor +const kraken = new ccxt.kraken ({ agent: httpAgent /* or httpsAgent */ }); +// or set it later +kraken.agent = agent; diff --git a/docs/ccxt/examples/ts/fetch-first-ohlcv-timestamp.ts b/docs/ccxt/examples/ts/fetch-first-ohlcv-timestamp.ts new file mode 100644 index 0000000..4b19944 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-first-ohlcv-timestamp.ts @@ -0,0 +1,88 @@ +// eslint-disable-next-line no-unused-vars +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + + +// ###### Description ###### +// +// This function tries to fetch the "listing time" of a symbol by fetching the earliest available bar in daily resolution. +// Top-tier exchanges also support fetching smaller timeframes (eg. 1 minute) even several years back, so for those exchanges you can also use `useMinuteTimeframe = true` argument to get the timestamp rounded to the earliest minute bar (instead of daily bar timestamp). +// See usage in the end of this file + + +async function fetchFirstBarTimestamp (exchange:any, symbol: string, useMinuteTimeframe = false) { + // set some constants + const millisecondsPerDay = 86400000; + const minutesPerDay = 1440; + const minimumTimestamp = 1230768000000; // 2009-01-01 (bitcoin created year) + // get market features + const market = exchange.market (symbol); + const marketType = exchange.safeString (market, 'type'); + let features = exchange.safeDict (exchange.features, marketType, {}); + if (market['subType'] !== undefined) { + features = exchange.safeDict (features, market['subType'], {}); + } + const ohlcv = exchange.safeDict (features, 'fetchOHLCV'); + if (ohlcv === undefined) { + return undefined; + } + const limit = exchange.safeInteger (ohlcv, 'limit'); + const fetchParams = { 'maxRetriesOnFailure': 3 }; + // start loop + let currentSince = exchange.milliseconds () - millisecondsPerDay * (limit - 1); + let foundStartTime = 0; + // eslint-disable-next-line + while (true) { + currentSince = Math.max (currentSince, minimumTimestamp); + const dailyBars = await exchange.fetchOHLCV (symbol, '1d', currentSince, limit, fetchParams); + if (dailyBars.length <= 0) { + break; // if no days returned, then probably start date was passed + } + const firstTs = dailyBars[0][0]; + if (firstTs === foundStartTime) { + // if the first timestamp is equal to the last-fetched timestamp, then break here, because some exchanges still return initial bar even if since is much ahead to listing time + break; + } + foundStartTime = firstTs; + currentSince = foundStartTime - millisecondsPerDay * (limit - 1); // shift 'since' one step back + if (dailyBars.length === 1) { + // in some cases, some exchanges might still return first bar of chart when endtime overlaps previous day + break; + } + } + // if minute resolution needed + if (useMinuteTimeframe) { + const maxIteration = Math.ceil (minutesPerDay / limit) * 2; + const allPromises: any[] = []; + for (let i = 0; i < maxIteration; i++) { + currentSince = foundStartTime - millisecondsPerDay + i * limit * 60 * 1000; // shift one-duration back for more accuracy for different kind of exchanges, like OKX, where first daily bar is offset by one day, but minute bars present + allPromises.push (exchange.fetchOHLCV (symbol, '1m', currentSince, limit, fetchParams)); + } + const allResponses = await Promise.all (allPromises); + // find earliest bar + for (let i = 0; i < allResponses.length; i++) { + const response = allResponses[i]; + if (response.length > 0) { + foundStartTime = response[0][0]; + break; + } + } + } + return foundStartTime; +} + +// ###### Usage ###### + +const runExample = false; // set to true to run example +if (runExample) { + const myEx = new ccxt.binance (); + await myEx.loadMarkets (); + const symbol = 'TRUMP/USDT'; + const earliest_timestamp = await fetchFirstBarTimestamp (myEx, symbol, true); + console.log ('- Earliest bar timestamp:', earliest_timestamp, ', readable: ', myEx.iso8601 (earliest_timestamp)); + console.log ('- market.created value:', myEx.market (symbol)['created']); +} + + +export default fetchFirstBarTimestamp; diff --git a/docs/ccxt/examples/ts/fetch-futures/.gitignore b/docs/ccxt/examples/ts/fetch-futures/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-futures/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/docs/ccxt/examples/ts/fetch-futures/package-lock.json b/docs/ccxt/examples/ts/fetch-futures/package-lock.json new file mode 100644 index 0000000..f22c38d --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-futures/package-lock.json @@ -0,0 +1,116 @@ +{ + "name": "fetch-futures", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "10.14.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz", + "integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==", + "dev": true + }, + "ansicolor": { + "version": "1.1.92", + "resolved": "https://registry.npmjs.org/ansicolor/-/ansicolor-1.1.92.tgz", + "integrity": "sha512-2jRpULfLpLvFeYYxIu1z6i0LQ4Khj/UxecsrdJ+837P0AVOW3smdKHpHmeKVYHZPG67o3jQFdMjNvPwktwPmZg==" + }, + "as-table": { + "version": "1.0.55", + "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", + "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", + "requires": { + "printable-characters": "^1.0.42" + } + }, + "ccxt": { + "version": "1.18.1145", + "resolved": "https://registry.npmjs.org/ccxt/-/ccxt-1.18.1145.tgz", + "integrity": "sha512-orU4kGB59RCMo3Ed04HBpRWqZdnpPcZ3VENPkF4ImacCm/ilte0boXAS+mYJVZSXLljyQzfm4D9fY7IukWsmIA==" + }, + "data-uri-to-buffer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.1.tgz", + "integrity": "sha512-OkVVLrerfAKZlW2ZZ3Ve2y65jgiWqBKsTfUIAFbn8nVbPcCZg6l6gikKlEYv0kXcmzqGm6mFq/Jf2vriuEkv8A==", + "requires": { + "@types/node": "^8.0.7" + }, + "dependencies": { + "@types/node": { + "version": "8.10.54", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.54.tgz", + "integrity": "sha512-kaYyLYf6ICn6/isAyD4K1MyWWd5Q3JgH6bnMN089LUx88+s4W8GvK9Q6JMBVu5vsFFp7pMdSxdKmlBXwH/VFRg==" + } + } + }, + "get-source": { + "version": "1.0.40", + "resolved": "https://registry.npmjs.org/get-source/-/get-source-1.0.40.tgz", + "integrity": "sha512-grbzSLO9gCVpb+ngrUf2ch4nzcfAs9pYqlnu0v2+Ho0rOpwnJqhZsHWLXaqdNHMtmnY+OwGgS4SPdzMRXEwVtQ==", + "requires": { + "data-uri-to-buffer": "^2.0.0", + "source-map": "^0.6.1" + } + }, + "ololog": { + "version": "1.1.146", + "resolved": "https://registry.npmjs.org/ololog/-/ololog-1.1.146.tgz", + "integrity": "sha512-C68zLVMFgIZC1Rdz7LTmtIEuAsth/2yllA/kb3OUfdWI9+U5x4F7EXO3xgfp9Rhn/tiETffo6DnWGPQaVHjKiw==", + "requires": { + "ansicolor": "^1.1.84", + "pipez": "^1.1.12", + "printable-characters": "^1.0.42", + "stacktracey": "^1.2.117", + "string.bullet": "^1.0.12", + "string.ify": "^1.0.57" + } + }, + "pipez": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/pipez/-/pipez-1.1.12.tgz", + "integrity": "sha1-s1nOVAHpNfEp+koJT83omvuENtg=" + }, + "printable-characters": { + "version": "1.0.42", + "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", + "integrity": "sha1-Pxjpd6m9jrN/zE/1ZZ176Qhos9g=" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "stacktracey": { + "version": "1.2.117", + "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-1.2.117.tgz", + "integrity": "sha512-sj9olGCco8jxMw3fcmhL5er1yuVL2qSMhNfycwx+iIWz6uVpG+bQ2YNpVSlWscGmSskt61gSmUBjZ0Mb5jYBLw==", + "requires": { + "as-table": "^1.0.36", + "get-source": "^1.0.34" + } + }, + "string.bullet": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/string.bullet/-/string.bullet-1.0.12.tgz", + "integrity": "sha1-tB/EF4UKV+QEK/PPNHtu7iV+4lM=", + "requires": { + "printable-characters": "^1.0.26" + } + }, + "string.ify": { + "version": "1.0.61", + "resolved": "https://registry.npmjs.org/string.ify/-/string.ify-1.0.61.tgz", + "integrity": "sha512-ROVOYWN8B62bP1LUJIDK6/NooBrN8xIvpV8Ugssbw7Oa4YKJmiOeoEomhDLLRVpYHo0vOBCpEM8RFpxUk9KDIQ==", + "requires": { + "printable-characters": "^1.0.42", + "string.bullet": "^1.0.12" + } + }, + "typescript": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", + "dev": true + } + } +} diff --git a/docs/ccxt/examples/ts/fetch-futures/package.json b/docs/ccxt/examples/ts/fetch-futures/package.json new file mode 100644 index 0000000..031a607 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-futures/package.json @@ -0,0 +1,34 @@ +{ + "name": "fetch-futures", + "version": "0.1.0", + "description": "ccxt example code in typescript.", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "files": [ + "build/src" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ccxt/ccxt.git" + }, + "keywords": [], + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "tsc -p .", + "start": "node ./build/index" + }, + "dependencies": { + "ansicolor": "^1.1.92", + "as-table": "^1.0.55", + "ccxt": "^2.0.0", + "ololog": "^1.1.146" + }, + "devDependencies": { + "typescript": "~3.5.0", + "@types/node": "^10.0.3" + }, + "engines": { + "node": ">=7.6.0" + } +} diff --git a/docs/ccxt/examples/ts/fetch-futures/prettier.config.js b/docs/ccxt/examples/ts/fetch-futures/prettier.config.js new file mode 100644 index 0000000..a425d3f --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-futures/prettier.config.js @@ -0,0 +1,4 @@ +module.exports = { + singleQuote: true, + trailingComma: 'es5', +}; diff --git a/docs/ccxt/examples/ts/fetch-futures/src/index.ts b/docs/ccxt/examples/ts/fetch-futures/src/index.ts new file mode 100644 index 0000000..87a2201 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-futures/src/index.ts @@ -0,0 +1,28 @@ +// Example code in typescript +// Based on /examples/js/fetch-okex-futures.js + +import * as ccxt from 'ccxt'; +const log = require('ololog'); + +const fetchFutures = async () => { + const exchange = new ccxt.bitmex(); + exchange.markets = await exchange.loadMarkets(true); + + for (let symbol in exchange.markets) { + log('----------------------------------------------------'); + log(`symbol = ${symbol}`); + try { + const market = exchange.markets[symbol]; + if (market['future']) { + const ticker = await exchange.fetchTicker(symbol); + log('----------------------------------------------------'); + log(symbol, ticker); + await (ccxt as any).sleep(exchange.rateLimit); // Missing type information. + } + } catch (error) { + log('error =', error); + } + } +}; + +fetchFutures(); diff --git a/docs/ccxt/examples/ts/fetch-futures/tsconfig.json b/docs/ccxt/examples/ts/fetch-futures/tsconfig.json new file mode 100644 index 0000000..a7c5d93 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-futures/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "rootDir": "src", + "outDir": "build", + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es2016" + ], + "module": "commonjs", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "pretty": true, + "sourceMap": true, + "strict": true, + "target": "es2017" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/docs/ccxt/examples/ts/fetch-ohlcv-many-exchanges-continuosly.ts b/docs/ccxt/examples/ts/fetch-ohlcv-many-exchanges-continuosly.ts new file mode 100644 index 0000000..f72127f --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-ohlcv-many-exchanges-continuosly.ts @@ -0,0 +1,44 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// fetch and handle constinuosly +async function fetchOHLCVContinuously (exchange, symbol) { + while (true) { + try { + const ohlcv = await exchange.fetchOHLCV (symbol); + const ohlcvLength = ohlcv.length; + console.log ('Fetched ', exchange.id, ' - ', symbol, ' candles. last candle: ', ohlcv[ohlcvLength - 1]); + } catch (e) { + console.log (e); + break; + } + } +} + +// start exchanges and fetch OHLCV loop +async function startExchange (exchangeName, symbols) { + const ex = new ccxt[exchangeName] ({}); + const promises = []; + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i]; + promises.push (fetchOHLCVContinuously (ex, symbol)); + } + await Promise.all (promises); + await ex.close (); +} + +// main function +async function example () { + const exchanges = [ 'binance', 'okx', 'kraken' ]; + const symbols = [ 'BTC/USDT', 'ETH/USDT' ]; + const promises = []; + for (let i = 0; i < exchanges.length; i++) { + const exchangeName = exchanges[i]; + promises.push (startExchange (exchangeName, symbols)); + } + await Promise.all (promises); +} + + +await example (); diff --git a/docs/ccxt/examples/ts/fetch-ohlcv.ts b/docs/ccxt/examples/ts/fetch-ohlcv.ts new file mode 100644 index 0000000..30d0e03 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-ohlcv.ts @@ -0,0 +1,17 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const myex = new ccxt.okx ({}); + const fromTimestamp = myex.milliseconds () - 86400 * 1000;// last 24 hrs + const ohlcv = await myex.fetchOHLCV ('BTC/USDT', '1m', fromTimestamp, 3, { 'whatever': 123 }); + const length = ohlcv.length; + if (length > 0) { + const lastPrice = ohlcv[length - 1][4]; + console.log ('Fetched ', length, ' candles for ', myex.id, ': last close ', lastPrice); + } else { + console.log ('No candles have been fetched'); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/fetch-tickers/.gitignore b/docs/ccxt/examples/ts/fetch-tickers/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-tickers/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/docs/ccxt/examples/ts/fetch-tickers/package-lock.json b/docs/ccxt/examples/ts/fetch-tickers/package-lock.json new file mode 100644 index 0000000..7b80624 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-tickers/package-lock.json @@ -0,0 +1,116 @@ +{ + "name": "fetch-tickers", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "10.14.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz", + "integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==", + "dev": true + }, + "ansicolor": { + "version": "1.1.92", + "resolved": "https://registry.npmjs.org/ansicolor/-/ansicolor-1.1.92.tgz", + "integrity": "sha512-2jRpULfLpLvFeYYxIu1z6i0LQ4Khj/UxecsrdJ+837P0AVOW3smdKHpHmeKVYHZPG67o3jQFdMjNvPwktwPmZg==" + }, + "as-table": { + "version": "1.0.55", + "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", + "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", + "requires": { + "printable-characters": "^1.0.42" + } + }, + "ccxt": { + "version": "1.18.1147", + "resolved": "https://registry.npmjs.org/ccxt/-/ccxt-1.18.1147.tgz", + "integrity": "sha512-3iflgpmBKgbskca3hwUDW/ewepKQ9rFEvxMV9s8NkWJFloO0ZAQzf3SfyxdRDGcJHcNNxSmbRFX/zRp3ucH0jw==" + }, + "data-uri-to-buffer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.1.tgz", + "integrity": "sha512-OkVVLrerfAKZlW2ZZ3Ve2y65jgiWqBKsTfUIAFbn8nVbPcCZg6l6gikKlEYv0kXcmzqGm6mFq/Jf2vriuEkv8A==", + "requires": { + "@types/node": "^8.0.7" + }, + "dependencies": { + "@types/node": { + "version": "8.10.54", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.54.tgz", + "integrity": "sha512-kaYyLYf6ICn6/isAyD4K1MyWWd5Q3JgH6bnMN089LUx88+s4W8GvK9Q6JMBVu5vsFFp7pMdSxdKmlBXwH/VFRg==" + } + } + }, + "get-source": { + "version": "1.0.40", + "resolved": "https://registry.npmjs.org/get-source/-/get-source-1.0.40.tgz", + "integrity": "sha512-grbzSLO9gCVpb+ngrUf2ch4nzcfAs9pYqlnu0v2+Ho0rOpwnJqhZsHWLXaqdNHMtmnY+OwGgS4SPdzMRXEwVtQ==", + "requires": { + "data-uri-to-buffer": "^2.0.0", + "source-map": "^0.6.1" + } + }, + "ololog": { + "version": "1.1.146", + "resolved": "https://registry.npmjs.org/ololog/-/ololog-1.1.146.tgz", + "integrity": "sha512-C68zLVMFgIZC1Rdz7LTmtIEuAsth/2yllA/kb3OUfdWI9+U5x4F7EXO3xgfp9Rhn/tiETffo6DnWGPQaVHjKiw==", + "requires": { + "ansicolor": "^1.1.84", + "pipez": "^1.1.12", + "printable-characters": "^1.0.42", + "stacktracey": "^1.2.117", + "string.bullet": "^1.0.12", + "string.ify": "^1.0.57" + } + }, + "pipez": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/pipez/-/pipez-1.1.12.tgz", + "integrity": "sha1-s1nOVAHpNfEp+koJT83omvuENtg=" + }, + "printable-characters": { + "version": "1.0.42", + "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", + "integrity": "sha1-Pxjpd6m9jrN/zE/1ZZ176Qhos9g=" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, + "stacktracey": { + "version": "1.2.117", + "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-1.2.117.tgz", + "integrity": "sha512-sj9olGCco8jxMw3fcmhL5er1yuVL2qSMhNfycwx+iIWz6uVpG+bQ2YNpVSlWscGmSskt61gSmUBjZ0Mb5jYBLw==", + "requires": { + "as-table": "^1.0.36", + "get-source": "^1.0.34" + } + }, + "string.bullet": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/string.bullet/-/string.bullet-1.0.12.tgz", + "integrity": "sha1-tB/EF4UKV+QEK/PPNHtu7iV+4lM=", + "requires": { + "printable-characters": "^1.0.26" + } + }, + "string.ify": { + "version": "1.0.61", + "resolved": "https://registry.npmjs.org/string.ify/-/string.ify-1.0.61.tgz", + "integrity": "sha512-ROVOYWN8B62bP1LUJIDK6/NooBrN8xIvpV8Ugssbw7Oa4YKJmiOeoEomhDLLRVpYHo0vOBCpEM8RFpxUk9KDIQ==", + "requires": { + "printable-characters": "^1.0.42", + "string.bullet": "^1.0.12" + } + }, + "typescript": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", + "dev": true + } + } +} diff --git a/docs/ccxt/examples/ts/fetch-tickers/package.json b/docs/ccxt/examples/ts/fetch-tickers/package.json new file mode 100644 index 0000000..67a98c7 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-tickers/package.json @@ -0,0 +1,34 @@ +{ + "name": "fetch-tickers", + "version": "0.1.0", + "description": "ccxt example code in typescript.", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "files": [ + "build/src" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ccxt/ccxt.git" + }, + "keywords": [], + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "tsc -p .", + "start": "node ./build/index" + }, + "dependencies": { + "ansicolor": "^1.1.92", + "as-table": "^1.0.55", + "ccxt": "^2.0.0", + "ololog": "^1.1.146" + }, + "devDependencies": { + "typescript": "~3.5.0", + "@types/node": "^10.0.3" + }, + "engines": { + "node": ">=7.6.0" + } +} diff --git a/docs/ccxt/examples/ts/fetch-tickers/prettier.config.js b/docs/ccxt/examples/ts/fetch-tickers/prettier.config.js new file mode 100644 index 0000000..a425d3f --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-tickers/prettier.config.js @@ -0,0 +1,4 @@ +module.exports = { + singleQuote: true, + trailingComma: 'es5', +}; diff --git a/docs/ccxt/examples/ts/fetch-tickers/src/index.ts b/docs/ccxt/examples/ts/fetch-tickers/src/index.ts new file mode 100644 index 0000000..0c3627d --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-tickers/src/index.ts @@ -0,0 +1,21 @@ +// Example code in typescript +// Based on /examples/js/fetch-from-many-exchanges-simultaneously.js + +import * as ccxt from 'ccxt'; +const log = require('ololog'); + +const symbol = 'BTC/USD'; +const exchanges = ['coinbasepro', 'gemini', 'kraken']; + +const fetchTickers = async (symbol: string) => { + const result = await Promise.all(exchanges.map(async (id: string): Promise => { + const CCXT = ccxt as any; // Hack! + const exchange = new CCXT[id]({ 'enableRateLimit': true }) as ccxt.Exchange; + const ticker = await exchange.fetchTicker(symbol); + const exchangeExtended = exchange.extend({ 'exchange': id }, ticker) as ccxt.Exchange; + return exchangeExtended; + })); + log(result); +}; + +fetchTickers(symbol); diff --git a/docs/ccxt/examples/ts/fetch-tickers/tsconfig.json b/docs/ccxt/examples/ts/fetch-tickers/tsconfig.json new file mode 100644 index 0000000..a7c5d93 --- /dev/null +++ b/docs/ccxt/examples/ts/fetch-tickers/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "rootDir": "src", + "outDir": "build", + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "declaration": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es2016" + ], + "module": "commonjs", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "pretty": true, + "sourceMap": true, + "strict": true, + "target": "es2017" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/docs/ccxt/examples/ts/hibachi-example.ts b/docs/ccxt/examples/ts/hibachi-example.ts new file mode 100644 index 0000000..dab1561 --- /dev/null +++ b/docs/ccxt/examples/ts/hibachi-example.ts @@ -0,0 +1,137 @@ +import { hibachi } from '../../js/ccxt.js'; +import fs from 'fs'; + +/* + In order to run the examples, you need to setup keys.local.json file like this: + ``` + { + "hibachi": { + "accountId": 111, + "apiKey": "1111111111111111111111111111111111111111111=", + "privateKey": "0x1111111111111111111111111111111111111111111111111111111111111111", + "publicKey": "0x11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", + "withdrawAddress": "0x1111111111111111111111111111111111111111" + } + } + ``` + You can get the accountId, apiKey and privateKey from Hibachi App by creating an API key + After that you can view the API key, it will show the publicKey (only for trustless account, you can ignore it for exchange managed account) + Note: if you are using exchange managed account, the privateKey's length will be 44 instead + The withdrawAddress can be any ethereum wallet address, that is used to receive funds for withdraw tests +*/ +async function example () { + const keys = JSON.parse(fs.readFileSync('keys.local.json', 'utf-8')); + const exchange = new hibachi (keys.hibachi); + exchange.verbose = true; + + const markets = await exchange.fetchMarkets(); + console.log ('fetchMarkets', markets.length, markets[0]); + + const currencies = await exchange.fetchCurrencies(); + console.dir (currencies, { depth: null, colors: true }); + + const trades = await exchange.fetchTrades("BTC/USDT:USDT"); + console.log('fetchTrades', trades.length, trades[0]); + + const tenMinutes = 10 * 60 * 1000; + const until = Date.now(); + const since = until - tenMinutes; + const ohlcv = await exchange.fetchOHLCV('BTC/USDT:USDT', '5min', since, 100, {until}); + console.log ('fetchOHLCV', ohlcv.length, ohlcv[0]); + + const balance = await exchange.fetchBalance(); + console.dir (balance, { depth: null, colors: true }); + + const ticker = await exchange.fetchTicker('BTC/USDT:USDT'); + console.log ('fetchTicker', ticker); + + // createOrder, editOrder and cancelOrder + const order1 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const order2 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002); + console.log('create market order', order1.id, order2.id); + const order3 = await exchange.createOrder('ETH/USDT:USDT', 'limit', 'buy', 1.234, 1.234); + const order4 = await exchange.editOrder(order3.id, 'ETH/USDT:USDT', 'limit', 'buy', 0.987, 1.123); + const order5 = await exchange.cancelOrder(order3.id); + console.log('create, edit and cancel limit order', order3.id, order4.id, order5.id); + + // advanced order parameters + const postOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, {'timeInForce': 'PO'}); + await exchange.cancelOrder(postOnlyOrder.id); + const iocOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, {'timeInForce': 'IOC'}); + await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const reduceOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002, undefined, {'reduceOnly': true}); + const triggerOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'sell', 2.0, 2.0, {'triggerPrice': '2.0'}); + await exchange.cancelOrder(triggerOrder.id); + console.log('postOnly, IOC, reduceOnly, trigger order', postOnlyOrder.id, iocOrder.id, reduceOnlyOrder.id, triggerOrder.id); + + const order1_info = await exchange.fetchOrder (order1.id, 'BTC/USDT:USDT'); + console.log ('fetchOrder', order1_info); + + const orderbook = await exchange.fetchOrderBook ('BTC/USDT:USDT'); + console.log ('fetchOrderBook', orderbook); + const withdrawResponse = await exchange.withdraw('USDT', 0.02, keys.hibachi.withdrawAddress); + console.log(withdrawResponse); + + const myTrades = await exchange.fetchMyTrades('BTC/USDT:USDT', undefined, 1); + console.log('fetchMyTrades', myTrades); + + const tradingFees = await exchange.fetchTradingFees (); + console.log ('fetchTradingFees', tradingFees); + + const openOrders = await exchange.fetchOpenOrders (); + console.log ('fetchOpenOrders', openOrders); + const openOrdersWithLimit = await exchange.fetchOpenOrders (undefined, undefined, 1); + console.log ('fetchOpenOrdersWithLimit', openOrdersWithLimit); + const openOrdersBTC = await exchange.fetchOpenOrders ('BTC/USDT:USDT'); + console.log ('fetchOpenOrdersBTC', openOrdersBTC); + const openOrdersSince = await exchange.fetchOpenOrders (undefined, 1752552000000); // 7/15/2025 00:00 UTC + console.log ('fetchOpenOrdersSince', openOrdersSince); + + if (keys.hibachi.publicKey !== undefined) { + const depositAddress = await exchange.fetchDepositAddress ('USDT', {'publicKey': keys.hibachi.publicKey}); + console.log ('fetchDepositAddress', depositAddress); + } + + const ledger = await exchange.fetchLedger('USDT', undefined, 2); + console.log('fetchLedger', ledger); + + const deposits = await exchange.fetchDeposits (); + console.log ('fetchDeposits', deposits); + + const withdrawals = await exchange.fetchWithdrawals (); + console.log ('fetchWithdrawals', withdrawals); + + const timestamp = await exchange.fetchTime(); + console.log('fetchTime', timestamp) + + const openInterest = await exchange.fetchOpenInterest('BTC/USDT:USDT'); + console.log('fetchOpenInterest', openInterest); + + const fundingRate = await exchange.fetchFundingRate('BTC/USDT:USDT'); + console.log('fetchFundingRate', fundingRate); + + const fundingRateHistory = await exchange.fetchFundingRateHistory('BTC/USDT:USDT', undefined, 2); + console.log('fetchFundingRateHistory', fundingRateHistory); + + // Batch orders + const createOrders = await exchange.createOrders([ + {'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.234, 'price': 1.234}, + {'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.001, 'price': 1.001}, + {'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.002, 'price': 1.002}, + {'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.003, 'price': 1.003}, + ]); + console.log('createOrders', createOrders); + const editOrders = await exchange.editOrders([ + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + {'id': createOrders[0].id, 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.111, 'price': 0.999}, + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + {'id': createOrders[1].id, 'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.112, 'price': 0.998}, + ]); + console.log('editOrders', editOrders); + const cancelOrders = await exchange.cancelOrders([createOrders[0].id, createOrders[1].id]); + console.log('cancelOrders', cancelOrders); + const cancelAll = await exchange.cancelAllOrders('ETH/USDT:USDT'); + console.log(cancelAll); + +} +example (); diff --git a/docs/ccxt/examples/ts/how-to-import-one-exchange-esm.ts b/docs/ccxt/examples/ts/how-to-import-one-exchange-esm.ts new file mode 100644 index 0000000..5838e02 --- /dev/null +++ b/docs/ccxt/examples/ts/how-to-import-one-exchange-esm.ts @@ -0,0 +1,11 @@ +import { binance } from '../../js/ccxt.js'; + +async function example () { + const exchange = new binance ({}); + const ob = await exchange.fetchOrderBook ('BTC/USDT', 3); + const asks = ob['asks']; + const bids = ob['bids']; + console.log (asks); + console.log (bids); +} +example (); diff --git a/docs/ccxt/examples/ts/kraken-create-and-close-position.ts b/docs/ccxt/examples/ts/kraken-create-and-close-position.ts new file mode 100644 index 0000000..8a54cb1 --- /dev/null +++ b/docs/ccxt/examples/ts/kraken-create-and-close-position.ts @@ -0,0 +1,69 @@ +// @ts-nocheck +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +console.log ('CCXT Version:', ccxt.version); + +// ------------------------------------------------------------------------------ + +async function example () { + const exchange = new ccxt.kraken ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + }); + + const symbol = 'UNI/USD'; + let side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'market'; // set it to 'market' or 'limit' + const amount = 1; + const leverage = 2; + + await exchange.loadMarkets (); + const market = exchange.market (symbol); + + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + // you can fetch the ticker and update price + // const ticker = await exchange.fetchTicker (symbol); + // const last_price = ticker['last']; + // const ask_price = ticker['ask']; + // const bid_price = ticker['bid']; + // if (order_type === 'limit') { + // price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + // } + + const params = { + 'leverage': leverage, + }; + + // log + console.log ('Going to open a position', 'for', amount, 'worth', amount, market['base'], '~', market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision (symbol, price) : ''), '), using the following params:'); + console.log (params); + console.log ('-----------------------------------------------------------------------'); + + // exchange.verbose = True // uncomment for debugging purposes if necessary + + try { + const created_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + console.log ("Created an order", created_order); + + // Fetch all your closed orders for this symbol (because we used market order) + // - use 'fetchClosedOrders' or 'fetchOrders' and filter with 'closed' status + const all_closed_orders = await exchange.fetchClosedOrders (symbol); + console.log ("Fetched all your closed orders for this symbol", all_closed_orders); + + const all_open_positions = await exchange.fetchPositions (symbol); + console.log ("Fetched all your positions for this symbol", all_open_positions); + + // To close a position: + // - long position (buy), you can create a sell order: exchange.createOrder (symbol, order_type, 'sell', amount, price, params); + // - short position (sell), you can create a buy order: exchange.createOrder (symbol, order_type, 'buy', amount, price, params); + } catch (e) { + console.log (e.toString ()); + } +} + + +await example (); diff --git a/docs/ccxt/examples/ts/margin-loan-borrow-buy-sell-repay.ts b/docs/ccxt/examples/ts/margin-loan-borrow-buy-sell-repay.ts new file mode 100644 index 0000000..a58711b --- /dev/null +++ b/docs/ccxt/examples/ts/margin-loan-borrow-buy-sell-repay.ts @@ -0,0 +1,72 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// Note, this is just an example and might not yet work on other exchanges, which are being still unified. + +async function example () { + // ########## user inputs ########## + const exchange = new ccxt['binance'] ({ 'apiKey': 'xxx', 'secret': 'xxx' }); + const symbol = 'BUSD/USDT'; // set target symbol + const marginMode = 'isolated'; // margin mode (cross or isolated) + const collateral_coin = 'USDT'; // which asset you want to use for margin-borrow collateral + const borrow_coin = 'BUSD'; // which coin to borrow + const order_side: any = 'sell'; // which side to trade + const amount_to_trade = 14; // how many coins to sell + const order_type = 'limit'; // order type (can be market, limit or etc) + const limit_price: any = 0.99; // price to sell at (set undefined/null/None if market-order) + const margin_magnitude = 5; // target margin (aka 'leverage'). This might also be obtainable using other unified methods, but for example purposes, we set here manually + // ########## end of user-inputs ########## + // + // for example purposes, let's also check available balance at first + const balance_margin = await exchange.fetchBalance ({ 'defaultType': 'margin', 'marginMode': marginMode }); // use `defaultType` because of temporary bug, otherwise, after several days, you can use `type` too. + // if we don't have enought coins, then we have to borrow at first + let needed_amount_to_borrow: any = undefined; // will be auto-set below + if (amount_to_trade > balance_margin[symbol][borrow_coin]['free']) { + needed_amount_to_borrow = amount_to_trade - balance_margin[symbol][borrow_coin]['free']; + console.log ('hmm, I have only ', balance_margin[symbol][borrow_coin]['free'], ' ', borrow_coin, ' in margin balance, and still need additional ', needed_amount_to_borrow, ' to make an order. Lets borrow it.'); + // To initate a borrow, at first, check if we have enough collateral (for this example, as we make a sell-short, we need '-1' to keep for collateral currency) + const needed_collateral_amount = needed_amount_to_borrow / (margin_magnitude - 1); + // Check if we have any collateral to get permission for borrow + if (balance_margin[symbol][collateral_coin]['free'] < needed_collateral_amount) { + // If we don't have enough collateral, then let's try to transfer collateral-asset from spot-balance to margin-balance + console.log ('hmm, I have only ', balance_margin[symbol][collateral_coin]['free'], ' in balance, but ', needed_collateral_amount, ' collateral is needed. I should transfer ', needed_collateral_amount, ' from spot'); + // let's check if we have spot balance at all + const balance_spot = await exchange.fetchBalance ({ 'type': 'spot' }); + if (exchange.parseNumber (balance_spot[collateral_coin]['free']) < needed_collateral_amount) { + console.log ('hmm, I neither do have enough balance on spot - only ', balance_spot[collateral_coin]['free'], '. Script can not continue...'); + return; + } else { + console.log ('Transferring ', needed_collateral_amount, ' to margin account'); + await exchange.transfer (collateral_coin, needed_collateral_amount, 'spot', marginMode, { 'symbol': symbol }); + } + } + // now, as we have enough margin collateral, initiate borrow + console.log ('Initiating margin borrow of ', needed_amount_to_borrow, ' ', borrow_coin); + const borrowResult = await exchange.borrowMargin (borrow_coin, needed_amount_to_borrow, symbol, { 'marginMode': marginMode }); + } + console.log ('Submitting order.'); + const order = await exchange.createOrder (symbol, order_type, order_side, amount_to_trade, limit_price, { 'marginMode': marginMode }); + console.log ('Order was submitted !', order['id']); + // + // + // ... + // ... + // some time later, if you want to repay the loan back (like 'close the position')... + // ... + // ... + // + // + // set the "repay-back" amount (for this example snippet, this will be same amount that we borrowed above) + if (needed_amount_to_borrow !== undefined) { + const amount_to_repay_back = needed_amount_to_borrow; + // At first, you need to get back the borrowed coin, by making an opposide trade + console.log ('Making purchase back of ', amount_to_repay_back, ' ', borrow_coin, ' to repay it back.'); + const purchase_back_price: any = 1.01; + const order_back = await exchange.createOrder (symbol, order_type, (order_side === 'buy' ? 'sell' : 'buy'), amount_to_repay_back, purchase_back_price, { 'marginMode': marginMode }); + console.log ('Now, repaying the loan.'); + const repayResult = await exchange.repayMargin (borrow_coin, amount_to_repay_back, symbol, { 'marginMode': marginMode }); + console.log ('finished.'); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/nextjs-page-router/.eslintrc.json b/docs/ccxt/examples/ts/nextjs-page-router/.eslintrc.json new file mode 100644 index 0000000..bffb357 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/.gitignore b/docs/ccxt/examples/ts/nextjs-page-router/.gitignore new file mode 100644 index 0000000..fd3dbb5 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/docs/ccxt/examples/ts/nextjs-page-router/README.md b/docs/ccxt/examples/ts/nextjs-page-router/README.md new file mode 100644 index 0000000..8074d85 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/README.md @@ -0,0 +1,43 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Description + +This app demonstrates the use of ccxt with a nextjs project. It showcases the use of both ccxt as a server side package and also to be running in the client: + +- **/tickers**: uses the **clients Window websockets** to connect to the exchange and stream ticker values + +- **/balance**: uses a **server side call** to protect exposing any api keys and fetches and shows the user balance. + +## Getting Started + +1. install the dependencies: + +```bash +npm run install +``` + + +2. Set the keys in pages/balance.tsx + +3. Run the app: + +```bash +npm run dev +# or +yarn dev +# or +pnpm dev +# or +bun dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +## Screenshots +##### Index +![menu](https://github.com/ccxt/ccxt/assets/12142844/645b5fe8-fd13-44f8-bded-20733843ccea) +##### Client side websocket example +![websocket](https://github.com/ccxt/ccxt/assets/12142844/7c28f8c9-aefd-4db3-8aff-6ff06b93a8bc) +##### Server side private endpoint fetch balance +![balance](https://github.com/ccxt/ccxt/assets/12142844/bd253903-43ea-4225-a7ca-193aaa29f42a) + diff --git a/docs/ccxt/examples/ts/nextjs-page-router/next.config.js b/docs/ccxt/examples/ts/nextjs-page-router/next.config.js new file mode 100644 index 0000000..a843cbe --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/next.config.js @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, +} + +module.exports = nextConfig diff --git a/docs/ccxt/examples/ts/nextjs-page-router/package-lock.json b/docs/ccxt/examples/ts/nextjs-page-router/package-lock.json new file mode 100644 index 0000000..d8b6031 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/package-lock.json @@ -0,0 +1,8052 @@ +{ + "name": "nextjs-page-router", + "version": "0.1.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "nextjs-page-router", + "version": "0.1.0", + "dependencies": { + "ccxt": "^4.1.56", + "next": "15.4.7", + "react": "^18", + "react-dom": "^18" + }, + "devDependencies": { + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "autoprefixer": "^10.0.1", + "eslint": "^8", + "eslint-config-next": "14.0.3", + "postcss": "^8", + "tailwindcss": "^3.3.0", + "typescript": "^5" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@babel/runtime": { + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", + "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.5.0.tgz", + "integrity": "sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", + "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "dev": true + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.3.tgz", + "integrity": "sha512-ryFMfvxxpQRsgZJqBd4wsttYQbCxsJksrv9Lw/v798JcQ8+w84mBWuXwl+TT0WJ/WrYOLaYpwQXi3sA9nTIaIg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.2.0" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.3.tgz", + "integrity": "sha512-yHpJYynROAj12TA6qil58hmPmAwxKKC7reUqtGLzsOHfP7/rniNGTL8tjWX6L3CTV4+5P4ypcS7Pp+7OB+8ihA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.2.0" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.0.tgz", + "integrity": "sha512-sBZmpwmxqwlqG9ueWFXtockhsxefaV6O84BMOrhtg/YqbTaRdqDE7hxraVE3y6gVM4eExmfzW4a8el9ArLeEiQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.0.tgz", + "integrity": "sha512-M64XVuL94OgiNHa5/m2YvEQI5q2cl9d/wk0qFTDVXcYzi43lxuiFTftMR1tOnFQovVXNZJ5TURSDK2pNe9Yzqg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.0.tgz", + "integrity": "sha512-mWd2uWvDtL/nvIzThLq3fr2nnGfyr/XMXlq8ZJ9WMR6PXijHlC3ksp0IpuhK6bougvQrchUAfzRLnbsen0Cqvw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.0.tgz", + "integrity": "sha512-RXwd0CgG+uPRX5YYrkzKyalt2OJYRiJQ8ED/fi1tq9WQW2jsQIn0tqrlR5l5dr/rjqq6AHAxURhj2DVjyQWSOA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.0.tgz", + "integrity": "sha512-Xod/7KaDDHkYu2phxxfeEPXfVXFKx70EAFZ0qyUdOjCcxbjqyJOEUpDe6RIyaunGxT34Anf9ue/wuWOqBW2WcQ==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.0.tgz", + "integrity": "sha512-eMKfzDxLGT8mnmPJTNMcjfO33fLiTDsrMlUVcp6b96ETbnJmd4uvZxVJSKPQfS+odwfVaGifhsB07J1LynFehw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.0.tgz", + "integrity": "sha512-ZW3FPWIc7K1sH9E3nxIGB3y3dZkpJlMnkk7z5tu1nSkBoCgw2nSRTFHI5pB/3CQaJM0pdzMF3paf9ckKMSE9Tg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.0.tgz", + "integrity": "sha512-UG+LqQJbf5VJ8NWJ5Z3tdIe/HXjuIdo4JeVNADXBFuG7z9zjoegpzzGIyV5zQKi4zaJjnAd2+g2nna8TZvuW9Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.0.tgz", + "integrity": "sha512-SRYOLR7CXPgNze8akZwjoGBoN1ThNZoqpOgfnOxmWsklTGVfJiGJoC/Lod7aNMGA1jSsKWM1+HRX43OP6p9+6Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.3.tgz", + "integrity": "sha512-oBK9l+h6KBN0i3dC8rYntLiVfW8D8wH+NPNT3O/WBHeW0OQWCjfWksLUaPidsrDKpJgXp3G3/hkmhptAW0I3+A==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.2.0" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.3.tgz", + "integrity": "sha512-QdrKe3EvQrqwkDrtuTIjI0bu6YEJHTgEeqdzI3uWJOH6G1O8Nl1iEeVYRGdj1h5I21CqxSvQp1Yv7xeU3ZewbA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.2.0" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.3.tgz", + "integrity": "sha512-GLtbLQMCNC5nxuImPR2+RgrviwKwVql28FWZIW1zWruy6zLgA5/x2ZXk3mxj58X/tszVF69KK0Is83V8YgWhLA==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.2.0" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.3.tgz", + "integrity": "sha512-3gahT+A6c4cdc2edhsLHmIOXMb17ltffJlxR0aC2VPZfwKoTGZec6u5GrFgdR7ciJSsHT27BD3TIuGcuRT0KmQ==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.2.0" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.3.tgz", + "integrity": "sha512-8kYso8d806ypnSq3/Ly0QEw90V5ZoHh10yH0HnrzOCr6DKAPI6QVHvwleqMkVQ0m+fc7EH8ah0BB0QPuWY6zJQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.2.0" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.3.tgz", + "integrity": "sha512-vAjbHDlr4izEiXM1OTggpCcPg9tn4YriK5vAjowJsHwdBIdx0fYRsURkxLG2RLm9gyBq66gwtWI8Gx0/ov+JKQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.2.0" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.3.tgz", + "integrity": "sha512-gCWUn9547K5bwvOn9l5XGAEjVTTRji4aPTqLzGXHvIr6bIDZKNTA34seMPgM0WmSf+RYBH411VavCejp3PkOeQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.2.0" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.3.tgz", + "integrity": "sha512-+CyRcpagHMGteySaWos8IbnXcHgfDn7pO2fiC2slJxvNq9gDipYBN42/RagzctVRKgxATmfqOSulgZv5e1RdMg==", + "cpu": [ + "wasm32" + ], + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.4.4" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.3.tgz", + "integrity": "sha512-MjnHPnbqMXNC2UgeLJtX4XqoVHHlZNd+nPt1kRPmj63wURegwBhZlApELdtxM2OIZDRv/DFtLcNhVbd1z8GYXQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.3.tgz", + "integrity": "sha512-xuCdhH44WxuXgOM714hn4amodJMZl3OEvf0GVTm0BEyMeA2to+8HEdRPShH0SLYptJY1uBw+SCFP9WVQi1Q/cw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.3.tgz", + "integrity": "sha512-OWwz05d++TxzLEv4VnsTz5CmZ6mI6S05sfQGEMrNrQcOEERbX46332IvE7pO/EUiw7jUrrS40z/M7kPyjfl04g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@next/env": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.7.tgz", + "integrity": "sha512-PrBIpO8oljZGTOe9HH0miix1w5MUiGJ/q83Jge03mHEE0E3pyqzAy2+l5G6aJDbXoobmxPJTVhbCuwlLtjSHwg==" + }, + "node_modules/@next/eslint-plugin-next": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-14.0.3.tgz", + "integrity": "sha512-j4K0n+DcmQYCVnSAM+UByTVfIHnYQy2ODozfQP+4RdwtRDfobrIvKq1K4Exb2koJ79HSSa7s6B2SA8T/1YR3RA==", + "dev": true, + "dependencies": { + "glob": "7.1.7" + } + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.4.7.tgz", + "integrity": "sha512-2Dkb+VUTp9kHHkSqtws4fDl2Oxms29HcZBwFIda1X7Ztudzy7M6XF9HDS2dq85TmdN47VpuhjE+i6wgnIboVzQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.4.7.tgz", + "integrity": "sha512-qaMnEozKdWezlmh1OGDVFueFv2z9lWTcLvt7e39QA3YOvZHNpN2rLs/IQLwZaUiw2jSvxW07LxMCWtOqsWFNQg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.4.7.tgz", + "integrity": "sha512-ny7lODPE7a15Qms8LZiN9wjNWIeI+iAZOFDOnv2pcHStncUr7cr9lD5XF81mdhrBXLUP9yT9RzlmSWKIazWoDw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.4.7.tgz", + "integrity": "sha512-4SaCjlFR/2hGJqZLLWycccy1t+wBrE/vyJWnYaZJhUVHccpGLG5q0C+Xkw4iRzUIkE+/dr90MJRUym3s1+vO8A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.4.7.tgz", + "integrity": "sha512-2uNXjxvONyRidg00VwvlTYDwC9EgCGNzPAPYbttIATZRxmOZ3hllk/YYESzHZb65eyZfBR5g9xgCZjRAl9YYGg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.4.7.tgz", + "integrity": "sha512-ceNbPjsFgLscYNGKSu4I6LYaadq2B8tcK116nVuInpHHdAWLWSwVK6CHNvCi0wVS9+TTArIFKJGsEyVD1H+4Kg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.4.7.tgz", + "integrity": "sha512-pZyxmY1iHlZJ04LUL7Css8bNvsYAMYOY9JRwFA3HZgpaNKsJSowD09Vg2R9734GxAcLJc2KDQHSCR91uD6/AAw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.4.7.tgz", + "integrity": "sha512-HjuwPJ7BeRzgl3KrjKqD2iDng0eQIpIReyhpF5r4yeAHFwWRuAhfW92rWv/r3qeQHEwHsLRzFDvMqRjyM5DI6A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@rushstack/eslint-patch": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz", + "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==", + "dev": true + }, + "node_modules/@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.9.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.2.tgz", + "integrity": "sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/prop-types": { + "version": "15.7.10", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.10.tgz", + "integrity": "sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A==", + "dev": true + }, + "node_modules/@types/react": { + "version": "18.2.37", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz", + "integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==", + "dev": true, + "dependencies": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.2.15", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.15.tgz", + "integrity": "sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==", + "dev": true, + "dependencies": { + "@types/react": "*" + } + }, + "node_modules/@types/scheduler": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.6.tgz", + "integrity": "sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA==", + "dev": true + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.11.0.tgz", + "integrity": "sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "6.11.0", + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/typescript-estree": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz", + "integrity": "sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.11.0.tgz", + "integrity": "sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz", + "integrity": "sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz", + "integrity": "sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.11.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.2.tgz", + "integrity": "sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ast-types-flow": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz", + "integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==", + "dev": true + }, + "node_modules/asynciterator.prototype": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz", + "integrity": "sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + } + }, + "node_modules/autoprefixer": { + "version": "10.4.16", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", + "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "browserslist": "^4.21.10", + "caniuse-lite": "^1.0.30001538", + "fraction.js": "^4.3.6", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axe-core": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.7.0.tgz", + "integrity": "sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/axobject-query": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", + "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", + "node-releases": "^2.0.13", + "update-browserslist-db": "^1.0.13" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/call-bind": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001617", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz", + "integrity": "sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/ccxt": { + "version": "4.1.56", + "resolved": "https://registry.npmjs.org/ccxt/-/ccxt-4.1.56.tgz", + "integrity": "sha512-Nf8Oi2tYa1oOntMeUE9J8nsaoIaBJiHbrj70KG4rUOlxirHupO8ggbv53FTyG4TyjqNcsmxsnO/ByhUA1bH2Tg==", + "hasInstallScript": true, + "dependencies": { + "ws": "^8.8.1" + }, + "engines": { + "node": ">=15.0.0" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" + }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "optional": true, + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "devOptional": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "devOptional": true + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "optional": true, + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", + "dev": true + }, + "node_modules/damerau-levenshtein": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", + "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", + "dev": true + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.588", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.588.tgz", + "integrity": "sha512-soytjxwbgcCu7nh5Pf4S2/4wa6UIu+A3p03U2yVr53qGxi1/VTR3ENI+p50v+UxqqZAfl48j3z55ud7VHIOr9w==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/es-abstract": { + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", + "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.5", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.2", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz", + "integrity": "sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==", + "dev": true, + "dependencies": { + "asynciterator.prototype": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.1", + "es-set-tostringtag": "^2.0.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "iterator.prototype": "^1.1.2", + "safe-array-concat": "^1.0.1" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", + "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.2", + "has-tostringtag": "^1.0.0", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", + "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.54.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-next": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-14.0.3.tgz", + "integrity": "sha512-IKPhpLdpSUyKofmsXUfrvBC49JMUTdeaD8ZIH4v9Vk0sC1X6URTuTJCLtA0Vwuj7V/CQh0oISuSTvNn5//Buew==", + "dev": true, + "dependencies": { + "@next/eslint-plugin-next": "14.0.3", + "@rushstack/eslint-patch": "^1.3.3", + "@typescript-eslint/parser": "^5.4.2 || ^6.0.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-import-resolver-typescript": "^3.5.2", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.5.0 || 5.0.0-canary-7118f5dd7-20230705" + }, + "peerDependencies": { + "eslint": "^7.23.0 || ^8.0.0", + "typescript": ">=3.3.1" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz", + "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==", + "dev": true, + "dependencies": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", + "get-tsconfig": "^4.5.0", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz", + "integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.14.2" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-jsx-a11y": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.8.0.tgz", + "integrity": "sha512-Hdh937BS3KdwwbBaKd5+PLCOmYY6U4f2h9Z2ktwtNKvIdIEu137rjYbcb9ApSbVJfWxANNuiKTD/9tOKjK9qOA==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.23.2", + "aria-query": "^5.3.0", + "array-includes": "^3.1.7", + "array.prototype.flatmap": "^1.3.2", + "ast-types-flow": "^0.0.8", + "axe-core": "=4.7.0", + "axobject-query": "^3.2.1", + "damerau-levenshtein": "^1.0.8", + "emoji-regex": "^9.2.2", + "es-iterator-helpers": "^1.0.15", + "hasown": "^2.0.0", + "jsx-ast-utils": "^3.3.5", + "language-tags": "^1.0.9", + "minimatch": "^3.1.2", + "object.entries": "^1.1.7", + "object.fromentries": "^2.0.7" + }, + "engines": { + "node": ">=4.0" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.33.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", + "integrity": "sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flatmap": "^1.3.1", + "array.prototype.tosorted": "^1.1.1", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.0.12", + "estraverse": "^5.3.0", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.6", + "object.fromentries": "^2.0.6", + "object.hasown": "^1.1.2", + "object.values": "^1.1.6", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.4", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.8" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", + "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", + "dev": true, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" + } + }, + "node_modules/eslint-plugin-react/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/fraction.js": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", + "dev": true, + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", + "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", + "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.2", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "optional": true + }, + "node_modules/is-async-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", + "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz", + "integrity": "sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/iterator.prototype": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", + "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "reflect.getprototypeof": "^1.0.4", + "set-function-name": "^2.0.1" + } + }, + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/language-subtag-registry": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", + "integrity": "sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==", + "dev": true + }, + "node_modules/language-tags": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.9.tgz", + "integrity": "sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==", + "dev": true, + "dependencies": { + "language-subtag-registry": "^0.3.20" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/next": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/next/-/next-15.4.7.tgz", + "integrity": "sha512-OcqRugwF7n7mC8OSYjvsZhhG1AYSvulor1EIUsIkbbEbf1qoE5EbH36Swj8WhF4cHqmDgkiam3z1c1W0J1Wifg==", + "dependencies": { + "@next/env": "15.4.7", + "@swc/helpers": "0.5.15", + "caniuse-lite": "^1.0.30001579", + "postcss": "8.4.31", + "styled-jsx": "5.1.6" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "15.4.7", + "@next/swc-darwin-x64": "15.4.7", + "@next/swc-linux-arm64-gnu": "15.4.7", + "@next/swc-linux-arm64-musl": "15.4.7", + "@next/swc-linux-x64-gnu": "15.4.7", + "@next/swc-linux-x64-musl": "15.4.7", + "@next/swc-win32-arm64-msvc": "15.4.7", + "@next/swc-win32-x64-msvc": "15.4.7", + "sharp": "^0.34.3" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.51.1", + "babel-plugin-react-compiler": "*", + "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "@playwright/test": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz", + "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, + "node_modules/object.hasown": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", + "integrity": "sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "dev": true, + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-js": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", + "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", + "dev": true, + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.1.tgz", + "integrity": "sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==", + "dev": true, + "dependencies": { + "lilconfig": "^2.0.5", + "yaml": "^2.1.1" + }, + "engines": { + "node": ">= 14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": ">=8.0.9", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/postcss-nested": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz", + "integrity": "sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==", + "dev": true, + "dependencies": { + "postcss-selector-parser": "^6.0.11" + }, + "engines": { + "node": ">=12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.13", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", + "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", + "dev": true, + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dev": true, + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.4.tgz", + "integrity": "sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "which-builtin-type": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", + "dev": true + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "devOptional": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-function-length": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", + "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/sharp": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.3.tgz", + "integrity": "sha512-eX2IQ6nFohW4DbvHIOLRB3MHFpYqaqvXd3Tp5e/T/dSH83fxaNJQRvDMhASmkNTsNTVF2/OOopzRCt7xokgPfg==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.4", + "semver": "^7.7.2" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.34.3", + "@img/sharp-darwin-x64": "0.34.3", + "@img/sharp-libvips-darwin-arm64": "1.2.0", + "@img/sharp-libvips-darwin-x64": "1.2.0", + "@img/sharp-libvips-linux-arm": "1.2.0", + "@img/sharp-libvips-linux-arm64": "1.2.0", + "@img/sharp-libvips-linux-ppc64": "1.2.0", + "@img/sharp-libvips-linux-s390x": "1.2.0", + "@img/sharp-libvips-linux-x64": "1.2.0", + "@img/sharp-libvips-linuxmusl-arm64": "1.2.0", + "@img/sharp-libvips-linuxmusl-x64": "1.2.0", + "@img/sharp-linux-arm": "0.34.3", + "@img/sharp-linux-arm64": "0.34.3", + "@img/sharp-linux-ppc64": "0.34.3", + "@img/sharp-linux-s390x": "0.34.3", + "@img/sharp-linux-x64": "0.34.3", + "@img/sharp-linuxmusl-arm64": "0.34.3", + "@img/sharp-linuxmusl-x64": "0.34.3", + "@img/sharp-wasm32": "0.34.3", + "@img/sharp-win32-arm64": "0.34.3", + "@img/sharp-win32-ia32": "0.34.3", + "@img/sharp-win32-x64": "0.34.3" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "optional": true, + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz", + "integrity": "sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "regexp.prototype.flags": "^1.5.0", + "set-function-name": "^2.0.0", + "side-channel": "^1.0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/styled-jsx": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "license": "MIT", + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/sucrase": { + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.34.0.tgz", + "integrity": "sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "7.1.6", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sucrase/node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tailwindcss": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", + "dev": true, + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.5.3", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.3.0", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.19.1", + "lilconfig": "^2.1.0", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.0.0", + "postcss": "^8.4.23", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.1", + "postcss-nested": "^6.0.1", + "postcss-selector-parser": "^6.0.11", + "resolve": "^1.22.2", + "sucrase": "^3.32.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true + }, + "node_modules/tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.1.3.tgz", + "integrity": "sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==", + "dev": true, + "dependencies": { + "function.prototype.name": "^1.1.5", + "has-tostringtag": "^1.0.0", + "is-async-function": "^2.0.0", + "is-date-object": "^1.0.5", + "is-finalizationregistry": "^1.0.2", + "is-generator-function": "^1.0.10", + "is-regex": "^1.1.4", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", + "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.4", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true + }, + "@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "dev": true + }, + "@babel/runtime": { + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", + "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.14.0" + } + }, + "@emnapi/runtime": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.5.0.tgz", + "integrity": "sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ==", + "optional": true, + "requires": { + "tslib": "^2.4.0" + } + }, + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true + }, + "@eslint/eslintrc": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + } + }, + "@eslint/js": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", + "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", + "dev": true + }, + "@humanwhocodes/config-array": { + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^2.0.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/object-schema": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "dev": true + }, + "@img/sharp-darwin-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.3.tgz", + "integrity": "sha512-ryFMfvxxpQRsgZJqBd4wsttYQbCxsJksrv9Lw/v798JcQ8+w84mBWuXwl+TT0WJ/WrYOLaYpwQXi3sA9nTIaIg==", + "optional": true, + "requires": { + "@img/sharp-libvips-darwin-arm64": "1.2.0" + } + }, + "@img/sharp-darwin-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.3.tgz", + "integrity": "sha512-yHpJYynROAj12TA6qil58hmPmAwxKKC7reUqtGLzsOHfP7/rniNGTL8tjWX6L3CTV4+5P4ypcS7Pp+7OB+8ihA==", + "optional": true, + "requires": { + "@img/sharp-libvips-darwin-x64": "1.2.0" + } + }, + "@img/sharp-libvips-darwin-arm64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.0.tgz", + "integrity": "sha512-sBZmpwmxqwlqG9ueWFXtockhsxefaV6O84BMOrhtg/YqbTaRdqDE7hxraVE3y6gVM4eExmfzW4a8el9ArLeEiQ==", + "optional": true + }, + "@img/sharp-libvips-darwin-x64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.0.tgz", + "integrity": "sha512-M64XVuL94OgiNHa5/m2YvEQI5q2cl9d/wk0qFTDVXcYzi43lxuiFTftMR1tOnFQovVXNZJ5TURSDK2pNe9Yzqg==", + "optional": true + }, + "@img/sharp-libvips-linux-arm": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.0.tgz", + "integrity": "sha512-mWd2uWvDtL/nvIzThLq3fr2nnGfyr/XMXlq8ZJ9WMR6PXijHlC3ksp0IpuhK6bougvQrchUAfzRLnbsen0Cqvw==", + "optional": true + }, + "@img/sharp-libvips-linux-arm64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.0.tgz", + "integrity": "sha512-RXwd0CgG+uPRX5YYrkzKyalt2OJYRiJQ8ED/fi1tq9WQW2jsQIn0tqrlR5l5dr/rjqq6AHAxURhj2DVjyQWSOA==", + "optional": true + }, + "@img/sharp-libvips-linux-ppc64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.0.tgz", + "integrity": "sha512-Xod/7KaDDHkYu2phxxfeEPXfVXFKx70EAFZ0qyUdOjCcxbjqyJOEUpDe6RIyaunGxT34Anf9ue/wuWOqBW2WcQ==", + "optional": true + }, + "@img/sharp-libvips-linux-s390x": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.0.tgz", + "integrity": "sha512-eMKfzDxLGT8mnmPJTNMcjfO33fLiTDsrMlUVcp6b96ETbnJmd4uvZxVJSKPQfS+odwfVaGifhsB07J1LynFehw==", + "optional": true + }, + "@img/sharp-libvips-linux-x64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.0.tgz", + "integrity": "sha512-ZW3FPWIc7K1sH9E3nxIGB3y3dZkpJlMnkk7z5tu1nSkBoCgw2nSRTFHI5pB/3CQaJM0pdzMF3paf9ckKMSE9Tg==", + "optional": true + }, + "@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.0.tgz", + "integrity": "sha512-UG+LqQJbf5VJ8NWJ5Z3tdIe/HXjuIdo4JeVNADXBFuG7z9zjoegpzzGIyV5zQKi4zaJjnAd2+g2nna8TZvuW9Q==", + "optional": true + }, + "@img/sharp-libvips-linuxmusl-x64": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.0.tgz", + "integrity": "sha512-SRYOLR7CXPgNze8akZwjoGBoN1ThNZoqpOgfnOxmWsklTGVfJiGJoC/Lod7aNMGA1jSsKWM1+HRX43OP6p9+6Q==", + "optional": true + }, + "@img/sharp-linux-arm": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.3.tgz", + "integrity": "sha512-oBK9l+h6KBN0i3dC8rYntLiVfW8D8wH+NPNT3O/WBHeW0OQWCjfWksLUaPidsrDKpJgXp3G3/hkmhptAW0I3+A==", + "optional": true, + "requires": { + "@img/sharp-libvips-linux-arm": "1.2.0" + } + }, + "@img/sharp-linux-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.3.tgz", + "integrity": "sha512-QdrKe3EvQrqwkDrtuTIjI0bu6YEJHTgEeqdzI3uWJOH6G1O8Nl1iEeVYRGdj1h5I21CqxSvQp1Yv7xeU3ZewbA==", + "optional": true, + "requires": { + "@img/sharp-libvips-linux-arm64": "1.2.0" + } + }, + "@img/sharp-linux-ppc64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.3.tgz", + "integrity": "sha512-GLtbLQMCNC5nxuImPR2+RgrviwKwVql28FWZIW1zWruy6zLgA5/x2ZXk3mxj58X/tszVF69KK0Is83V8YgWhLA==", + "optional": true, + "requires": { + "@img/sharp-libvips-linux-ppc64": "1.2.0" + } + }, + "@img/sharp-linux-s390x": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.3.tgz", + "integrity": "sha512-3gahT+A6c4cdc2edhsLHmIOXMb17ltffJlxR0aC2VPZfwKoTGZec6u5GrFgdR7ciJSsHT27BD3TIuGcuRT0KmQ==", + "optional": true, + "requires": { + "@img/sharp-libvips-linux-s390x": "1.2.0" + } + }, + "@img/sharp-linux-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.3.tgz", + "integrity": "sha512-8kYso8d806ypnSq3/Ly0QEw90V5ZoHh10yH0HnrzOCr6DKAPI6QVHvwleqMkVQ0m+fc7EH8ah0BB0QPuWY6zJQ==", + "optional": true, + "requires": { + "@img/sharp-libvips-linux-x64": "1.2.0" + } + }, + "@img/sharp-linuxmusl-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.3.tgz", + "integrity": "sha512-vAjbHDlr4izEiXM1OTggpCcPg9tn4YriK5vAjowJsHwdBIdx0fYRsURkxLG2RLm9gyBq66gwtWI8Gx0/ov+JKQ==", + "optional": true, + "requires": { + "@img/sharp-libvips-linuxmusl-arm64": "1.2.0" + } + }, + "@img/sharp-linuxmusl-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.3.tgz", + "integrity": "sha512-gCWUn9547K5bwvOn9l5XGAEjVTTRji4aPTqLzGXHvIr6bIDZKNTA34seMPgM0WmSf+RYBH411VavCejp3PkOeQ==", + "optional": true, + "requires": { + "@img/sharp-libvips-linuxmusl-x64": "1.2.0" + } + }, + "@img/sharp-wasm32": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.3.tgz", + "integrity": "sha512-+CyRcpagHMGteySaWos8IbnXcHgfDn7pO2fiC2slJxvNq9gDipYBN42/RagzctVRKgxATmfqOSulgZv5e1RdMg==", + "optional": true, + "requires": { + "@emnapi/runtime": "^1.4.4" + } + }, + "@img/sharp-win32-arm64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.3.tgz", + "integrity": "sha512-MjnHPnbqMXNC2UgeLJtX4XqoVHHlZNd+nPt1kRPmj63wURegwBhZlApELdtxM2OIZDRv/DFtLcNhVbd1z8GYXQ==", + "optional": true + }, + "@img/sharp-win32-ia32": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.3.tgz", + "integrity": "sha512-xuCdhH44WxuXgOM714hn4amodJMZl3OEvf0GVTm0BEyMeA2to+8HEdRPShH0SLYptJY1uBw+SCFP9WVQi1Q/cw==", + "optional": true + }, + "@img/sharp-win32-x64": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.3.tgz", + "integrity": "sha512-OWwz05d++TxzLEv4VnsTz5CmZ6mI6S05sfQGEMrNrQcOEERbX46332IvE7pO/EUiw7jUrrS40z/M7kPyjfl04g==", + "optional": true + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "@next/env": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.4.7.tgz", + "integrity": "sha512-PrBIpO8oljZGTOe9HH0miix1w5MUiGJ/q83Jge03mHEE0E3pyqzAy2+l5G6aJDbXoobmxPJTVhbCuwlLtjSHwg==" + }, + "@next/eslint-plugin-next": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-14.0.3.tgz", + "integrity": "sha512-j4K0n+DcmQYCVnSAM+UByTVfIHnYQy2ODozfQP+4RdwtRDfobrIvKq1K4Exb2koJ79HSSa7s6B2SA8T/1YR3RA==", + "dev": true, + "requires": { + "glob": "7.1.7" + } + }, + "@next/swc-darwin-arm64": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.4.7.tgz", + "integrity": "sha512-2Dkb+VUTp9kHHkSqtws4fDl2Oxms29HcZBwFIda1X7Ztudzy7M6XF9HDS2dq85TmdN47VpuhjE+i6wgnIboVzQ==", + "optional": true + }, + "@next/swc-darwin-x64": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.4.7.tgz", + "integrity": "sha512-qaMnEozKdWezlmh1OGDVFueFv2z9lWTcLvt7e39QA3YOvZHNpN2rLs/IQLwZaUiw2jSvxW07LxMCWtOqsWFNQg==", + "optional": true + }, + "@next/swc-linux-arm64-gnu": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.4.7.tgz", + "integrity": "sha512-ny7lODPE7a15Qms8LZiN9wjNWIeI+iAZOFDOnv2pcHStncUr7cr9lD5XF81mdhrBXLUP9yT9RzlmSWKIazWoDw==", + "optional": true + }, + "@next/swc-linux-arm64-musl": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.4.7.tgz", + "integrity": "sha512-4SaCjlFR/2hGJqZLLWycccy1t+wBrE/vyJWnYaZJhUVHccpGLG5q0C+Xkw4iRzUIkE+/dr90MJRUym3s1+vO8A==", + "optional": true + }, + "@next/swc-linux-x64-gnu": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.4.7.tgz", + "integrity": "sha512-2uNXjxvONyRidg00VwvlTYDwC9EgCGNzPAPYbttIATZRxmOZ3hllk/YYESzHZb65eyZfBR5g9xgCZjRAl9YYGg==", + "optional": true + }, + "@next/swc-linux-x64-musl": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.4.7.tgz", + "integrity": "sha512-ceNbPjsFgLscYNGKSu4I6LYaadq2B8tcK116nVuInpHHdAWLWSwVK6CHNvCi0wVS9+TTArIFKJGsEyVD1H+4Kg==", + "optional": true + }, + "@next/swc-win32-arm64-msvc": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.4.7.tgz", + "integrity": "sha512-pZyxmY1iHlZJ04LUL7Css8bNvsYAMYOY9JRwFA3HZgpaNKsJSowD09Vg2R9734GxAcLJc2KDQHSCR91uD6/AAw==", + "optional": true + }, + "@next/swc-win32-x64-msvc": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.4.7.tgz", + "integrity": "sha512-HjuwPJ7BeRzgl3KrjKqD2iDng0eQIpIReyhpF5r4yeAHFwWRuAhfW92rWv/r3qeQHEwHsLRzFDvMqRjyM5DI6A==", + "optional": true + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@rushstack/eslint-patch": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz", + "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==", + "dev": true + }, + "@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "requires": { + "tslib": "^2.8.0" + } + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "@types/node": { + "version": "20.9.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.2.tgz", + "integrity": "sha512-WHZXKFCEyIUJzAwh3NyyTHYSR35SevJ6mZ1nWwJafKtiQbqRTIKSRcw3Ma3acqgsent3RRDqeVwpHntMk+9irg==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } + }, + "@types/prop-types": { + "version": "15.7.10", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.10.tgz", + "integrity": "sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A==", + "dev": true + }, + "@types/react": { + "version": "18.2.37", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz", + "integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==", + "dev": true, + "requires": { + "@types/prop-types": "*", + "@types/scheduler": "*", + "csstype": "^3.0.2" + } + }, + "@types/react-dom": { + "version": "18.2.15", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.15.tgz", + "integrity": "sha512-HWMdW+7r7MR5+PZqJF6YFNSCtjz1T0dsvo/f1BV6HkV+6erD/nA7wd9NM00KVG83zf2nJ7uATPO9ttdIPvi3gg==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, + "@types/scheduler": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.6.tgz", + "integrity": "sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA==", + "dev": true + }, + "@typescript-eslint/parser": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.11.0.tgz", + "integrity": "sha512-+whEdjk+d5do5nxfxx73oanLL9ghKO3EwM9kBCkUtWMRwWuPaFv9ScuqlYfQ6pAD6ZiJhky7TZ2ZYhrMsfMxVQ==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "6.11.0", + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/typescript-estree": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.11.0.tgz", + "integrity": "sha512-0A8KoVvIURG4uhxAdjSaxy8RdRE//HztaZdG8KiHLP8WOXSk0vlF7Pvogv+vlJA5Rnjj/wDcFENvDaHb+gKd1A==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0" + } + }, + "@typescript-eslint/types": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.11.0.tgz", + "integrity": "sha512-ZbEzuD4DwEJxwPqhv3QULlRj8KYTAnNsXxmfuUXFCxZmO6CF2gM/y+ugBSAQhrqaJL3M+oe4owdWunaHM6beqA==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.11.0.tgz", + "integrity": "sha512-Aezzv1o2tWJwvZhedzvD5Yv7+Lpu1by/U1LZ5gLc4tCx8jUmuSCMioPFRjliN/6SJIvY6HpTtJIWubKuYYYesQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.11.0", + "@typescript-eslint/visitor-keys": "6.11.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.11.0.tgz", + "integrity": "sha512-+SUN/W7WjBr05uRxPggJPSzyB8zUpaYo2hByKasWbqr3PM8AXfZt8UHdNpBS1v9SA62qnSSMF3380SwDqqprgQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.11.0", + "eslint-visitor-keys": "^3.4.1" + } + }, + "@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, + "acorn": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true + }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "requires": { + "dequal": "^2.0.3" + } + }, + "array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + } + }, + "array-includes": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-string": "^1.0.7" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + } + }, + "array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + } + }, + "array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + } + }, + "array.prototype.tosorted": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.2.tgz", + "integrity": "sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + } + }, + "arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + } + }, + "ast-types-flow": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz", + "integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==", + "dev": true + }, + "asynciterator.prototype": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz", + "integrity": "sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.3" + } + }, + "autoprefixer": { + "version": "10.4.16", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", + "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==", + "dev": true, + "requires": { + "browserslist": "^4.21.10", + "caniuse-lite": "^1.0.30001538", + "fraction.js": "^4.3.6", + "normalize-range": "^0.1.2", + "picocolors": "^1.0.0", + "postcss-value-parser": "^4.2.0" + } + }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true + }, + "axe-core": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.7.0.tgz", + "integrity": "sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==", + "dev": true + }, + "axobject-query": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", + "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==", + "dev": true, + "requires": { + "dequal": "^2.0.3" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "requires": { + "fill-range": "^7.1.1" + } + }, + "browserslist": { + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", + "node-releases": "^2.0.13", + "update-browserslist-db": "^1.0.13" + } + }, + "call-bind": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "dev": true, + "requires": { + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001617", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001617.tgz", + "integrity": "sha512-mLyjzNI9I+Pix8zwcrpxEbGlfqOkF9kM3ptzmKNw5tizSyYwMe+nGLTqMK9cO+0E+Bh6TsBxNAaHWEM8xwSsmA==" + }, + "ccxt": { + "version": "4.1.56", + "resolved": "https://registry.npmjs.org/ccxt/-/ccxt-4.1.56.tgz", + "integrity": "sha512-Nf8Oi2tYa1oOntMeUE9J8nsaoIaBJiHbrj70KG4rUOlxirHupO8ggbv53FTyG4TyjqNcsmxsnO/ByhUA1bH2Tg==", + "requires": { + "ws": "^8.8.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, + "client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + }, + "color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "optional": true, + "requires": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "devOptional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "devOptional": true + }, + "color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "optional": true, + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true + }, + "csstype": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", + "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==", + "dev": true + }, + "damerau-levenshtein": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", + "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true + }, + "detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "optional": true + }, + "didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "electron-to-chromium": { + "version": "1.4.588", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.588.tgz", + "integrity": "sha512-soytjxwbgcCu7nh5Pf4S2/4wa6UIu+A3p03U2yVr53qGxi1/VTR3ENI+p50v+UxqqZAfl48j3z55ud7VHIOr9w==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "enhanced-resolve": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", + "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "es-abstract": { + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", + "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.5", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.2", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.13" + } + }, + "es-iterator-helpers": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz", + "integrity": "sha512-GhoY8uYqd6iwUl2kgjTm4CZAf6oo5mHK7BPqx3rKgx893YSsy0LGHV6gfqqQvZt/8xM8xeOnfXBCfqclMKkJ5g==", + "dev": true, + "requires": { + "asynciterator.prototype": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.1", + "es-set-tostringtag": "^2.0.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "iterator.prototype": "^1.1.2", + "safe-array-concat": "^1.0.1" + } + }, + "es-set-tostringtag": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", + "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.2", + "has-tostringtag": "^1.0.0", + "hasown": "^2.0.0" + } + }, + "es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", + "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.54.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + } + }, + "eslint-config-next": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-14.0.3.tgz", + "integrity": "sha512-IKPhpLdpSUyKofmsXUfrvBC49JMUTdeaD8ZIH4v9Vk0sC1X6URTuTJCLtA0Vwuj7V/CQh0oISuSTvNn5//Buew==", + "dev": true, + "requires": { + "@next/eslint-plugin-next": "14.0.3", + "@rushstack/eslint-patch": "^1.3.3", + "@typescript-eslint/parser": "^5.4.2 || ^6.0.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-import-resolver-typescript": "^3.5.2", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.5.0 || 5.0.0-canary-7118f5dd7-20230705" + } + }, + "eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-import-resolver-typescript": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz", + "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==", + "dev": true, + "requires": { + "debug": "^4.3.4", + "enhanced-resolve": "^5.12.0", + "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", + "get-tsconfig": "^4.5.0", + "is-core-module": "^2.11.0", + "is-glob": "^4.0.3" + } + }, + "eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "requires": { + "debug": "^3.2.7" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-plugin-import": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz", + "integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==", + "dev": true, + "requires": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.14.2" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "eslint-plugin-jsx-a11y": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.8.0.tgz", + "integrity": "sha512-Hdh937BS3KdwwbBaKd5+PLCOmYY6U4f2h9Z2ktwtNKvIdIEu137rjYbcb9ApSbVJfWxANNuiKTD/9tOKjK9qOA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.23.2", + "aria-query": "^5.3.0", + "array-includes": "^3.1.7", + "array.prototype.flatmap": "^1.3.2", + "ast-types-flow": "^0.0.8", + "axe-core": "=4.7.0", + "axobject-query": "^3.2.1", + "damerau-levenshtein": "^1.0.8", + "emoji-regex": "^9.2.2", + "es-iterator-helpers": "^1.0.15", + "hasown": "^2.0.0", + "jsx-ast-utils": "^3.3.5", + "language-tags": "^1.0.9", + "minimatch": "^3.1.2", + "object.entries": "^1.1.7", + "object.fromentries": "^2.0.7" + } + }, + "eslint-plugin-react": { + "version": "7.33.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", + "integrity": "sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw==", + "dev": true, + "requires": { + "array-includes": "^3.1.6", + "array.prototype.flatmap": "^1.3.1", + "array.prototype.tosorted": "^1.1.1", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.0.12", + "estraverse": "^5.3.0", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.6", + "object.fromentries": "^2.0.6", + "object.hasown": "^1.1.2", + "object.values": "^1.1.6", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.4", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.8" + }, + "dependencies": { + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "dev": true, + "requires": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "eslint-plugin-react-hooks": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", + "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", + "dev": true, + "requires": {} + }, + "eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true + }, + "espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "requires": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + } + }, + "esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "requires": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.9", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", + "dev": true + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "fraction.js": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", + "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true + }, + "function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true + }, + "get-intrinsic": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "dev": true, + "requires": { + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + } + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "get-tsconfig": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", + "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "dev": true, + "requires": { + "resolve-pkg-maps": "^1.0.0" + } + }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3" + } + }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "has-property-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.2" + } + }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "ignore": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "internal-slot": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", + "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.2", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + } + }, + "is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + } + }, + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "optional": true + }, + "is-async-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", + "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true + }, + "is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-finalizationregistry": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz", + "integrity": "sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "dev": true + }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "dev": true, + "requires": { + "which-typed-array": "^1.1.11" + } + }, + "is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "iterator.prototype": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", + "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", + "dev": true, + "requires": { + "define-properties": "^1.2.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "reflect.getprototypeof": "^1.0.4", + "set-function-name": "^2.0.1" + } + }, + "jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "requires": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + } + }, + "keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, + "language-subtag-registry": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", + "integrity": "sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==", + "dev": true + }, + "language-tags": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.9.tgz", + "integrity": "sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==", + "dev": true, + "requires": { + "language-subtag-registry": "^0.3.20" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "requires": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==" + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "next": { + "version": "15.4.7", + "resolved": "https://registry.npmjs.org/next/-/next-15.4.7.tgz", + "integrity": "sha512-OcqRugwF7n7mC8OSYjvsZhhG1AYSvulor1EIUsIkbbEbf1qoE5EbH36Swj8WhF4cHqmDgkiam3z1c1W0J1Wifg==", + "requires": { + "@next/env": "15.4.7", + "@next/swc-darwin-arm64": "15.4.7", + "@next/swc-darwin-x64": "15.4.7", + "@next/swc-linux-arm64-gnu": "15.4.7", + "@next/swc-linux-arm64-musl": "15.4.7", + "@next/swc-linux-x64-gnu": "15.4.7", + "@next/swc-linux-x64-musl": "15.4.7", + "@next/swc-win32-arm64-msvc": "15.4.7", + "@next/swc-win32-x64-msvc": "15.4.7", + "@swc/helpers": "0.5.15", + "caniuse-lite": "^1.0.30001579", + "postcss": "8.4.31", + "sharp": "^0.34.3", + "styled-jsx": "5.1.6" + } + }, + "node-releases": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true + }, + "object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true + }, + "object-inspect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, + "object.entries": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz", + "integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "object.fromentries": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, + "object.hasown": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", + "integrity": "sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA==", + "dev": true, + "requires": { + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "object.values": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "requires": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true + }, + "pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true + }, + "postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "requires": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "dev": true, + "requires": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + } + }, + "postcss-js": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", + "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", + "dev": true, + "requires": { + "camelcase-css": "^2.0.1" + } + }, + "postcss-load-config": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.1.tgz", + "integrity": "sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==", + "dev": true, + "requires": { + "lilconfig": "^2.0.5", + "yaml": "^2.1.1" + } + }, + "postcss-nested": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz", + "integrity": "sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==", + "dev": true, + "requires": { + "postcss-selector-parser": "^6.0.11" + } + }, + "postcss-selector-parser": { + "version": "6.0.13", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz", + "integrity": "sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + } + }, + "postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "requires": { + "loose-envify": "^1.1.0" + } + }, + "react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "requires": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + } + }, + "react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, + "read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dev": true, + "requires": { + "pify": "^2.3.0" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "reflect.getprototypeof": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.4.tgz", + "integrity": "sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "globalthis": "^1.0.3", + "which-builtin-type": "^1.1.3" + } + }, + "regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==", + "dev": true + }, + "regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + } + }, + "resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "requires": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + } + }, + "safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + } + }, + "scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "requires": { + "loose-envify": "^1.1.0" + } + }, + "semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "devOptional": true + }, + "set-function-length": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", + "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dev": true, + "requires": { + "define-data-property": "^1.1.1", + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dev": true, + "requires": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + } + }, + "sharp": { + "version": "0.34.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.3.tgz", + "integrity": "sha512-eX2IQ6nFohW4DbvHIOLRB3MHFpYqaqvXd3Tp5e/T/dSH83fxaNJQRvDMhASmkNTsNTVF2/OOopzRCt7xokgPfg==", + "optional": true, + "requires": { + "@img/sharp-darwin-arm64": "0.34.3", + "@img/sharp-darwin-x64": "0.34.3", + "@img/sharp-libvips-darwin-arm64": "1.2.0", + "@img/sharp-libvips-darwin-x64": "1.2.0", + "@img/sharp-libvips-linux-arm": "1.2.0", + "@img/sharp-libvips-linux-arm64": "1.2.0", + "@img/sharp-libvips-linux-ppc64": "1.2.0", + "@img/sharp-libvips-linux-s390x": "1.2.0", + "@img/sharp-libvips-linux-x64": "1.2.0", + "@img/sharp-libvips-linuxmusl-arm64": "1.2.0", + "@img/sharp-libvips-linuxmusl-x64": "1.2.0", + "@img/sharp-linux-arm": "0.34.3", + "@img/sharp-linux-arm64": "0.34.3", + "@img/sharp-linux-ppc64": "0.34.3", + "@img/sharp-linux-s390x": "0.34.3", + "@img/sharp-linux-x64": "0.34.3", + "@img/sharp-linuxmusl-arm64": "0.34.3", + "@img/sharp-linuxmusl-x64": "0.34.3", + "@img/sharp-wasm32": "0.34.3", + "@img/sharp-win32-arm64": "0.34.3", + "@img/sharp-win32-ia32": "0.34.3", + "@img/sharp-win32-x64": "0.34.3", + "color": "^4.2.3", + "detect-libc": "^2.0.4", + "semver": "^7.7.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "optional": true, + "requires": { + "is-arrayish": "^0.3.1" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==" + }, + "string.prototype.matchall": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz", + "integrity": "sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "regexp.prototype.flags": "^1.5.0", + "set-function-name": "^2.0.0", + "side-channel": "^1.0.4" + } + }, + "string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "styled-jsx": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "requires": { + "client-only": "0.0.1" + } + }, + "sucrase": { + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.34.0.tgz", + "integrity": "sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "7.1.6", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "dependencies": { + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "tailwindcss": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", + "dev": true, + "requires": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.5.3", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.3.0", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.19.1", + "lilconfig": "^2.1.0", + "micromatch": "^4.0.5", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.0.0", + "postcss": "^8.4.23", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.1", + "postcss-nested": "^6.0.1", + "postcss-selector-parser": "^6.0.11", + "resolve": "^1.22.2", + "sucrase": "^3.32.0" + } + }, + "tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "requires": { + "any-promise": "^1.0.0" + } + }, + "thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "requires": { + "thenify": ">= 3.1.0 < 4" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "requires": {} + }, + "ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true + }, + "tsconfig-paths": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", + "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + } + }, + "typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true + }, + "unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + } + }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "dev": true, + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "which-builtin-type": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.1.3.tgz", + "integrity": "sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==", + "dev": true, + "requires": { + "function.prototype.name": "^1.1.5", + "has-tostringtag": "^1.0.0", + "is-async-function": "^2.0.0", + "is-date-object": "^1.0.5", + "is-finalizationregistry": "^1.0.2", + "is-generator-function": "^1.0.10", + "is-regex": "^1.1.4", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + } + }, + "which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "requires": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + } + }, + "which-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", + "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.4", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "requires": {} + }, + "yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/package.json b/docs/ccxt/examples/ts/nextjs-page-router/package.json new file mode 100644 index 0000000..11ba6f2 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/package.json @@ -0,0 +1,28 @@ +{ + "name": "nextjs-page-router", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint" + }, + "dependencies": { + "ccxt": "^4.1.56", + "next": "15.4.7", + "react": "^18", + "react-dom": "^18" + }, + "devDependencies": { + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "autoprefixer": "^10.0.1", + "eslint": "^8", + "eslint-config-next": "14.0.3", + "postcss": "^8", + "tailwindcss": "^3.3.0", + "typescript": "^5" + } +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/postcss.config.js b/docs/ccxt/examples/ts/nextjs-page-router/postcss.config.js new file mode 100644 index 0000000..33ad091 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/public/favicon.ico b/docs/ccxt/examples/ts/nextjs-page-router/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..09b3f98a60e0f89f8edd4981560dc1eba3aaf315 GIT binary patch literal 25930 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdfVW@e^8e*E}v zA1y5{bRi+3Z`uD3{F7LgFJDdvm;nJilkzDku>BwXH(8ItVCXk*-lSJnR?-2UN%hJ){&rlvg`CDTj z)Bzo!3v7Ou#83zEDEFcKt(f1E0~=rqeEbTnMvWR#{+9pg%7G8y>u1OVRUSoox-ovF z2Ydma(;=YuBY(eI|04{hXzZD6_f(v~H;C~y5=DhAC{MMS>2fm~1H_t2$56pc$NH8( z5bH|<)71dV-_oCHIrzrT`2s-5w_+2CM0$95I6X8p^r!gHp+j_gd;9O<1~CEQQGS8) zS9Qh3#p&JM-G8rHekNmKVewU;pJRcTAog68KYo^dRo}(M>36U4Us zfgYWSiHZL3;lpWT=zNAW>Dh#mB!_@Lg%$ms8N-;aPqMn+C2HqZgz&9~Eu z4|Kp<`$q)Uw1R?y(~S>ePdonHxpV1#eSP1B;Ogo+-Pk}6#0GsZZ5!||ev2MGdh}_m z{DeR7?0-1^zVs&`AV6Vt;r3`I`OI_wgs*w=eO%_#7Kepl{B@xiyCANc(l zzIyd4y|c6PXWq9-|KM8(zIk8LPk(>a)zyFWjhT!$HJ$qX1vo@d25W<fvZQ2zUz5WRc(UnFMKHwe1| zWmlB1qdbiA(C0jmnV<}GfbKtmcu^2*P^O?MBLZKt|As~ge8&AAO~2K@zbXelK|4T<{|y4`raF{=72kC2Kn(L4YyenWgrPiv z@^mr$t{#X5VuIMeL!7Ab6_kG$&#&5p*Z{+?5U|TZ`B!7llpVmp@skYz&n^8QfPJzL z0G6K_OJM9x+Wu2gfN45phANGt{7=C>i34CV{Xqlx(fWpeAoj^N0Biu`w+MVcCUyU* zDZuzO0>4Z6fbu^T_arWW5n!E45vX8N=bxTVeFoep_G#VmNlQzAI_KTIc{6>c+04vr zx@W}zE5JNSU>!THJ{J=cqjz+4{L4A{Ob9$ZJ*S1?Ggg3klFp!+Y1@K+pK1DqI|_gq z5ZDXVpge8-cs!o|;K73#YXZ3AShj50wBvuq3NTOZ`M&qtjj#GOFfgExjg8Gn8>Vq5 z`85n+9|!iLCZF5$HJ$Iu($dm?8~-ofu}tEc+-pyke=3!im#6pk_Wo8IA|fJwD&~~F zc16osQ)EBo58U7XDuMexaPRjU@h8tXe%S{fA0NH3vGJFhuyyO!Uyl2^&EOpX{9As0 zWj+P>{@}jxH)8|r;2HdupP!vie{sJ28b&bo!8`D^x}TE$%zXNb^X1p@0PJ86`dZyj z%ce7*{^oo+6%&~I!8hQy-vQ7E)0t0ybH4l%KltWOo~8cO`T=157JqL(oq_rC%ea&4 z2NcTJe-HgFjNg-gZ$6!Y`SMHrlj}Etf7?r!zQTPPSv}{so2e>Fjs1{gzk~LGeesX%r(Lh6rbhSo_n)@@G-FTQy93;l#E)hgP@d_SGvyCp0~o(Y;Ee8{ zdVUDbHm5`2taPUOY^MAGOw*>=s7=Gst=D+p+2yON!0%Hk` zz5mAhyT4lS*T3LS^WSxUy86q&GnoHxzQ6vm8)VS}_zuqG?+3td68_x;etQAdu@sc6 zQJ&5|4(I?~3d-QOAODHpZ=hlSg(lBZ!JZWCtHHSj`0Wh93-Uk)_S%zsJ~aD>{`A0~ z9{AG(e|q3g5B%wYKRxiL2Y$8(4w7!c|44TD2OkmSx<8fgND0!M2 zErHU@#onR?;^uY6TUM_8^oJu%5a!@k^#8v3%SZ%GAqY#sPD(Hk1^&NzP^m9T^n@UB z*jQiB(g)LJ%bdwydBQE$mT8dy_v$rz@$E$}(#&P6A`YvnD}?UKyz7*PD~h~md?u9X zxPHtEwU{)yaz42i$JJgIop>rFY{VR1xXYf@dNq_55+=&y!&I8^{#M12J4bwX4&AiPJ%RfDhpEz_jdg>CfF{*fnI^>>dtk;&?@{WJ&19u{H}TR4gsZWb`M5)~*v!ZmD{do&B>Fvy`E$r@ zWGll4cvqR7{;Fo02(rgLpS_wbA5*ce!lmN)GB#%tj{1m2TliHIuOCy7rUSuUk_1!d z)`sqrW7)apR@T)M@{!e23!tVCoXcVReVg?0V2-3`I1UQQAm7ntY zyGI};XcfE6JIUUR(vAcHTzgsqdxe!u>VlZy$O{Q0ko^Nx%!4E9wN+8^2wwvS z$MEt&bq65=H>|0u!mwxc2VGps@NSQur;XZUY7-_!BmyWa_{vCii3I79Hz3&7XtJH$ zz!QwlhwILeO*3_Ea4ja18)0}b8>dZcnCBo$o6k4?WWJyVgF0E86uk+jWcVrxPU#tG zLA-UjD;8m+qUJR6)#H(1B-UQ6?#OO;ZNdX0JZtrx1Plj@@rV25Y<72F_42-oZJ1@H z$q`0pPGj@q(l>p0n$Nx{a=w~uI7?KOn)lK|IwP&7_f6cDhNcut(P8x(mfMW)*b#<= z0}H$JnPStNPVp)S>_Bc~l!l|%6_b2h_9$hF_FQtZ6*P*gfqdcZCUrCeM+}@uAD1(` zXzsmo%(50IzBJ)k4fY;8)v4vZt$aa*{fZqlouW}4lA{ou_;|>rOOsXz>G2WCJKfg!2=5(bU zHet`@Q@Gyum>h#+`fMqMP#g1@W+pE!58F{>2v^|dHQ?%4de%weo;e{qdKMvWO9Fa3 zSxG#+a8}L`_J&uL*AbuaTkK;CYqq>z{6QclO=4D;G4TdA^cD|)0g>Z5E@!D~ZJP8F zTuvPC`OP60h3e-{M7zSe<1!0WaKJX55#Ev!C3z5o+9Q*fo{2HEyt{Y{VYQIY<>80ls#gfECkp#85Fu%$ts)4cTvtSq$z_K7$a=QK z!<{`FOKq?49Lr*(YQ*-JAk3S%4#lK1+$X8ya<q6oPNNtqPTo&vuTWOth8<~K z@Yn=Y0#6*5o^33O1RP|oUhrUvf}*MeGrW_K#0%vy^B$GHMJqX@A5Ok=D0ao6P|T9$;aY#~nGjw4%8#W#!M$=5UhLVXw!y=OP zP`-#!%WI;wPhgSPBEAnw_^hl2vO)YiWQD5_n@8g9!moSn8iK0h8kO#xzrUX8z9LSo z6uRwn9?J=hHY?cI;b^i>ey%nr*5*4Bn%Vk|Mg}pLniQN9GoZ6a-yS3v8EQ038h;2Q z^9ff6XDLIDs@Pq^$g0wwX6kyhQ$xw_Z21wjTIB9#_orh1du%eGzN0Tv&c-|!RwdwE z9T2!(%ycwKr2C4GiI@)ZblHa?Xh<(66r;+;4kt;8++oqzwj#R1)PZrYk&7LiJm_TP zh&!$4=f__?%PN0$0d@>ln=h00NM0QE7betxz@DA@F8TWG0R2}mE$>YnR6v`H_BcTt zw^%Q$PCL++@2Lc@fpq9uO%=hYUL$=M^QT_z6@_o>Z|yOEAb+Zd&8$QKI@<0geUzYH z_p*bBlRX(8mSF^q_Yl!_!5agzvg&FYZ3XF zIi_pIUsZ-&^fdITNsno&O&xagf1I!&gEBUDJz)G}abBLbFy>YSm2>s6i_7g(%B@UX ziSfHse0pfbvli~w5QfAboz}4)a9OK!hq=CkIYl;m_GV3yheVgB$p+2!dm3z0#>PH0 z9+a3r_`bn@VC!1{35yLix=hRk%CJKcMr`5k?ag=mM-Qt(i>|snl@x|H4e)foU7e=FN8h)^x84yY>IcW&Q(w&prGr! z%`V&CpsVEm$B+AR8N1S)2eBcLm9b(tx!qT6t(5{xqBiV4s>Ld(tOnU~eK0g#qQ)Q~v{X0S-uTK; zVytzAHk`?*U8BPxMK#@L@>a2#5L)}>?0Xr`R)MVa`aoS*bUx*tFvd~SL(C#;Gg998 zt}0V>v8ty_c*SXpo=6NnK1{|AK=Ya?BH2ksRVLz~wzdtIyeZfv&};z#PcLWVIdk`T zA?b#jZh_5n#hh(bO1X^Vp=!}&U2dC-G(L!|)GU1E98>N*9IX`l&_sbjG3ItwaKWqnZ} zzi}SaFuLa`a-vf5ar@R%kP&^iw^OgdV1EV;`rs%j^I%zU8_Rn~+Q6-FY49)C9j`TPR(i?zV6C^?d{Ha$?NKZm7D8 zxi!C_?R(#qn#aJKkMY_r4o30yEss6&c6Yg2zDX~b*oSWr&`>ZfTfq%ChX=$BKNV>^ z4Zny}KOU@69}tj%^uu_5#~V z@-DU&CpF})vXdlcd$4{~jeY0+Zhk>$rSxNV>Vkyyb}A8{!`|S%0Q}6V=uv-s|*)}1jQKwUTi)4cF z5IZDNtheFP_!w?%EPdMz%F#UiS-K^f&}(th>MANbh5lBZy64^8^c>0Y2+I?2xdrt! z#_Dw{O;w%Rt&1OJZPJ8R&Z!Uon6wz}Lw?-Eh8wPN0b5*4G3-^L+~le=FQS6nE|SUT zt}aH~K;NpVpJMH}h0s+QurYj2w!=Eyrre}vNHJfvZ(DK#<~Cilh-{34c|9}^z^u-@ zpW)ZHtzqRu_$@|GORba??Io1?psTHft3GI*V!Pmqs+f()$5k4_NX)Lf({rS^sF1QH z*hy>lyXhs=9beygdxe&Elb^DkX9@K281sea@+uDRTnjQSZT8fAZ%`D9FKX|WxO>3{ zrZAJ9a*Jx8ySk|h9eMnTzPM7w_7Zc)s!>&$DyZLh-g+6!qnO(I0Djhk;h&yh^}yYw zNjOA;b6!5DbbJ<%!b9ZkrSY;Yi)f6wj4%&>pvu09!>O2d2A4|1vHhdxpzI|6OXGg5 zO}t13af4#}QuDE6xu-0htDp*|W#(IuaOdsoy9DFYay{G105JEV=X2)5T!-(qci-G` z!@fG&`SD}n_#=GXZA%MyeW8Bl-g}tnSfSFi+9yZKPpCVWDYhG#`&H#Ga4-@sBS{~o$WyQO*(@eszBOKUY^;JGoy&y62KGsapu3v*lp@kg zbZBRxj!MifSNVE)A_a_Df~3ofjvY=+@KdtQdy&KG7hAr=&v|s9qwTVN!Rx)Paci4Q z^i_{J(pKKa#wN?0@w5?(5kyCMD(EA=hXZb%7#mi;cwBMxeo4g#P`v~CsnB>+8z7^8 zf@bV*t)h4Bi1dvZ9Z2!n;w8%@jnZq6MA~`m$6OIubk|^sQT0wc*vX27kfI@UfGb+xeANELSBA9om2}SzJ?F9E59KE{x0QuFJy0q%oEWCu zdL+V>9=g4u<$1yW#w8UbrFEIqtKNbw?y06@-Sfp55|8;@(^_ffR^Y(jkiFCX{GB^? zZiNnB2Ut?i2g-d+yLBSi#$$BEvsmxh-o7_)Yl9{%4{)3jC%Lc$8>norR%t6=_};7L z#`ELbxQcUDQO=wxTz|vWDvHKpAq970{Op=<=P43kzvO!Nd+e)@DIK^{4ZluxsIv3D zvTwzQ`N6>&P*PDsh-2G@!Oh2PWhK*`5S(Xuq850^tW%Vo9Q3IL^VEfm@!1 z6Xum&;Z7W$b0{7&h;0#wh<)Cr0qryr*<3Dlw)Thwb^EJmdz%>j$4Fh!QMC=#Jlh46 z>jbxEX&sJW_i8CUsDd~tD7_YMbKh#_hxvmp!N9pR!d&(%bwOuxl+>V;tXyFxotHSW8~WcqUs{}88?2_{ zQb9QQ@RE$CI#rW&V5MHJ%<*$@)uXe`rCowS`CQqq)&pEETICCKMj?BQT!zHQ^9481 z{toaMt-NcKkN# zeZ{gg2a;QXLTQ-lg}NZCn1=(pjQ)GrAzN%G<1(xoDZ3$S>vL?#n#>$wignb(3>mTz zt)Cv$(Vz)M60gcvTw$?vKoa~s_%=9l!005Hqx5pN)5f_Zbbc;x!#14mLpF3dZ-LRr z>3%!^O-R28bh;&lV9bcidf?3H!ImSPP1z}9R$}k5bT2z~O`>1JZ3;bAm?p`$qj&vD zQQmTN0owswD(VvK7oy>QtbYZg=TWE&Kghcn## zD(X>bm-8}%VW(g>y&aMp;-wD{X!^76PYBxAN*s%N+pp#^ye`2no^YRLA;wjAYfr{? zkJjbEo+p;S3?N%3Y?;{S3q5*#2^zvj`3P0G>T(JT%yPX!TODUm@74?TxO&3WkwQNs zP?nyjv=t>^f zO%R1b0`lAA6X{X4Pr7l0Y=_n3I&1n_bx(3)dq3LISP(cUS0HaZUdc9%({J5t7IXkC zVGKYDbg^N@!^;Pt*ZP!Wtl2GNN9qDzxu6RKfplGIF-h(r3$s#*t%9;quA9T~ZQ>JTvGV+-l zX~Dc~wmc?cq0Z3(I% zW5f0PtxW`F-Nw@~J6RV;JnM_QlM?Fz?}I&_QTYgceGaXIeQSINkKFR^c%z}AK}0*h z%wyva#r-sC;3L!Md(WSAjvcxcw4GsKU|`iIsWv_1UMlr!iFm@m*4IO4 z#UCo@c2sBJsVe@6GtxY=R1#N&@UywsW?VyV!wK1 zeJlZoG8h`|X_XER_4{Dbus;!tzbVaf0y z{WKLv5?e|!R6j_LP13r24o~eF$K0{@YUDhG#xPW+9_)8_*j8a<^&ECctTP|Z){|OG zM7Pa6n;qoMYd5S6s~m)chPV)GR_`}|nW*$Id+bu8RtAz&Ys4WbJI)@RPp#HsGn;eC zJYdW1cyZ{xD2uxrvJc~g);!xxId@+7x{V1ZGISevL69Vi?$`ZsuKPZ!*WMU}e3X4L zVyx{&5^A9@5-XXzAVPqGz6_xK*TH-uuNdqpBQ@zkt^&?O|J z_b)3U+PgYcs`Ey3)>_!1rf!Y{UWGgKE`=Zh`eiYjO=O4i$o>zv#kO!&h>ipge~22| zfA~Hk6dFlxn7zeqXx4^gKgXnyx*jWvl22w zVnVUtq~tJW_jn1s@ScHZfBouQOhU;cod@agphf|u0kyNdPj%ZrF`Fy5S6y&dK32u9 zYz@*3ZGu3!8>&6LbvLtaT93aE>)@xZ%+=u_8i&>kg1Smo(vg}2q@~{3jGVKwF%GM8 zc2b+6wH(Wf5Fw^wXzjt{S5!L2l=ASJ8IRGLW2NvAV2&dp7i>AC@c9a4@Jl zV0;(KWXr%NNr#35__^FTOotZrfqt3D1ifAtoBA&!79w>m_ z`*n94KZ7z=V59^I_|$cjQ1X@G`*`U&&t)Wy3t|cmn~%?;ZjA&U536Ld9@K?+ECOUt zy%2()dmLbFi7sYEQhW(+;wYHoMO4AkM=NN$(dCvRIAn9ni{iu71>p7dC`S*{0wi}C zKZG(VrjQsb@sut)V9&GFg?rGYNLBVt(Ypond6z#r5pg+U8O@czd%2@**y2?3@-;Y5(nBj)0y`_y(M|k8=AuHmCg< zrJfP-%;MPI<4#cNgEh3hBtr;28odw2CA}Y;yHX);D-NmK&PX)w|ez9YkTVp5}%0C)7dGRK0g*vXdaY37< z$Oguf^de7bpyM zw>WJ6{hKmZ5%SH_W*bB*%Y4Hwu5;`?tUB9G{O-rDE2ge%S!)rx8FJNxl+TP;JeR(D zoUGk4zMFI#BOF8tL3qoF6;hUc1+%?dAFf{Y*@|CB=<-C;>$!D^H6Je&tuv-+851^b&C&dZT#@;7k_GxC82>Br&pYax$UwU~XO_(NB z=;t6sSqrOcRR`rYF5>K#ROE)Qs!-qa+AuD{bmE=Zp0y(0)SX5v823Rus!>dEqLDjC zrV#B|^&_i6g;;OEl5gUb! zBhah0qGfIeE{rydtWEM~rL8LVvi8RHN+%^}CXmmQTOs}lc2YC}R)d(MZDr*TbF(po zKvIZ0MkF+bJdasNCIhzYucU6H%F-Z$@gWplZ0L~jO~Lf%*LwsZJkKj@^oEl;3%?@X zwp7g4>pj-8$C*4poljFFIdY+1aaJLwYx0`4*&%j4T_l6u9};0z+S<+F$4v8Cns|4} zV|T+ItORBuR8Ez8hgtk~D@5e9cO;^gA#2T$&Zh(IB9I9AFyzZQ2kVy6$RPHd*t2gT zQk=54KJc(-5|nt4lzI*u$dr#aJClvs3H#l(K(9(&AZY>h9y+NZm&3I)4E+8QGB#MH KpT5K)=>Gu0&e~J} literal 0 HcmV?d00001 diff --git a/docs/ccxt/examples/ts/nextjs-page-router/src/pages/_app.tsx b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/_app.tsx new file mode 100644 index 0000000..021681f --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/_app.tsx @@ -0,0 +1,6 @@ +import '@/styles/globals.css' +import type { AppProps } from 'next/app' + +export default function App({ Component, pageProps }: AppProps) { + return +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/src/pages/_document.tsx b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/_document.tsx new file mode 100644 index 0000000..54e8bf3 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/_document.tsx @@ -0,0 +1,13 @@ +import { Html, Head, Main, NextScript } from 'next/document' + +export default function Document() { + return ( + + + +
+ + + + ) +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/src/pages/balance.tsx b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/balance.tsx new file mode 100644 index 0000000..db70495 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/balance.tsx @@ -0,0 +1,46 @@ +import ccxt, { Balances } from 'ccxt' + +// This is for showcase purposes in prod move this to environment variable like process.env.BINANCEUSDM_API_KEY +const apiKey = "" +const secret = "" + +export async function getServerSideProps () { + const exchange = new ccxt.kraken({ apiKey, secret }) + const balances = await exchange.fetchBalance() + // remove undefined values to prevent serializing error + Object.keys(balances).forEach(key => balances[key] === undefined && delete balances[key]) + return { + props: { + balances, + }, + } +} + +export default function Balance({balances}: {balances: Balances}) { + return ( +
+ + + + + + + + + + + {Object.keys(balances).map((currency: string) => ( + balances[currency].free !== undefined && ( + + + + + + + ) + ))} + +
CurrencyFreeUsedTotal
{currency}{balances[currency].free}{balances[currency].used}{balances[currency].total}
+
+ ) +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/src/pages/index.tsx b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/index.tsx new file mode 100644 index 0000000..c2bf6d9 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/index.tsx @@ -0,0 +1,8 @@ +export default function Home() { + return ( +
+ Balance - Using Server Side calls + Tickers - Using Client Side websockets +
+ ) +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/src/pages/tickers.tsx b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/tickers.tsx new file mode 100644 index 0000000..ba06c69 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/src/pages/tickers.tsx @@ -0,0 +1,61 @@ +import ccxt, { Exchange, Ticker } from 'ccxt' +import { useEffect, useState } from 'react'; + +const exchangeIds = ['binance', 'bitget', 'bybit', 'cryptocom'] + +export default function Home() { + const [exchanges, setExchanges] = useState>({}); + const [tickers, setTickers] = useState>({}); + const [error, setError] = useState(); + + useEffect(() => { + console.log('starting exchanges...'); + const newExchanges: Record = exchangeIds.reduce((acc: any, exchangeId) => { + acc[exchangeId] = new (ccxt.pro as any)[exchangeId]; + return acc; + }, {}); + setExchanges(newExchanges); + }, []); + + useEffect(() => { + const fetchTickers = async () => { + for (const exchangeId in exchanges) { + try { + const newTicker = await exchanges[exchangeId].watchTicker('BTC/USDT'); + setTickers(tickers => ({ ...tickers, [exchangeId]: newTicker })); + } catch (e) { + setError(exchangeId + ': ' + JSON.stringify(e) + '\n') + } + }; + }; + fetchTickers(); + }, [tickers, exchanges, error]); + + return ( +
+
+ {exchangeIds.map((exchangeId) => ( +
+

{exchangeId}

+
    +
  • {`last: ${tickers[exchangeId]?.last}`}
  • +
  • {`high: ${tickers[exchangeId]?.high}`}
  • +
  • {`low: ${tickers[exchangeId]?.low}`}
  • +
  • {`bid: ${tickers[exchangeId]?.bid}`}
  • +
  • {`ask: ${tickers[exchangeId]?.ask}`}
  • +
  • {`ask volume: ${tickers[exchangeId]?.askVolume}`}
  • +
  • {`bid volume: ${tickers[exchangeId]?.bidVolume}`}
  • +
  • {`close: ${tickers[exchangeId]?.close}`}
  • +
+
+ ))} +
+
+

Last error:

+

{error ? error : "None"}

+
+
+ ) +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/src/styles/globals.css b/docs/ccxt/examples/ts/nextjs-page-router/src/styles/globals.css new file mode 100644 index 0000000..fd81e88 --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/src/styles/globals.css @@ -0,0 +1,27 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +:root { + --foreground-rgb: 0, 0, 0; + --background-start-rgb: 214, 219, 220; + --background-end-rgb: 255, 255, 255; +} + +@media (prefers-color-scheme: dark) { + :root { + --foreground-rgb: 255, 255, 255; + --background-start-rgb: 0, 0, 0; + --background-end-rgb: 0, 0, 0; + } +} + +body { + color: rgb(var(--foreground-rgb)); + background: linear-gradient( + to bottom, + transparent, + rgb(var(--background-end-rgb)) + ) + rgb(var(--background-start-rgb)); +} diff --git a/docs/ccxt/examples/ts/nextjs-page-router/tailwind.config.ts b/docs/ccxt/examples/ts/nextjs-page-router/tailwind.config.ts new file mode 100644 index 0000000..1af3b8f --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/tailwind.config.ts @@ -0,0 +1,20 @@ +import type { Config } from 'tailwindcss' + +const config: Config = { + content: [ + './src/pages/**/*.{js,ts,jsx,tsx,mdx}', + './src/components/**/*.{js,ts,jsx,tsx,mdx}', + './src/app/**/*.{js,ts,jsx,tsx,mdx}', + ], + theme: { + extend: { + backgroundImage: { + 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', + 'gradient-conic': + 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))', + }, + }, + }, + plugins: [], +} +export default config diff --git a/docs/ccxt/examples/ts/nextjs-page-router/tsconfig.json b/docs/ccxt/examples/ts/nextjs-page-router/tsconfig.json new file mode 100644 index 0000000..3ca6a9a --- /dev/null +++ b/docs/ccxt/examples/ts/nextjs-page-router/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./src/*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} diff --git a/docs/ccxt/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.ts b/docs/ccxt/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.ts new file mode 100644 index 0000000..94d5952 --- /dev/null +++ b/docs/ccxt/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.ts @@ -0,0 +1,62 @@ +// @ts-nocheck +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// ------------------------------------------------------------------------------ + +async function example () { + const exchange = new ccxt.phemex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + + const symbol = 'XRP/USDT:USDT'; + const side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'limit'; // set it to 'market' or 'limit' + const amount = 1; // how many contracts + const price = 0.5; // set a price at your desired level + + // take profit and stop loss prices and types + const take_profit_trigger_price = 0.6; + const stop_loss_trigger_price = 0.4; + const take_profit_limit_price = 0.7; + const stop_loss_limit_price = 0.3; + + await exchange.loadMarkets (); + + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'posSide': 'Long', // "Long" / "Short" for hedge mode + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + 'type': 'limit', + 'price': stop_loss_limit_price, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + 'type': 'limit', + 'price': take_profit_limit_price, + }, + }; + + console.log ('-----------------------------------------------------------------------'); + + // exchange.verbose = True // uncomment for debugging purposes if necessary + + try { + const created_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + console.log ('Created an order', created_order); + + // Fetch all your open orders for this symbol + const all_open_orders = await exchange.fetchOpenOrders (symbol); + console.log ('Fetched all your orders for this symbol', all_open_orders); + + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } catch (e) { + console.log (e.toString ()); + } +} + +await example (); + diff --git a/docs/ccxt/examples/ts/proxy-usage.ts b/docs/ccxt/examples/ts/proxy-usage.ts new file mode 100644 index 0000000..9d49368 --- /dev/null +++ b/docs/ccxt/examples/ts/proxy-usage.ts @@ -0,0 +1,49 @@ + +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// 1) ABOUT CCXT PROXIES, READ MORE AT: https://docs.ccxt.com/#/README?id=proxy +// 2) in python, uncomment the below: +// if sys.platform == 'win32': +// asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + +async function example_proxyUrl () { + const myEx = new ccxt.kucoin (); + myEx.proxyUrl = 'http://188.245.226.105:8090/proxy_url.php?caller=https://ccxt.com&url='; + console.log (await myEx.fetch ('https://api.ipify.org/')); +} + +async function example_httpProxy () { + const myEx = new ccxt.kucoin (); + myEx.httpProxy = 'http://188.245.226.105:8911'; // "httpProxy" or "httpsProxy" (depending on your proxy protocol) + console.log (await myEx.fetch ('https://api.ipify.org/')); +} + +async function example_socksProxy () { + const myEx = new ccxt.kucoin (); + myEx.socksProxy = 'socks5://127.0.0.1:1080'; // from protocols: socks, socks5, socks5h + console.log (await myEx.fetch ('https://api.ipify.org/')); +} + +async function example_webSockets () { + const myEx = new ccxt.pro.kucoin (); + myEx.httpProxy = 'http://188.245.226.105:8911'; // even though you are using WebSockets, you might also need to set up proxy for the exchange's REST requests + myEx.wsProxy = 'http://188.245.226.105:8911'; // "wsProxy" or "wssProxy" or "wsSocksProxy" (depending on your proxy protocol) + await myEx.loadMarkets (); + // + // To ensure your WS proxy works, uncomment below code and watch the log + // + // myEx.verbose = true; + // await myEx.loadHttpProxyAgent (); + // await myEx.watch ('ws://188.245.226.105:9876/', 'myip'); // in the incoming logs, confirm that you see the proxy IP in "hello" message + // + console.log (await myEx.watchTicker ('BTC/USDT')); + await myEx.close (); +} + + +// await example_proxyUrl (); +await example_httpProxy (); +// await example_socksProxy (); +// await example_webSockets (); diff --git a/docs/ccxt/examples/ts/sample-local-proxy-server-with-cors.ts b/docs/ccxt/examples/ts/sample-local-proxy-server-with-cors.ts new file mode 100644 index 0000000..5f833b9 --- /dev/null +++ b/docs/ccxt/examples/ts/sample-local-proxy-server-with-cors.ts @@ -0,0 +1,15 @@ +// @ts-nocheck +// JavaScript sample Proxy with CORS support + +// Save this in a file like cors.js and run with: +// node cors [port] +// It will listen for your requests on the port you pass in command line (or port 8080 by default) + +import cors from 'cors-anywhere'; // npm install cors-anywhere + +const port = (process.argv.length > 2) ? parseInt (process.argv[2]) : 8080; // if not provided from cli, default to 8080 +cors.createServer ({ + // you can set origin, if needed by exchange + // setHeaders: { 'origin': 'https://www.bitmex.com' } +}).listen (port, 'localhost'); +console.log ('Running CORS Anywhere on localhost:' + port); diff --git a/docs/ccxt/examples/ts/watch-OHLCV-For-Symbols.ts b/docs/ccxt/examples/ts/watch-OHLCV-For-Symbols.ts new file mode 100644 index 0000000..d286c37 --- /dev/null +++ b/docs/ccxt/examples/ts/watch-OHLCV-For-Symbols.ts @@ -0,0 +1,17 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const subscriptions = [ + [ 'BTC/USDT', '5m' ], + [ 'ETH/USDT', '5m' ], + [ 'BTC/USDT', '1h' ], + ]; + while (true) { + const ohlcv = await binance.watchOHLCVForSymbols (subscriptions); + console.log (ohlcv); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/watch-OHLCV.ts b/docs/ccxt/examples/ts/watch-OHLCV.ts new file mode 100644 index 0000000..4daa785 --- /dev/null +++ b/docs/ccxt/examples/ts/watch-OHLCV.ts @@ -0,0 +1,14 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbol = 'BTC/USDT'; + const timeframe = '1m'; + while (true) { + const ohlcv = await binance.watchOHLCV (symbol, timeframe); + console.log (ohlcv); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/watch-OrderBook-For-Symbols.ts b/docs/ccxt/examples/ts/watch-OrderBook-For-Symbols.ts new file mode 100644 index 0000000..523c860 --- /dev/null +++ b/docs/ccxt/examples/ts/watch-OrderBook-For-Symbols.ts @@ -0,0 +1,13 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbols = [ 'BTC/USDT', 'ETH/USDT', 'DOGE/USDT' ]; + while (true) { + const orderbook = await binance.watchOrderBookForSymbols (symbols); + console.log (orderbook['symbol'], orderbook['asks'][0], orderbook['bids'][0]); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/watch-Trades-For-Symbols.ts b/docs/ccxt/examples/ts/watch-Trades-For-Symbols.ts new file mode 100644 index 0000000..bd70b8a --- /dev/null +++ b/docs/ccxt/examples/ts/watch-Trades-For-Symbols.ts @@ -0,0 +1,13 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbols = [ 'BTC/USDT', 'ETH/USDT', 'DOGE/USDT' ]; + while (true) { + const trades = await binance.watchTradesForSymbols (symbols); + console.log (trades); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/watch-tickers.ts b/docs/ccxt/examples/ts/watch-tickers.ts new file mode 100644 index 0000000..6f38f75 --- /dev/null +++ b/docs/ccxt/examples/ts/watch-tickers.ts @@ -0,0 +1,13 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbols = [ 'BTC/USDT', 'ETH/USDT', 'DOGE/USDT' ]; + while (true) { + const tickers = await binance.watchTickers (symbols); + console.log (tickers['BTC/USDT'], tickers['ETH/USDT'], tickers['DOGE/USDT']); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/watchPositions-many-exchanges-continuosly.ts b/docs/ccxt/examples/ts/watchPositions-many-exchanges-continuosly.ts new file mode 100644 index 0000000..b4ab8cf --- /dev/null +++ b/docs/ccxt/examples/ts/watchPositions-many-exchanges-continuosly.ts @@ -0,0 +1,53 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// watch and handle constinuosly +async function watchPositionsContinuously (exchange) { + while (true) { + try { + const positions = await exchange.watchPositions (); + console.log ('Fetched ', exchange.id, ' - Positions: ', positions); + } catch (e) { + console.log (e); + break; + } + } +} + +// start exchanges and fetch OHLCV loop +async function startExchange (exchangeName, config) { + const ex = new ccxt[exchangeName] (config); + const promises = []; + promises.push (watchPositionsContinuously (ex)); + await Promise.all (promises); + await ex.close (); +} + +// main function +async function example () { + const exchanges = { + 'binanceusdm': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'okx': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'huobi':{ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + }; + const promises = []; + const exchangeIds = Object.keys (exchanges); + for (let i = 0; i < exchangeIds.length; i++) { + const exchangeName = exchangeIds[i]; + const config = exchanges[exchangeName]; + promises.push (startExchange (exchangeName, config)); + } + await Promise.all (promises); +} + +await example (); diff --git a/docs/ccxt/examples/ts/watchPositions.ts b/docs/ccxt/examples/ts/watchPositions.ts new file mode 100644 index 0000000..98e6f0a --- /dev/null +++ b/docs/ccxt/examples/ts/watchPositions.ts @@ -0,0 +1,15 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.pro.binanceusdm ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET' + }); + while (true) { + const trades = await exchange.watchPositions (); + console.log (trades); + } +} +await example (); diff --git a/docs/ccxt/examples/ts/watchPositionsForSymbols.ts b/docs/ccxt/examples/ts/watchPositionsForSymbols.ts new file mode 100644 index 0000000..9428288 --- /dev/null +++ b/docs/ccxt/examples/ts/watchPositionsForSymbols.ts @@ -0,0 +1,16 @@ +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.pro.binanceusdm ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'Your_API_SECRET' + }); + const symbols = [ 'BTC/USDT:USDT', 'ETH/USDT:USDT', 'DOGE/USDT:USDT' ]; + while (true) { + const trades = await exchange.watchPositions (symbols); + console.log (trades); + } +} +await example (); diff --git a/docs/ccxt/wiki/.nojekyll b/docs/ccxt/wiki/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/ccxt/wiki/Awesome.md b/docs/ccxt/wiki/Awesome.md new file mode 100644 index 0000000..40957c4 --- /dev/null +++ b/docs/ccxt/wiki/Awesome.md @@ -0,0 +1,188 @@ +# Awesome CCXT + +Suggestions and contributions are always welcome! Make sure to read the [contribution guidelines](#contributing) + +- [Awesome CCXT](#awesome-ccxt) + - [Trading bots](#trading-bots) + - [Trading toolkits](#trading-toolkits) + - [Trading terminals](#trading-terminals) + - [Analytics platforms](#analytics-platforms) + - [API](#api) + - [AI](#ai) + - [Utils](#utils) + - [Languages](#languages) + - [Javascript examples](#javascript-examples) + - [Python examples](#python-examples) + - [PHP examples](#php-examples) + - [Articles](#articles) + - [Videos](#videos) +- [Contributing](#contributing) + +## Trading bots + +- [Supertrend crypto bot](https://github.com/hackingthemarkets/supertrend-crypto-bot) - Python, pandas. Has a good video tutorial. +- [CryptoMon Bot](https://github.com/jchristov/cryptomon-bot) - Helps tracking of your cryptocurrency investments and making smart, informed buy/sell decisions. +- [ZenBot](https://github.com/carlos8f/zenbot) - A command-line cryptocurrency trading bot using Node.js and MongoDB. +- [Titan](https://github.com/Denton24646/Titan) - Based on python, flask, postgres. +- [Python-crypto-Bot](https://github.com/Seigneur774/Python-crypto-Bot) +- [Nash](https://github.com/joelsfoster/Nash) - Arbitrage bot on meteorjs +- [cryptodaemon](https://github.com/gmark4212/cryptodaemon) - Bot watches which currencies are now in a significant decline but have the potential for growth. +- [pine-bot-client](https://github.com/kzh-dev/pine-bot-client) +- [cryptobot](https://github.com/Zane-/cryptobot) - lowhighbot, poolbot, releasebot +- [ccxt-trader](https://github.com/Schnides123/ccxt-trader) - cryptocurrency arbitrage calculator on #python +- [KryptoBot](https://github.com/eristoddle/KryptoBot) +- [blockbid-ccxt-tutorials](https://github.com/thomasdavis/blockbid-ccxt-tutorials) +- [trader0](https://github.com/kebnekaise-io/trader0) +- [bakuchi](https://github.com/tsu-nera/bakuchi) - arbitrage bot +- [Superalgos](https://github.com/superalgos/superalgos) - Trading bot platform, node.js, tensorflow + +## Signals + +- [Peregrine](https://github.com/wardbradt/peregrine) - Arbitrage on python. +- [ccxt-arbitrage](https://github.com/ArthurAnanda/ccxt-arbitrage-v1) +- [crypto-arbitrage-framework](https://github.com/hzjken/crypto-arbitrage-framework) +- [Nash](https://github.com/joelsfoster/Nash) - Arbitrage bot on meteorjs +- [ccxt-trade-mgr](https://github.com/notlesh/ccxt-trade-mgr) - take profit vs. stop loss +- [EasyTrage](https://github.com/Vikrammel/EasyTrage) - crypto arbitrage bot in MERN +- [Automatic-Arbitrage-Crypto-exchange](https://github.com/ZgodaRafal/Automatic-Arbitrage-Crypto-exchange) +- [Cryptocurrency-Multi-Exchange-Arbitrage-Strategy](https://github.com/chicago-joe/Cryptocurrency-Multi-Exchange-Arbitrage-Strategy) + +## Trading toolkits + +- [The Coinbase Pro trading toolkit (CPTT)](https://github.com/coinbase/coinbase-pro-trading-toolkit) – a trading toolkit developed by the coinbase team that integrates with ccxt, bitfinex, bitmex, bittrex, coinbasePro, gemini, poloniex. +- [bt-ccxt-store](https://github.com/Dave-Vallance/bt-ccxt-store) – Store with backtesting. #python +- [ZTOM](https://github.com/ztomsy/ztom) - #python, #backtesting, #rest, orders manager, loggin, reporting, throttling control. +- [TradingSystemDemo](https://github.com/FWangTrading/TradingSystemDemo) - #Catalyst, #CryptoCompare, #backtesting, #alerts, #trading, #python +- [Visuccxt](https://github.com/wnklb/Visuccxt) - #python +- [DataSynchronizer](https://github.com/stockmlbot/DataSynchronizer) +- [Trading-indicator](https://github.com/thanhnguyennguyen/trading-indicator) - fetch data with ccxt and generate indicators + +## Trading terminals + +- [Kupi-terminal](https://github.com/kupi-network/kupi-terminal) - Customized, extendable trading platform based on js, vue, react, express (rest api), mongo. Can: plot OHLCV, buy/sell, show balances, history balances, orders, trades, my orders, my trades. +- [ccxt-trading-cp](https://github.com/michnovka/ccxt-trading-cp) - Trading terminal in console: plot OHLCV, find arbitrage signals, buy/sell, show balances. +- [Auto-Trade-Crypto-Bot](https://github.com/dev4Fun/Auto-Trade-Crypto-Bot) - Crypto trading #bot in #python with #telegram. +- [ccxt-exchange-template](https://github.com/AdrenalineAI/ccxt-exchange-template) - python + +## Analytics platforms + +- [CoinTop](https://github.com/fatihacet/CoinTop) - portfolio with secure access to keys +- [DACP](https://github.com/Pyeskyhigh/DACP) - portfolio +- [hodlwatch](https://github.com/belaczek/hodlwatch) - portfolio +- [Live-Crypto-Dashboard-and-DB](https://github.com/srozov/Live-Crypto-Dashboard-and-DB) - python, sentiments + +## API + +- [sanic-ccxt](https://github.com/zloyuser/sanic-ccxt) - Unified REST API on #python +- [ccxt-rest](https://github.com/franz-see/ccxt-rest) - Unified REST API on #javascript +- [ccxt-microservice](https://github.com/xeno14/ccxt-microservice) - Unified REST API on #python +- [mpakus/ccxt-server](https://github.com/mpakus/ccxt-server) - #javascript +- [imloama/ccxt-server](https://github.com/imloama/ccxt-server) - #typescript +- [ccxt-private-ws](https://github.com/invao/ccxt-private-ws) - private websocket connections with CCXT compatible data layout + +## AI + +- [Taurus](https://github.com/OptimalPandemic/taurus) - A cryptocurrency trading platform using deep reinforcement learning. + +## Utils + +- [bitcoin-chart-cli](https://github.com/madnight/bitcoin-chart-cli) by [madnight](https://github.com/madnight) – a command-line console util that draws Bitcoin, Ether, Litecoin and many altcoin charts right in the terminal! +- [node-red-contrib-ccxt](https://github.com/masalinas/node-red-contrib-ccxt) - Node-red integration. +- [freqcache](https://github.com/creslinux/freqcache) - A environment to control egress and ingress data from ccxt fronted trading bots for security and scalability +- [candlestick-convert](https://github.com/valamidev/candlestick-convert) - [Object,Object] => [[],[]] +- [crypto-exporter](https://github.com/ix-ai/crypto-exporter) - An exporter capable of connecting to multiple exchanges and getting account balances and exchange rates +- [ccxtreplay](https://github.com/xCuri0/ccxtreplay) - collect data from ccxt exchanges and replay it for backtesting + +## Languages + +- [CCXT](https://github.com/ccxt/ccxt) - Javascript, python, php, C#. +- [kizzx2/ccxt-rs](https://github.com/kizzx2/ccxt-rs) - Rust. +- [irbis-labs/ccxt-rs](https://github.com/irbis-labs/ccxt-rs) - Rust. Early version. See branch 'preview'. +- [CCXT.NET](https://github.com/lisa3907/ccxt.net) - C#. +- [ccxtex](https://github.com/metachaos-systems/ccxtex) - Elixir/Erlang. +- [ccxt.dart](https://github.com/Sach97/ccxt.dart) - Dart. +- [ccxt-go](https://github.com/prompt-cash/ccxt-go) - Go. + +## Javascript examples + +- [Examples from ccxt](https://github.com/ccxt/ccxt/tree/master/examples/js) +- [Using ccxt and technicalindicators to calculate MACD for BTC/USDT with Node.js](https://runkit.com/dhilipb/macd-for-btc-usdt) – A runkit sample showing how to fetch data and run statistical calculations. + +## Python examples + +- [Examples from ccxt](https://github.com/ccxt/ccxt/tree/master/examples/py) +- [ccxt_notes](https://github.com/yinruiqing/ccxt_notes) - jupiter notebooks +- [51bitqunt](https://github.com/ramoslin02/51bitqunt) - video playlist + +## PHP examples + +- [Examples from ccxt](https://github.com/ccxt/ccxt/tree/master/examples/php) + +## Articles + +- [Enigma Catalyst](https://blog.enigma.co/enigma-announces-catalyst-0-4-our-biggest-release-yet-fa31a5ffa4b1) – The major effort towards decentralized exchanges integrates ccxt! +- [Playing with CCXT in Google Colab](https://medium.com/@ccxt/playing-with-ccxt-in-google-colab-23522ac8a6cb) – An article on how useful Colab can be for quick prototyping and testing your trading ideas with CCXT. +- [CC Power Analytics Part 1: How to get the data of the exchanges](https://www.linkedin.com/pulse/part-1-cc-power-analytics-how-get-data-exchanges-steve-rein/) – The first part of a series of articles on cryptocurrency analytics. +- [Looking for arbitrage opportunies with ccxt](https://steemit.com/steemdev/@codewithcheese/looking-for-arbitrage-opportunies-with-javascript-library-cctx-supporting-70-exchanges) – An article @steemit on getting arbitrage started with ccxt for crypto-arbitrage. +- [A n00bs Guide To Deep Cryptocurrency Trading](https://medium.com/@LeonFedden/deep-cryptocurrency-trading-1e64af6d280a) – An article @ Medium on deep neural trading using ccxt for backend tasks. +- [Let’s write a cryptocurrency bot](https://medium.com/@joeldg/an-advanced-tutorial-a-new-crypto-currency-trading-bot-boilerplate-framework-e777733607ae) – A multi-part advanced tutorial on a new cryptocurrency trading framework also integrating ccxt. +- [Download Cryptocurrency Data with CCXT](https://backtest-rookies.com/2018/03/08/download-cryptocurrency-data-with-ccxt/) – A sample script to download historical data from exchanges with a video overview: [Easy Python script to download crypto currency market data with CCXT package](https://www.youtube.com/watch?v=PTGkJsrF7kQ). +- [Experiments : Creating a Crypto Twitter Bot to Announce Newly Listed CryptoCoins](https://medium.com/@kennychuaio/experiments-creating-a-crypto-twitter-bot-to-announce-newly-listed-cryptocoins-9cd23930f5cb) – An article on how to integrate with CCXT and Twitter to get new currencies from exchanges automatically. +- [How to make your own trading bot](https://codeburst.io/how-to-make-your-own-trading-bot-83b5c6e35036) – A tutorial on algortrading in Python. +- [Writing crypto trading bot in Python with Telegram and ccxt](https://medium.com/@maxAvdyushkin/writing-crypto-trading-bot-in-python-with-telegram-and-ccxt-80632a00c637) – A tutorial on programming a Telegram bot in Python with CCXT +- [Data science is eating the world — Here’s how you can start exploring it](https://medium.com/covee-network/data-science-is-eating-the-world-heres-how-you-can-start-exploring-it-37501414af15) – An article on collecting and analyzing financial big data. +- [Chasing fake volume: a crypto-plague](https://medium.com/@sylvainartplayribes/chasing-fake-volume-a-crypto-plague-ea1a3c1e0b5e) – An article @ Medium on trading volumes analysis. +- [CCXTが便利な理由!CCXTライブラリをインストールしよう](https://ryota-trade.com/?p=476) – An article in Japanese on getting CCXT up and runining. +- [Bitflyerや各取引所の個別APIをCCXTライブラリ経由で直接利用する方法](https://ryota-trade.com/?p=629) – How to use Bitflyer and individual API of each exchange directly via the CCXT library. +- [CCXTライブラリでBitflyerに注文を出す方法をマスターする](https://ryota-trade.com/?p=662) – Master placing orders on Bitflyer with the CCXT library. +- [CCXTでBitflyerに出した注文を管理・キャンセルする方法](https://ryota-trade.com/?p=759) – How to manage and cancel orders placed on Bitflyer with CCXT +- [Bitflyerの未約定の全注文をCCXTで一括でキャンセルする方法](https://ryota-trade.com/?p=833) – How to cancel all uncommitted orders of Bitflyer in bulk with CCXT +- [Python3とCCXTライブラリを用いたBitMEX自動売買bot作成Tips](https://note.mu/akagami/n/n0af0a96c261f) – An article in Japanese on getting started with CCXT and a few bot tips. +- [BitMEX 自動売買BOT開発 (API編) ① 開発環境の構築、APIライブラリの詳細、全APIマップ](https://note.mu/mazmex7/n/n1a3a0293ce82) – An article on developing an automatic BitMEX trading bot. +- [仮想通貨トレード Bot 制作に便利な CCXT ライブラリに関する知見まとめ (Python 随時更新)](http://www.stray-scrapbook.work/entry/2018/04/03/205700) – A summary on Python version of CCXT API in Japanese. +- [Python3とCCXTを使用して仮想通貨の自動売買プログラムを作る](http://www.hacky.xyz/entry/2018/03/18/200822) – Automatic cryptocurrency trading using Python 3 and CCXT +- [ccxtを使って裁定取引botを作ってみたらなぜか虚しくなった件](https://qiita.com/reon777/items/21ed87f19cdd50f08bd9) – An article in Japanese explaining the basics of programming an arbitrage bot with CCXT. +- [Python 3 / BitMEX の BOT を作ろう CCXT + BOT サンプルコード 〈基礎編〉](https://note.mu/mman/n/n5a9083864335) – A sample of basic BitMEX bot with CCXT in Python 3. +- [ccxtがbtcfxbot界隈でちょっと話題になっていたので使ってみた](http://cryptojapan.ml/entry/2018/03/01/151752) – Trying CCXT for a basic bot. +- [python異步加協程獲取比特幣市場信息](https://hk.saowen.com/a/18a648f24d6e7f54981e9db4411b56730a35dd2b3b27519083543bcd6198cd27) – An article in Chinese on using CCXT with Python. +- [Лучшая криптотрейдинг библиотека?](http://medium.com/@vladthelittleone/лучшая-криптотрейдинг-библиотека-67e308f96c1f) – An article in Russian on setting up CCXT to connect and trade with crypto exchanges. + +## Videos + +- [The Evolution of CCXT](https://www.youtube.com/watch?v=O5HrvSLeo90) – An awesome Gource visualization video on YouTube! ) +- [A Video Crash-Course On Using CCXT](https://www.youtube.com/playlist?list=PLIFBTFgFpoJ-xGRz3v_2nF7f9HKZrfSpj) – A series of awesome video tutorials on getting started with CCXT! +- [Download Cryptocurrency Data with CCXT](https://backtest-rookies.com/2018/03/08/download-cryptocurrency-data-with-ccxt/) – A sample script to download historical data from exchanges with a video overview: [Easy Python script to download crypto currency market data with CCXT package](https://www.youtube.com/watch?v=PTGkJsrF7kQ). +- [Python数字货币量化交易开发入门视频-利用CCXT获取bitmex交易所的行情数据](https://www.bilibili.com/video/av44339579/) – An video in Chinese on how to get started with CCXT in Python and a tutorial on OHLCV + Pandas export to CSV. +- [数字货币量化交易1 【群友 Shadow 自制】ccxt 的python版本安装及使用入门](https://www.bilibili.com/video/av21795165) – Trading Digital Currencies 1: Installing and using the Python version of ccxt (video in Chinese) +- [数字货币量化交易2 【群友 林军 自制】ccxt Unified API命令详解及node版本使用演示](https://www.bilibili.com/video/av21842290) – Trading Digital Currencies 2: Using unified CCXT API (video in Chinese) +- [数字货币量化交易3 ccxt Custom API命令详解及node版本使用演示](https://www.bilibili.com/video/av21842988) +– Trading Digital Currencies 3: Details on using custom exchange-specific [implicit methods](https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods) in ccxt (video in Chinese) +- [Algorithmic Trading - Aula 4](https://www.youtube.com/watch?v=BkKebXrhMGY) – A video introduction to algorithmic trading with CCXT from Curso Algo Trading in Portuguese language. +- [Présentation de projet - Créer un Bot Telegram de A à Z (+CCXT)](https://www.youtube.com/watch?v=yayJKRtg5M4) – La création d'un bot Telegram en Node.js, qui va rechercher des informations sur les différentes marketpalce de crypto-monnaies, et cela via la librairie CCXT. +- [Which Bitcoin crypto currency bot project? Gekko vs ccxt vs Tribeca vs Blackbird](https://www.youtube.com/watch?v=Bn2p-nkbVdE) – A video comparison of opensource cryptocurrency trading platforms. + +## Other + +- [Projects based on ccxt](https://github.com/ccxt/ccxt/network/dependents) – A list of hundreds of ccxt-based projects by developers from all over the world! +- [LOC-Extension](https://github.com/walkjivefly/LOC-Extension) – a LibreOffice extension which embeds ccxt to provide cryptocurrency price lookup in your spreadsheets. +- [exchange-connector](https://github.com/donvadicastro/exchange-connector) - Exchange connector over ccxt and kafka +- [ccew](https://github.com/saytoken/ccew) - has the same scheme as ccxt, but provide data by websocket + +## Contributing + +Please ensure your pull request adheres to the following: + +- Search previous suggestions before making a new one to ensure yours is not a duplicate. +- Make an individual pull request for each suggestion. +- Use the following format: [NAME](LINK) - DESCRIPTION. +- Keep descriptions simple. +- New categories, or improvements to the existing ones are welcome. +- End all descriptions with a period. +- Try to ensure your pull requests only have one commit if possible. You can squash your commits into one before submitting. +- Make your pull request titles and descriptions as detailed as possible. Explain why an asset or resources deserves to be added to the list. +- Make sure your additions are in alphabetical order. This includes the headers and items themselves. +- Ensure that assets you submit are of high quality, documented well, and are recently maintained. It also helps if they're popular so I can research them before adding them to the list. +- This is not meant to be used as a list to advertise your own assets. Free or open-source assets should be prioritized over paid assets if they are of similar quality and feature sets. + +## Special thanks +This was forked from /sindresorhus/awesone. Special thanks to [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) for starting this list and those that contributed to it [contributors](https://github.com/suenot/awesome-ccxt/graphs/contributors), this wouldn't be possible without you! diff --git a/docs/ccxt/wiki/CHANGELOG.md b/docs/ccxt/wiki/CHANGELOG.md new file mode 120000 index 0000000..04c99a5 --- /dev/null +++ b/docs/ccxt/wiki/CHANGELOG.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/docs/ccxt/wiki/CLI.md b/docs/ccxt/wiki/CLI.md new file mode 100644 index 0000000..9461ade --- /dev/null +++ b/docs/ccxt/wiki/CLI.md @@ -0,0 +1,156 @@ +# CCXT CLI (Command-Line Interface) + +CCXT includes an example that allows calling all exchange methods and properties from command line. One doesn't even have to be a programmer or write code – any user can use it! + +The CLI interface is a program in CCXT that takes the exchange name and some params from the command line and executes a corresponding call from CCXT printing the output of the call back to the user. Thus, with CLI you can use CCXT out of the box, not a single line of code needed. + +CCXT command line interface is very handy and useful for: + +- bash api scripting +- cron/crontab trading automation +- resolving issues with your code +- debugging the exchange errors +- performing quick cryptocurrency trading from command-line +- aggregating data for backtesting +- adding interoperability with other systems and frameworks +- learning the basics of cryptocurrency exchange trading +- learning CCXT and the advanced aspects of APIs +- writing new exchange integrations +- contributing code to CCXT + +For the CCXT library users – we highly recommend to try CLI at least a few times to get a feel of it. +For the CCXT library developers – CLI is more than just a recommendation, it's a must. + +The best way to learn and understand CCXT CLI – is by experimentation, trial and error. **Warning: CLI executes your command and does not ask for a confirmation after you launch it, so be careful with numbers, confusing amounts with prices can cause a loss of funds.** + +The same CLI design is implemented in all supported languages, TypeScript, JavaScript, Python and PHP – for the purposes of example code for the developers. +In other words, the existing CLI contains three implementations that are in many ways identical. The code in those three CLI examples is intended to be "easily understandable". + +The source code of the CLI is available here: + +- https://github.com/ccxt/ccxt/blob/master/examples/ts/cli.ts +- https://github.com/ccxt/ccxt/blob/master/examples/js/cli.js +- https://github.com/ccxt/ccxt/blob/master/examples/py/cli.py +- https://github.com/ccxt/ccxt/blob/master/examples/php/cli.php + +## Install globally +```shell +npm -g ccxt +``` +- Update using `npm update ccxt -g` + +## Install + +1. Clone the CCXT repository: + ```shell + git clone https://github.com/ccxt/ccxt + ``` +2. Change directory to the cloned repository: + ```shell + cd ccxt + ``` +3. Install the dependencies: + - Node.js + npm: `npm install` + - PHP + Composer: `composer install` + +4. Run the script: + - Node.js: `node examples/js/cli okx fetchTicker ETH/USDT` + - Python: `python3 examples/py/cli.py okx fetch_ticker ETH/USDT` + - PHP: `php -f examples/php/cli.php okx fetch_ticker ETH/USDT` + +## Usage + +The CLI script requires at least one argument, that is, the exchange id ([the list of supported exchanges and their ids](https://github.com/ccxt/ccxt#supported-cryptocurrency-exchange-markets)). If you don't specify the exchange id, the script will print the list of all exchange ids for reference. + +Upon launch, CLI will create and initialize the exchange instance and will also call [exchange.loadMarkets()](https://github.com/ccxt/ccxt/wiki/Manual#loading-markets) on that exchange. +If you don't specify any other command-line arguments to CLI except the exchange id argument, then the CLI script will print out all the contents of the exchange object, including the list of all the methods and properties and all the loaded markets (the output may be extremely long in that case). + +Normally, following the exchange id argument one would specify a method name to call with its arguments or an exchange property to inspect on the exchange instance. + +### Inspecting Exchange Properties + +If the only parameter you specify to CLI is the exchange id, then it will print out the contents of the exchange instance including all properties, methods, markets, currencies, etc. **Warning: exchange contents are HUGE and this will dump A LOT of output to your screen!** + +```shell +node examples/js/cli bybit +``` + +You can specify the name of the property of the exchange to narrow the output down to a reasonable size. + +```shell +node examples/js/cli okx markets # will print out the list of all the loaded markets +node examples/js/cli binance currencies # will print out a table of all the loaded currencies +node examples/js/cli gate options # will print out the contents of the exchange-specific options +``` + +You can easily view which methods are supported on the various exchanges: + +```shell +node examples/js/exchange-capabilities | less -S -R +``` + +### Calling A Unified Method By Name + +Calling unified methods is easy: + +```shell +node examples/js/cli okx fetchOrderBook BTC/USDT # will fetch the orderbook from exchange instance and will print it out as a table +node examples/js/cli binance fetchTrades ETH/USDT # will fetch a list of most recent public trades and will print a table of them +node examples/js/cli bitget fetchTickers # will fetch all tickers one by one +node examples/js/cli bitget fetchTickers --table # will fetch all tickers and will print them out as a table +node examples/js/cli bitget fetchTickers '["BTC/USDT","ETH/USDT"]' # will fetch the tickers specified in the array argument +``` + +Exchange specific parameters can be set in the last argument of every unified method: + +```shell +node examples/js/cli bybit setMarginMode isolated BTC/USDT '{"leverage":"8"}' # set the margin mode while specifying the exchange specific leverage parameter +``` + +### Calling An Exchange-Specific Method By Name + +Here's an example of fetching the order book on okx in sandbox mode using the implicit API and the exchange specific instId and sz parameters: + +```shell +node examples/js/cli okx publicGetMarketBooks '{"instId":"BTC-USDT","sz":"3"}' --sandbox +``` + +## Authentication And Overrides + +Public exchange APIs don't require authentication. You can use the CLI to call any method of a public API. The difference between public APIs and private APIs is described in the Manual, here: [Public/Private API](https://github.com/ccxt/ccxt/wiki/Manual#publicprivate-api). + +For private API calls, by default the CLI script will look for API keys in the `keys.local.json` file in the root of the repository cloned to your working directory and will also look up exchange credentials in the environment variables. More details here: [Adding Exchange Credentials](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#adding-exchange-credentials). + +## Unified API vs Exchange-Specific API + +CLI supports all possible methods and properties that exist on the exchange instance. + +### Run with jq +Install jq + +#### **Ubuntu** +```shell +sudo apt-get install jq +``` +#### **Brew (Mac)** +```shell +brew install jq +``` +#### **Choco (Windows)** +```shell +choco install jq -y +``` + +#### Examples +- Get ticker price of BTC/USDT: `ccxt binance fetchTicker BTC/USDT | jq '.price' +- watch price and amount of trades: +```shell +`ccxt binance watchTrades BTC/USDT --raw | jq -c '[.[] | {price: .price, amount: .amount}]'` +``` + +- fuzzy search between trades (requires fzf): +```shell +`ccxt binance fetchTrades --raw | jq -c '.[]' | fzf` +``` + +![render1710459605924](https://github.com/ccxt/ccxt/assets/12142844/39b22383-42d5-4ebd-8b09-617008b7e4f0) diff --git a/docs/ccxt/wiki/CONTRIBUTING.md b/docs/ccxt/wiki/CONTRIBUTING.md new file mode 120000 index 0000000..44fcc63 --- /dev/null +++ b/docs/ccxt/wiki/CONTRIBUTING.md @@ -0,0 +1 @@ +../CONTRIBUTING.md \ No newline at end of file diff --git a/docs/ccxt/wiki/Certification.md b/docs/ccxt/wiki/Certification.md new file mode 100644 index 0000000..7ed366e --- /dev/null +++ b/docs/ccxt/wiki/Certification.md @@ -0,0 +1,11 @@ +# CCXT Certification Program · ![CCXT Certified](https://img.shields.io/badge/CCXT-certified-green.svg) + +The structure of CCXT defines a good, portable and cross-compatible standard for exchanges' API interfaces, that is implemented in the CCXT Unified API. Exchanges are welcome to apply for our certification program. Certification is technically supervised and quality-assured by members of the CCXT Dev Team. That implies that an exchange having a "certified" badge is properly implemented and tested by the authors of CCXT. Certification means less bugs, more functionality, priority support and a much more stable and efficient implementation in general. + +## Requirements + +Getting integrated and certified requires the exchange to implement a quality API. Please, see the full list of technical requirements here: https://github.com/ccxt/ccxt/wiki/Requirements + +## Contact Us + +For inquiries on getting your exchange integrated, listed and certified: info@ccxt.trade diff --git a/docs/ccxt/wiki/Examples.md b/docs/ccxt/wiki/Examples.md new file mode 100644 index 0000000..4f2f167 --- /dev/null +++ b/docs/ccxt/wiki/Examples.md @@ -0,0 +1,54 @@ +# CCXT Cryptocurrency Trading Library Examples + +![preview](https://user-images.githubusercontent.com/1294454/31798504-ca2af4cc-b53c-11e7-946c-620d744f6d16.gif) + +To run the ccxt examples from any folder type one of the following commands in console. + +## Typescript + +[Typescript Examples](/examples/ts/) + +--- + +## JavaScript + +[JavaScript Examples](/examples/js/) + +```shell +node path/to/example.js # substitute for actual filename here +``` + +These examples might require the following super-useful high-quality Node.js modules by [xpl](https://github.com/xpl): + +- [ololog](https://github.com/xpl/ololog): Platform-agnostic logging with blackjack and hookers ([ololog @ npm](https://npmjs.com/package/ololog)) +- [ansicolor](https://github.com/xpl/ansicolor): A quality JavaScript library for the ANSI color/style management ([ansicolor @ npm](https://npmjs.com/package/ansicolor)) +- [as-table](https://github.com/xpl/as-table): A simple function that prints objects as ASCII tables ([as-table @ npm](https://npmjs.com/package/as-table)) + +All of the modules above are installed with the ccxt library devDependencies by npm automatically. + +bitcoin ascii chart + +--- + +## PHP + +[PHP Examples](/examples/php/) + +```shell +php -f path/to/example.php # substitute for actual filename here +``` + +--- + +## Python + +[Python Examples](/examples/py/) + +![basic-chart](https://user-images.githubusercontent.com/1294454/29979754-6d62354c-8f4f-11e7-9e0a-22e87b4a093b.jpg) + +```shell +python path/to/example.py # substitute for actual filename here +``` + +------------------------------------------------------------------------------- + diff --git a/docs/ccxt/wiki/Exchange-Markets-By-Country.md b/docs/ccxt/wiki/Exchange-Markets-By-Country.md new file mode 100644 index 0000000..5f2c5df --- /dev/null +++ b/docs/ccxt/wiki/Exchange-Markets-By-Country.md @@ -0,0 +1,118 @@ +# Exchanges By Country + +The ccxt library currently supports the following cryptocurrency exchange markets and trading APIs: + +|country / region |logo |id |name |ver | +|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|-----------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------:| +| Australia | [![btcmarkets](https://github.com/user-attachments/assets/8c8d6907-3873-4cc4-ad20-e22fba28247e)](https://btcmarkets.net) | btcmarkets | [BTC Markets](https://btcmarkets.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.btcmarkets.net/doc/v3) | +| Australia | [![coinspot](https://user-images.githubusercontent.com/1294454/28208429-3cacdf9a-6896-11e7-854e-4c79a772a30f.jpg)](https://www.coinspot.com.au/register?code=PJURCU) | coinspot | [CoinSpot](https://www.coinspot.com.au/register?code=PJURCU) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.coinspot.com.au/api) | +| Australia | [![independentreserve](https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg)](https://www.independentreserve.com) | independentreserve | [Independent Reserve](https://www.independentreserve.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.independentreserve.com/API) | +| Australia | [![timex](https://user-images.githubusercontent.com/1294454/70423869-6839ab00-1a7f-11ea-8f94-13ae72c31115.jpg)](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | timex | [TimeX](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://plasma-relay-backend.timex.io/swagger-ui/index.html) | +| Austria | [![onetrading](https://github.com/ccxt/ccxt/assets/43336371/bdbc26fd-02f2-4ca7-9f1e-17333690bb1c)](https://onetrading.com/) | onetrading | [One Trading](https://onetrading.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.onetrading.com) | +| Bahamas | [![oceanex](https://user-images.githubusercontent.com/1294454/58385970-794e2d80-8001-11e9-889c-0567cd79b78e.jpg)](https://oceanex.pro/signup?referral=VE24QX) | oceanex | [OceanEx](https://oceanex.pro/signup?referral=VE24QX) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api.oceanex.pro/doc/v1) | +| Bermuda | [![hashkey](https://github.com/user-attachments/assets/6dd6127b-cc19-4a13-9b29-a98d81f80e98)](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | hashkey | [HashKey Global](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://hashkeyglobal-apidoc.readme.io/) | +| Brazil | [![mercado](https://user-images.githubusercontent.com/1294454/27837060-e7c58714-60ea-11e7-9192-f05e86adb83f.jpg)](https://www.mercadobitcoin.com.br) | mercado | [Mercado Bitcoin](https://www.mercadobitcoin.com.br) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.mercadobitcoin.com.br/api-doc) | +| Brazil | [![novadax](https://user-images.githubusercontent.com/1294454/92337550-2b085500-f0b3-11ea-98e7-5794fb07dd3b.jpg)](https://www.novadax.com.br/?s=ccxt) | novadax | [NovaDAX](https://www.novadax.com.br/?s=ccxt) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://doc.novadax.com/pt-BR/) | +| British Virgin Islands | [![bitfinex](https://github.com/user-attachments/assets/4a8e947f-ab46-481a-a8ae-8b20e9b03178)](https://www.bitfinex.com) | bitfinex | [Bitfinex](https://www.bitfinex.com) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitfinex.com/v2/docs/) | +| British Virgin Islands | [![bybit](https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | +| British Virgin Islands | [![coincatch](https://github.com/user-attachments/assets/3d49065f-f05d-4573-88a2-1b5201ec6ff3)](https://partner.coincatch.cc/bg/92hy70391729607848548) | coincatch | [CoinCatch](https://partner.coincatch.cc/bg/92hy70391729607848548) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coincatch.github.io/github.io/en/) | +| Canada | [![cryptomus](https://github.com/user-attachments/assets/8e0b1c48-7c01-4177-9224-f1b01d89d7e7)](https://app.cryptomus.com/signup/?ref=JRP4yj) | cryptomus | [Cryptomus](https://app.cryptomus.com/signup/?ref=JRP4yj) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://doc.cryptomus.com/personal) | +| Canada | [![ndax](https://user-images.githubusercontent.com/1294454/108623144-67a3ef00-744e-11eb-8140-75c6b851e945.jpg)](https://one.ndax.io/bfQiSL) | ndax | [NDAX](https://one.ndax.io/bfQiSL) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidoc.ndax.io/) | +| Cayman Islands | [![latoken](https://user-images.githubusercontent.com/1294454/61511972-24c39f00-aa01-11e9-9f7c-471f1d6e5214.jpg)](https://latoken.com/invite?r=mvgp2djk) | latoken | [Latoken](https://latoken.com/invite?r=mvgp2djk) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://api.latoken.com) | +| Cayman Islands | [![modetrade](https://github.com/user-attachments/assets/cec2b7f1-3b2b-4502-971b-447ee1937d6b)](https://trade.mode.network?ref=MODETRADE) | modetrade | [Mode Trade](https://trade.mode.network?ref=MODETRADE) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](undefined) | +| Cayman Islands | [![toobit](https://github.com/user-attachments/assets/3fc13870-5406-431b-8be0-2aab69c4f225)](https://www.toobit.com/en-US/r?i=IFFPy0) | toobit | [Toobit](https://www.toobit.com/en-US/r?i=IFFPy0) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://toobit-docs.github.io/apidocs/spot/v1/en/) | +| Cayman Islands | [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://woox.io/register?ref=DIJT0CNL) | woo | [WOO X](https://woox.io/register?ref=DIJT0CNL) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woox.io/) | +| Cayman Islands | [![woofipro](https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | +| China | [![bigone](https://github.com/user-attachments/assets/4e5cfd53-98cc-4b90-92cd-0d7b512653d1)](https://b1.run/users/new?code=D3LLBVFT) | bigone | [BigONE](https://b1.run/users/new?code=D3LLBVFT) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://open.big.one/docs/api.html) | +| China | [![bitmart](https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | +| China | [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.coinex.com/api/v2) | +| China | [![htx](https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg)](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | htx | [HTX](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://huobiapi.github.io/docs/spot/v1/en/) | +| China | [![lbank](https://user-images.githubusercontent.com/1294454/38063602-9605e28a-3302-11e8-81be-64b1e53c4cfb.jpg)](https://www.lbank.com/login/?icode=7QCY) | lbank | [LBank](https://www.lbank.com/login/?icode=7QCY) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.lbank.com/en-US/docs/index.html) | +| China | [![myokx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.my.okx.com/join/CCXT2023) | myokx | [MyOKX (EEA)](https://www.my.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://my.okx.com/docs-v5/en/#overview) | +| China | [![okcoin](https://user-images.githubusercontent.com/51840849/87295551-102fbf00-c50e-11ea-90a9-462eebba5829.jpg)](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | okcoin | [OKCoin](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okcoin.com/docs/en/) | +| China | [![okx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.okx.com/join/CCXT2023) | okx | [OKX](https://www.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okx.com/docs-v5/en/) | +| China | [![okxus](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.app.okx.com/join/CCXT2023) | okxus | [OKX (US)](https://www.app.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://app.okx.com/docs-v5/en/#overview) | +| China | [![phemex](https://user-images.githubusercontent.com/1294454/85225056-221eb600-b3d7-11ea-930d-564d2690e3f6.jpg)](https://phemex.com/register?referralCode=EDNVJ) | phemex | [Phemex](https://phemex.com/register?referralCode=EDNVJ) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://phemex-docs.github.io/#overview) | +| Cyprus | [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://trade.cex.io/docs/) | +| Czech Republic | [![coinmate](https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg)](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | coinmate | [CoinMate](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coinmate.docs.apiary.io) | +| EU | [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://trade.cex.io/docs/) | +| EU | [![coinmate](https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg)](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | coinmate | [CoinMate](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coinmate.docs.apiary.io) | +| EU | [![paymium](https://user-images.githubusercontent.com/51840849/87153930-f0f02200-c2c0-11ea-9c0a-40337375ae89.jpg)](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | paymium | [Paymium](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Paymium/api-documentation) | +| Estonia | [![coinmetro](https://github.com/ccxt/ccxt/assets/43336371/e86f87ec-6ba3-4410-962b-f7988c5db539)](https://go.coinmetro.com/?ref=crypto24) | coinmetro | [Coinmetro](https://go.coinmetro.com/?ref=crypto24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://documenter.getpostman.com/view/3653795/SVfWN6KS) | +| Estonia | [![whitebit](https://user-images.githubusercontent.com/1294454/66732963-8eb7dd00-ee66-11e9-849b-10d9282bb9e0.jpg)](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | whitebit | [WhiteBit](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://github.com/whitebit-exchange/api-docs) | +| Estonia | [![zonda](https://user-images.githubusercontent.com/1294454/159202310-a0e38007-5e7c-4ba9-a32f-c8263a0291fe.jpg)](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | zonda | [Zonda](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.zondacrypto.exchange/) | +| France | [![paymium](https://user-images.githubusercontent.com/51840849/87153930-f0f02200-c2c0-11ea-9c0a-40337375ae89.jpg)](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | paymium | [Paymium](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Paymium/api-documentation) | +| Hong Kong | [![bitmart](https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | +| Hong Kong | [![hitbtc](https://user-images.githubusercontent.com/1294454/27766555-8eaec20e-5edc-11e7-9c5b-6dc69fc42f5e.jpg)](https://hitbtc.com/?ref_id=5a5d39a65d466) | hitbtc | [HitBTC](https://hitbtc.com/?ref_id=5a5d39a65d466) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.hitbtc.com) | +| India | [![bitbns](https://github.com/user-attachments/assets/a5b9a562-cdd8-4bea-9fa7-fd24c1dad3d9)](https://ref.bitbns.com/1090961) | bitbns | [Bitbns](https://ref.bitbns.com/1090961) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://bitbns.com/trade/#/api-trading/) | +| Indonesia | [![coincheck](https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg)](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coincheck.com/documents/exchange/api) | +| Indonesia | [![indodax](https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg)](https://indodax.com/ref/testbitcoincoid/1) | indodax | [INDODAX](https://indodax.com/ref/testbitcoincoid/1) | [![API Version 2.0](https://img.shields.io/badge/2.0-lightgray)](https://github.com/btcid/indodax-official-api-docs) | +| Indonesia | [![tokocrypto](https://user-images.githubusercontent.com/1294454/183870484-d3398d0c-f6a1-4cce-91b8-d58792308716.jpg)](https://tokocrypto.com) | tokocrypto | [Tokocrypto](https://tokocrypto.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.tokocrypto.com/apidocs/) | +| Israel | [![bit2c](https://github.com/user-attachments/assets/db0bce50-6842-4c09-a1d5-0c87d22118aa)](https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf) | bit2c | [Bit2C](https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.bit2c.co.il/home/api) | +| Japan | [![backpack](https://github.com/user-attachments/assets/cc04c278-679f-4554-9f72-930dd632b80f)](https://backpack.exchange/join/ccxt) | backpack | [Backpack](https://backpack.exchange/join/ccxt) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.backpack.exchange/) | +| Japan | [![bitbank](https://github.com/user-attachments/assets/9d616de0-8a88-4468-8e38-d269acab0348)](https://bitbank.cc/) | bitbank | [bitbank](https://bitbank.cc/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.bitbank.cc/) | +| Japan | [![bitflyer](https://github.com/user-attachments/assets/d0217747-e54d-4533-8416-0d553dca74bb)](https://bitflyer.com) | bitflyer | [bitFlyer](https://bitflyer.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://lightning.bitflyer.com/docs?lang=en) | +| Japan | [![bittrade](https://user-images.githubusercontent.com/1294454/85734211-85755480-b705-11ea-8b35-0b7f1db33a2f.jpg)](https://www.bittrade.co.jp/register/?invite_code=znnq3) | bittrade | [BitTrade](https://www.bittrade.co.jp/register/?invite_code=znnq3) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api-doc.bittrade.co.jp) | +| Japan | [![btcbox](https://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76b)](https://www.btcbox.co.jp/) | btcbox | [BtcBox](https://www.btcbox.co.jp/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://blog.btcbox.jp/en/archives/8762) | +| Japan | [![coincheck](https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg)](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coincheck.com/documents/exchange/api) | +| Japan | [![zaif](https://user-images.githubusercontent.com/1294454/27766927-39ca2ada-5eeb-11e7-972f-1b4199518ca6.jpg)](https://zaif.jp) | zaif | [Zaif](https://zaif.jp) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://techbureau-api-document.readthedocs.io/ja/latest/index.html) | +| Lithuania | [![exmo](https://user-images.githubusercontent.com/1294454/27766491-1b0ea956-5eda-11e7-9225-40d67b481b8d.jpg)](https://exmo.me/?ref=131685) | exmo | [EXMO](https://exmo.me/?ref=131685) | [![API Version 1.1](https://img.shields.io/badge/1.1-lightgray)](https://exmo.me/en/api_doc?ref=131685) | +| Lithuania | [![p2b](https://github.com/ccxt/ccxt/assets/43336371/8da13a80-1f0a-49be-bb90-ff8b25164755)](https://p2pb2b.com?referral=ee784c53) | p2b | [p2b](https://p2pb2b.com?referral=ee784c53) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md) | +| Malta | [![bequant](https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867)](https://bequant.io/referral/dd104e3bee7634ec) | bequant | [Bequant](https://bequant.io/referral/dd104e3bee7634ec) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.bequant.io/) | +| Malta | [![cryptocom](https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg)](https://crypto.com/exch/kdacthrnxt) | cryptocom | [Crypto.com](https://crypto.com/exch/kdacthrnxt) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html) | +| Mexico | [![bitso](https://github.com/user-attachments/assets/178c8e56-9054-4107-b192-5e5053d4f975)](https://bitso.com/?ref=itej) | bitso | [Bitso](https://bitso.com/?ref=itej) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://bitso.com/api_info) | +| Netherlands | [![bitvavo](https://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8)](https://bitvavo.com/?a=24F34952F7) | bitvavo | [Bitvavo](https://bitvavo.com/?a=24F34952F7) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitvavo.com/) | +| Netherlands | [![deribit](https://user-images.githubusercontent.com/1294454/41933112-9e2dd65a-798b-11e8-8440-5bab2959fcb8.jpg)](https://www.deribit.com/reg-1189.4038) | deribit | [Deribit](https://www.deribit.com/reg-1189.4038) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.deribit.com/v2) | +| New Zealand | [![independentreserve](https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg)](https://www.independentreserve.com) | independentreserve | [Independent Reserve](https://www.independentreserve.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.independentreserve.com/API) | +| Panama | [![oxfun](https://github.com/ccxt/ccxt/assets/43336371/6a196124-c1ee-4fae-8573-962071b61a85)](https://ox.fun/register?shareAccountId=5ZUD4a7G) | oxfun | [OXFUN](https://ox.fun/register?shareAccountId=5ZUD4a7G) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.ox.fun/) | +| Philippines | [![coinsph](https://user-images.githubusercontent.com/1294454/225719995-48ab2026-4ddb-496c-9da7-0d7566617c9b.jpg)](https://coins.ph/) | coinsph | [Coins.ph](https://coins.ph/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coins-docs.github.io/rest-api) | +| Russia | [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://trade.cex.io/docs/) | +| Russia | [![yobit](https://user-images.githubusercontent.com/1294454/27766910-cdcbfdae-5eea-11e7-9859-03fea873272d.jpg)](https://www.yobit.net) | yobit | [YoBit](https://www.yobit.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.yobit.net/en/api/) | +| Saint Kitts and Nevis | [![fmfwio](https://user-images.githubusercontent.com/1294454/159177712-b685b40c-5269-4cea-ac83-f7894c49525d.jpg)](https://fmfw.io/referral/da948b21d6c92d69) | fmfwio | [FMFW.io](https://fmfw.io/referral/da948b21d6c92d69) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.fmfw.io/) | +| Seychelles | [![bitmex](https://github.com/user-attachments/assets/c78425ab-78d5-49d6-bd14-db7734798f04)](https://www.bitmex.com/app/register/NZTR1q) | bitmex | [BitMEX](https://www.bitmex.com/app/register/NZTR1q) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.bitmex.com/app/apiOverview) | +| Seychelles | [![kucoin](https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg)](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | kucoin | [KuCoin](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.kucoin.com) | +| Seychelles | [![kucoinfutures](https://user-images.githubusercontent.com/1294454/147508995-9e35030a-d046-43a1-a006-6fabd981b554.jpg)](https://futures.kucoin.com/?rcode=E5wkqe) | kucoinfutures | [KuCoin Futures](https://futures.kucoin.com/?rcode=E5wkqe) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.kucoin.com/futures) | +| Seychelles | [![mexc](https://user-images.githubusercontent.com/1294454/137283979-8b2a818d-8633-461b-bfca-de89e8c446b2.jpg)](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | mexc | [MEXC Global](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://mexcdevelop.github.io/apidocs/) | +| Seychelles | [![probit](https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg)](https://www.probit.com/r/34608773) | probit | [ProBit](https://www.probit.com/r/34608773) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs-en.probit.com) | +| Seychelles | [![xt](https://user-images.githubusercontent.com/14319357/232636712-466df2fc-560a-4ca4-aab2-b1d954a58e24.jpg)](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | xt | [XT](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://doc.xt.com/) | +| Singapore | [![ascendex](https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1)](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | ascendex | [AscendEX](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://ascendex.github.io/ascendex-pro-api/#ascendex-pro-api-documentation) | +| Singapore | [![bitget](https://github.com/user-attachments/assets/fbaa10cc-a277-441d-a5b7-997dd9a87658)](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | bitget | [Bitget](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitget.com/api-doc/common/intro) | +| Singapore | [![bitrue](https://github.com/user-attachments/assets/67abe346-1273-461a-bd7c-42fa32907c8e)](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | bitrue | [Bitrue](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Bitrue-exchange/bitrue-official-api-docs) | +| Singapore | [![digifinex](https://user-images.githubusercontent.com/51840849/87443315-01283a00-c5fe-11ea-8628-c2a0feaf07ac.jpg)](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | digifinex | [DigiFinex](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.digifinex.com) | +| Singapore | [![luno](https://user-images.githubusercontent.com/1294454/27766607-8c1a69d8-5ede-11e7-930c-540b5eb9be24.jpg)](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.luno.com/en/api) | +| South Africa | [![luno](https://user-images.githubusercontent.com/1294454/27766607-8c1a69d8-5ede-11e7-930c-540b5eb9be24.jpg)](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.luno.com/en/api) | +| South Korea | [![bithumb](https://github.com/user-attachments/assets/c9e0eefb-4777-46b9-8f09-9d7f7c4af82d)](https://www.bithumb.com) | bithumb | [Bithumb](https://www.bithumb.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidocs.bithumb.com) | +| South Korea | [![bitmart](https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | +| South Korea | [![coinone](https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg)](https://coinone.co.kr) | coinone | [CoinOne](https://coinone.co.kr) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://doc.coinone.co.kr) | +| South Korea | [![gate](https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85)](https://www.gate.io/signup/2436035) | gate | [Gate.io](https://www.gate.io/signup/2436035) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://www.gate.io/docs/developers/apiv4/en/) | +| South Korea | [![hollaex](https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg)](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | hollaex | [HollaEx](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://apidocs.hollaex.com) | +| South Korea | [![probit](https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg)](https://www.probit.com/r/34608773) | probit | [ProBit](https://www.probit.com/r/34608773) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs-en.probit.com) | +| South Korea | [![upbit](https://user-images.githubusercontent.com/1294454/49245610-eeaabe00-f423-11e8-9cba-4b0aed794799.jpg)](https://upbit.com) | upbit | [Upbit](https://upbit.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C) | +| St. Vincent & Grenadines | [![delta](https://user-images.githubusercontent.com/1294454/99450025-3be60a00-2931-11eb-9302-f4fd8d8589aa.jpg)](https://www.delta.exchange/app/signup/?code=IULYNB) | delta | [Delta Exchange](https://www.delta.exchange/app/signup/?code=IULYNB) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.delta.exchange) | +| Switzerland | [![wavesexchange](https://user-images.githubusercontent.com/1294454/84547058-5fb27d80-ad0b-11ea-8711-78ac8b3c7f31.jpg)](https://wx.network) | wavesexchange | [Waves.Exchange](https://wx.network) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.wx.network) | +| Taiwan | [![bitopro](https://github.com/user-attachments/assets/affc6337-b95a-44bf-aacd-04f9722364f6)](https://www.bitopro.com) | bitopro | [BitoPro](https://www.bitopro.com) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://github.com/bitoex/bitopro-offical-api-docs/blob/master/v3-1/rest-1/rest.md) | +| Turkey | [![btcturk](https://github.com/user-attachments/assets/10e0a238-9f60-4b06-9dda-edfc7602f1d6)](https://www.btcturk.com) | btcturk | [BTCTurk](https://www.btcturk.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/BTCTrader/broker-api-docs) | +| UK | [![bitstamp](https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024)](https://www.bitstamp.net) | bitstamp | [Bitstamp](https://www.bitstamp.net) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitstamp.net/api) | +| UK | [![bitteam](https://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135)](https://bit.team/auth/sign-up?ref=bitboy2023) | bitteam | [BIT.TEAM](https://bit.team/auth/sign-up?ref=bitboy2023) | [![API Version 2.0.6](https://img.shields.io/badge/2.0.6-lightgray)](https://bit.team/trade/api/documentation) | +| UK | [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://trade.cex.io/docs/) | +| UK | [![coinmate](https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg)](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | coinmate | [CoinMate](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coinmate.docs.apiary.io) | +| UK | [![luno](https://user-images.githubusercontent.com/1294454/27766607-8c1a69d8-5ede-11e7-930c-540b5eb9be24.jpg)](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.luno.com/en/api) | +| US | [![alpaca](https://github.com/user-attachments/assets/e9476df8-a450-4c3e-ab9a-1a7794219e1b)](https://alpaca.markets) | alpaca | [Alpaca](https://alpaca.markets) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://alpaca.markets/docs/) | +| US | [![binanceus](https://github.com/user-attachments/assets/a9667919-b632-4d52-a832-df89f8a35e8c)](https://www.binance.us/?ref=35005074) | binanceus | [Binance US](https://www.binance.us/?ref=35005074) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/binance-us/binance-official-api-docs) | +| US | [![bingx](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg)](https://bingx.com/invite/OHETOM) | bingx | [BingX](https://bingx.com/invite/OHETOM) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://bingx-api.github.io/docs/) | +| US | [![bitmart](https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | +| US | [![blofin](https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b)](https://blofin.com/register?referral_code=f79EsS) | blofin | [BloFin](https://blofin.com/register?referral_code=f79EsS) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://blofin.com/docs) | +| US | [![btcalpha](https://github.com/user-attachments/assets/dce49f3a-61e5-4ba0-a2fe-41d192fd0e5d)](https://btc-alpha.com/?r=123788) | btcalpha | [BTC-Alpha](https://btc-alpha.com/?r=123788) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://btc-alpha.github.io/api-docs) | +| US | [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | +| US | [![coinbaseexchange](https://github.com/ccxt/ccxt/assets/43336371/34a65553-88aa-4a38-a714-064bd228b97e)](https://coinbase.com/) | coinbaseexchange | [Coinbase Exchange](https://coinbase.com/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.cloud.coinbase.com/exchange/docs/) | +| US | [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | +| US | [![gemini](https://user-images.githubusercontent.com/1294454/27816857-ce7be644-6096-11e7-82d6-3c257263229c.jpg)](https://gemini.com/) | gemini | [Gemini](https://gemini.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.gemini.com/rest-api) | +| US | [![hibachi](https://github.com/user-attachments/assets/7301bbb1-4f27-4167-8a55-75f74b14e973)](hibachi.xyz/r/ZBL2YFWIHU) | hibachi | [Hibachi](hibachi.xyz/r/ZBL2YFWIHU) | [![API Version *](https://img.shields.io/badge/*-lightgray)](undefined) | +| US | [![kraken](https://user-images.githubusercontent.com/51840849/76173629-fc67fb00-61b1-11ea-84fe-f2de582f58a3.jpg)](https://www.kraken.com) | kraken | [Kraken](https://www.kraken.com) | [![API Version 0](https://img.shields.io/badge/0-lightgray)](https://docs.kraken.com/rest/) | +| US | [![krakenfutures](https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg)](https://futures.kraken.com/) | krakenfutures | [Kraken Futures](https://futures.kraken.com/) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.kraken.com/api/docs/futures-api/trading/market-data/) | +| US | [![myokx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.my.okx.com/join/CCXT2023) | myokx | [MyOKX (EEA)](https://www.my.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://my.okx.com/docs-v5/en/#overview) | +| US | [![okcoin](https://user-images.githubusercontent.com/51840849/87295551-102fbf00-c50e-11ea-90a9-462eebba5829.jpg)](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | okcoin | [OKCoin](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okcoin.com/docs/en/) | +| US | [![okx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.okx.com/join/CCXT2023) | okx | [OKX](https://www.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okx.com/docs-v5/en/) | +| US | [![okxus](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.app.okx.com/join/CCXT2023) | okxus | [OKX (US)](https://www.app.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://app.okx.com/docs-v5/en/#overview) | +| US | [![poloniex](https://user-images.githubusercontent.com/1294454/27766817-e9456312-5ee6-11e7-9b3c-b628ca5626a5.jpg)](https://poloniex.com/signup?c=UBFZJRPJ) | poloniex | [Poloniex](https://poloniex.com/signup?c=UBFZJRPJ) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://api-docs.poloniex.com/spot/) | + diff --git a/docs/ccxt/wiki/Exchange-Markets.md b/docs/ccxt/wiki/Exchange-Markets.md new file mode 100644 index 0000000..b43f677 --- /dev/null +++ b/docs/ccxt/wiki/Exchange-Markets.md @@ -0,0 +1,109 @@ +# Supported Exchanges +The CCXT library currently supports the following 104 cryptocurrency exchange markets and trading APIs: + +|logo |id |name |ver |type |certified |pro | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|----------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------:|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------| +| [![alpaca](https://github.com/user-attachments/assets/e9476df8-a450-4c3e-ab9a-1a7794219e1b)](https://alpaca.markets) | alpaca | [Alpaca](https://alpaca.markets) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://alpaca.markets/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![apex](https://github.com/user-attachments/assets/fef8f2f7-4265-46aa-965e-33a91881cb00)](https://omni.apex.exchange/trade) | apex | [Apex](https://omni.apex.exchange/trade) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api-docs.pro.apex.exchange) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![ascendex](https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1)](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | ascendex | [AscendEX](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://ascendex.github.io/ascendex-pro-api/#ascendex-pro-api-documentation) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bequant](https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867)](https://bequant.io/referral/dd104e3bee7634ec) | bequant | [Bequant](https://bequant.io/referral/dd104e3bee7634ec) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.bequant.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bigone](https://github.com/user-attachments/assets/4e5cfd53-98cc-4b90-92cd-0d7b512653d1)](https://b1.run/users/new?code=D3LLBVFT) | bigone | [BigONE](https://b1.run/users/new?code=D3LLBVFT) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://open.big.one/docs/api.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![binance](https://github.com/user-attachments/assets/e9419b93-ccb0-46aa-9bff-c883f096274b)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binance | [Binance](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://developers.binance.com/en) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binancecoinm](https://github.com/user-attachments/assets/387cfc4e-5f33-48cd-8f5c-cd4854dabf0c)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binancecoinm | [Binance COIN-M](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://binance-docs.github.io/apidocs/delivery/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binanceus](https://github.com/user-attachments/assets/a9667919-b632-4d52-a832-df89f8a35e8c)](https://www.binance.us/?ref=35005074) | binanceus | [Binance US](https://www.binance.us/?ref=35005074) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/binance-us/binance-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binanceusdm](https://github.com/user-attachments/assets/871cbea7-eebb-4b28-b260-c1c91df0487a)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binanceusdm | [Binance USDⓈ-M](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://binance-docs.github.io/apidocs/futures/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bingx](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg)](https://bingx.com/invite/OHETOM) | bingx | [BingX](https://bingx.com/invite/OHETOM) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://bingx-api.github.io/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bit2c](https://github.com/user-attachments/assets/db0bce50-6842-4c09-a1d5-0c87d22118aa)](https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf) | bit2c | [Bit2C](https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.bit2c.co.il/home/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitbank](https://github.com/user-attachments/assets/9d616de0-8a88-4468-8e38-d269acab0348)](https://bitbank.cc/) | bitbank | [bitbank](https://bitbank.cc/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.bitbank.cc/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitbns](https://github.com/user-attachments/assets/a5b9a562-cdd8-4bea-9fa7-fd24c1dad3d9)](https://ref.bitbns.com/1090961) | bitbns | [Bitbns](https://ref.bitbns.com/1090961) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://bitbns.com/trade/#/api-trading/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitfinex](https://github.com/user-attachments/assets/4a8e947f-ab46-481a-a8ae-8b20e9b03178)](https://www.bitfinex.com) | bitfinex | [Bitfinex](https://www.bitfinex.com) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitfinex.com/v2/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitflyer](https://github.com/user-attachments/assets/d0217747-e54d-4533-8416-0d553dca74bb)](https://bitflyer.com) | bitflyer | [bitFlyer](https://bitflyer.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://lightning.bitflyer.com/docs?lang=en) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitget](https://github.com/user-attachments/assets/fbaa10cc-a277-441d-a5b7-997dd9a87658)](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | bitget | [Bitget](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitget.com/api-doc/common/intro) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bithumb](https://github.com/user-attachments/assets/c9e0eefb-4777-46b9-8f09-9d7f7c4af82d)](https://www.bithumb.com) | bithumb | [Bithumb](https://www.bithumb.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidocs.bithumb.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitmart](https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitmex](https://github.com/user-attachments/assets/c78425ab-78d5-49d6-bd14-db7734798f04)](https://www.bitmex.com/app/register/NZTR1q) | bitmex | [BitMEX](https://www.bitmex.com/app/register/NZTR1q) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.bitmex.com/app/apiOverview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitopro](https://github.com/user-attachments/assets/affc6337-b95a-44bf-aacd-04f9722364f6)](https://www.bitopro.com) | bitopro | [BitoPro](https://www.bitopro.com) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://github.com/bitoex/bitopro-offical-api-docs/blob/master/v3-1/rest-1/rest.md) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitrue](https://github.com/user-attachments/assets/67abe346-1273-461a-bd7c-42fa32907c8e)](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | bitrue | [Bitrue](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Bitrue-exchange/bitrue-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitso](https://github.com/user-attachments/assets/178c8e56-9054-4107-b192-5e5053d4f975)](https://bitso.com/?ref=itej) | bitso | [Bitso](https://bitso.com/?ref=itej) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://bitso.com/api_info) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitstamp](https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024)](https://www.bitstamp.net) | bitstamp | [Bitstamp](https://www.bitstamp.net) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitstamp.net/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitteam](https://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135)](https://bit.team/auth/sign-up?ref=bitboy2023) | bitteam | [BIT.TEAM](https://bit.team/auth/sign-up?ref=bitboy2023) | [![API Version 2.0.6](https://img.shields.io/badge/2.0.6-lightgray)](https://bit.team/trade/api/documentation) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitvavo](https://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8)](https://bitvavo.com/?a=24F34952F7) | bitvavo | [Bitvavo](https://bitvavo.com/?a=24F34952F7) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitvavo.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bl3p](https://github.com/user-attachments/assets/75aeb14e-cd48-43c8-8492-dff002dea0be)](https://bl3p.eu) | bl3p | [BL3P](https://bl3p.eu) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/BitonicNL/bl3p-api/tree/master/docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![blockchaincom](https://github.com/user-attachments/assets/975e3054-3399-4363-bcee-ec3c6d63d4e8)](https://blockchain.com) | blockchaincom | [Blockchain.com](https://blockchain.com) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.blockchain.com/v3) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![blofin](https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b)](https://blofin.com/register?referral_code=f79EsS) | blofin | [BloFin](https://blofin.com/register?referral_code=f79EsS) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://blofin.com/docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![btcalpha](https://github.com/user-attachments/assets/dce49f3a-61e5-4ba0-a2fe-41d192fd0e5d)](https://btc-alpha.com/?r=123788) | btcalpha | [BTC-Alpha](https://btc-alpha.com/?r=123788) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://btc-alpha.github.io/api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![btcbox](https://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76b)](https://www.btcbox.co.jp/) | btcbox | [BtcBox](https://www.btcbox.co.jp/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://blog.btcbox.jp/en/archives/8762) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![btcmarkets](https://github.com/user-attachments/assets/8c8d6907-3873-4cc4-ad20-e22fba28247e)](https://btcmarkets.net) | btcmarkets | [BTC Markets](https://btcmarkets.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.btcmarkets.net/doc/v3) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![btcturk](https://github.com/user-attachments/assets/10e0a238-9f60-4b06-9dda-edfc7602f1d6)](https://www.btcturk.com) | btcturk | [BTCTurk](https://www.btcturk.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/BTCTrader/broker-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bybit](https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://trade.cex.io/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbaseexchange](https://github.com/ccxt/ccxt/assets/43336371/34a65553-88aa-4a38-a714-064bd228b97e)](https://coinbase.com/) | coinbaseexchange | [Coinbase Exchange](https://coinbase.com/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.cloud.coinbase.com/exchange/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coincatch](https://github.com/user-attachments/assets/3d49065f-f05d-4573-88a2-1b5201ec6ff3)](https://partner.coincatch.cc/bg/92hy70391729607848548) | coincatch | [CoinCatch](https://partner.coincatch.cc/bg/92hy70391729607848548) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coincatch.github.io/github.io/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coincheck](https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg)](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coincheck.com/documents/exchange/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.coinex.com/api/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinlist](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/281108917-eff2ae1d-ce8a-4b2a-950d-8678b12da965.jpg)](https://coinlist.co) | coinlist | [Coinlist](https://coinlist.co) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://trade-docs.coinlist.co) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinmate](https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg)](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | coinmate | [CoinMate](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coinmate.docs.apiary.io) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinmetro](https://github.com/ccxt/ccxt/assets/43336371/e86f87ec-6ba3-4410-962b-f7988c5db539)](https://go.coinmetro.com/?ref=crypto24) | coinmetro | [Coinmetro](https://go.coinmetro.com/?ref=crypto24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://documenter.getpostman.com/view/3653795/SVfWN6KS) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinone](https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg)](https://coinone.co.kr) | coinone | [CoinOne](https://coinone.co.kr) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://doc.coinone.co.kr) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinsph](https://user-images.githubusercontent.com/1294454/225719995-48ab2026-4ddb-496c-9da7-0d7566617c9b.jpg)](https://coins.ph/) | coinsph | [Coins.ph](https://coins.ph/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coins-docs.github.io/rest-api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinspot](https://user-images.githubusercontent.com/1294454/28208429-3cacdf9a-6896-11e7-854e-4c79a772a30f.jpg)](https://www.coinspot.com.au/register?code=PJURCU) | coinspot | [CoinSpot](https://www.coinspot.com.au/register?code=PJURCU) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.coinspot.com.au/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![cryptocom](https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg)](https://crypto.com/exch/kdacthrnxt) | cryptocom | [Crypto.com](https://crypto.com/exch/kdacthrnxt) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![cryptomus](https://github.com/user-attachments/assets/8e0b1c48-7c01-4177-9224-f1b01d89d7e7)](https://app.cryptomus.com/signup/?ref=JRP4yj) | cryptomus | [Cryptomus](https://app.cryptomus.com/signup/?ref=JRP4yj) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://doc.cryptomus.com/personal) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![defx](https://github.com/user-attachments/assets/4e92bace-d7a9-45ea-92be-122168dc87e4)](https://app.defx.com/join/6I2CZ7) | defx | [Defx X](https://app.defx.com/join/6I2CZ7) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.defx.com/docs) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | | +| [![delta](https://user-images.githubusercontent.com/1294454/99450025-3be60a00-2931-11eb-9302-f4fd8d8589aa.jpg)](https://www.delta.exchange/app/signup/?code=IULYNB) | delta | [Delta Exchange](https://www.delta.exchange/app/signup/?code=IULYNB) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.delta.exchange) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![deribit](https://user-images.githubusercontent.com/1294454/41933112-9e2dd65a-798b-11e8-8440-5bab2959fcb8.jpg)](https://www.deribit.com/reg-1189.4038) | deribit | [Deribit](https://www.deribit.com/reg-1189.4038) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.deribit.com/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![derive](https://github.com/user-attachments/assets/f835b95f-033a-43dd-b6bb-24e698fc498c)](https://www.derive.xyz/invite/3VB0B) | derive | [derive](https://www.derive.xyz/invite/3VB0B) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.derive.xyz/docs/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![digifinex](https://user-images.githubusercontent.com/51840849/87443315-01283a00-c5fe-11ea-8628-c2a0feaf07ac.jpg)](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | digifinex | [DigiFinex](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.digifinex.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![ellipx](https://github.com/user-attachments/assets/e07c3f40-281c-4cdf-bacf-fa1c58218a2c)](https://www.ellipx.com) | ellipx | [Ellipx](https://www.ellipx.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.google.com/document/d/1ZXzTQYffKE_EglTaKptxGQERRnunuLHEMmar7VC9syM) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![exmo](https://user-images.githubusercontent.com/1294454/27766491-1b0ea956-5eda-11e7-9225-40d67b481b8d.jpg)](https://exmo.me/?ref=131685) | exmo | [EXMO](https://exmo.me/?ref=131685) | [![API Version 1.1](https://img.shields.io/badge/1.1-lightgray)](https://exmo.me/en/api_doc?ref=131685) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![fmfwio](https://user-images.githubusercontent.com/1294454/159177712-b685b40c-5269-4cea-ac83-f7894c49525d.jpg)](https://fmfw.io/referral/da948b21d6c92d69) | fmfwio | [FMFW.io](https://fmfw.io/referral/da948b21d6c92d69) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.fmfw.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![gate](https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85)](https://www.gate.io/signup/2436035) | gate | [Gate.io](https://www.gate.io/signup/2436035) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://www.gate.io/docs/developers/apiv4/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![gemini](https://user-images.githubusercontent.com/1294454/27816857-ce7be644-6096-11e7-82d6-3c257263229c.jpg)](https://gemini.com/) | gemini | [Gemini](https://gemini.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.gemini.com/rest-api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hashkey](https://github.com/user-attachments/assets/6dd6127b-cc19-4a13-9b29-a98d81f80e98)](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | hashkey | [HashKey Global](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://hashkeyglobal-apidoc.readme.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hitbtc](https://user-images.githubusercontent.com/1294454/27766555-8eaec20e-5edc-11e7-9c5b-6dc69fc42f5e.jpg)](https://hitbtc.com/?ref_id=5a5d39a65d466) | hitbtc | [HitBTC](https://hitbtc.com/?ref_id=5a5d39a65d466) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.hitbtc.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![hollaex](https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg)](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | hollaex | [HollaEx](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://apidocs.hollaex.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![htx](https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg)](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | htx | [HTX](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://huobiapi.github.io/docs/spot/v1/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![huobijp](https://user-images.githubusercontent.com/1294454/85734211-85755480-b705-11ea-8b35-0b7f1db33a2f.jpg)](https://www.huobi.co.jp/register/?invite_code=znnq3) | huobijp | [Huobi Japan](https://www.huobi.co.jp/register/?invite_code=znnq3) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api-doc.huobi.co.jp) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hyperliquid](https://github.com/ccxt/ccxt/assets/43336371/b371bc6c-4a8c-489f-87f4-20a913dd8d4b)](https://app.hyperliquid.xyz/) | hyperliquid | [Hyperliquid](https://app.hyperliquid.xyz/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![idex](https://user-images.githubusercontent.com/51840849/94481303-2f222100-01e0-11eb-97dd-bc14c5943a86.jpg)](https://idex.io) | idex | [IDEX](https://idex.io) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api-docs-v3.idex.io/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![independentreserve](https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg)](https://www.independentreserve.com) | independentreserve | [Independent Reserve](https://www.independentreserve.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.independentreserve.com/API) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![indodax](https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg)](https://indodax.com/ref/testbitcoincoid/1) | indodax | [INDODAX](https://indodax.com/ref/testbitcoincoid/1) | [![API Version 2.0](https://img.shields.io/badge/2.0-lightgray)](https://github.com/btcid/indodax-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![kraken](https://user-images.githubusercontent.com/51840849/76173629-fc67fb00-61b1-11ea-84fe-f2de582f58a3.jpg)](https://www.kraken.com) | kraken | [Kraken](https://www.kraken.com) | [![API Version 0](https://img.shields.io/badge/0-lightgray)](https://docs.kraken.com/rest/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![krakenfutures](https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg)](https://futures.kraken.com/) | krakenfutures | [Kraken Futures](https://futures.kraken.com/) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.futures.kraken.com/#introduction) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kucoin](https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg)](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | kucoin | [KuCoin](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.kucoin.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kucoinfutures](https://user-images.githubusercontent.com/1294454/147508995-9e35030a-d046-43a1-a006-6fabd981b554.jpg)](https://futures.kucoin.com/?rcode=E5wkqe) | kucoinfutures | [KuCoin Futures](https://futures.kucoin.com/?rcode=E5wkqe) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.kucoin.com/futures) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kuna](https://user-images.githubusercontent.com/51840849/87153927-f0578b80-c2c0-11ea-84b6-74612568e9e1.jpg)](https://kuna.io?r=kunaid-gvfihe8az7o4) | kuna | [Kuna](https://kuna.io?r=kunaid-gvfihe8az7o4) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://kuna.io/documents/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![latoken](https://user-images.githubusercontent.com/1294454/61511972-24c39f00-aa01-11e9-9f7c-471f1d6e5214.jpg)](https://latoken.com/invite?r=mvgp2djk) | latoken | [Latoken](https://latoken.com/invite?r=mvgp2djk) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://api.latoken.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![lbank](https://user-images.githubusercontent.com/1294454/38063602-9605e28a-3302-11e8-81be-64b1e53c4cfb.jpg)](https://www.lbank.com/login/?icode=7QCY) | lbank | [LBank](https://www.lbank.com/login/?icode=7QCY) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.lbank.com/en-US/docs/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![luno](https://user-images.githubusercontent.com/1294454/27766607-8c1a69d8-5ede-11e7-930c-540b5eb9be24.jpg)](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.luno.com/en/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![mercado](https://user-images.githubusercontent.com/1294454/27837060-e7c58714-60ea-11e7-9192-f05e86adb83f.jpg)](https://www.mercadobitcoin.com.br) | mercado | [Mercado Bitcoin](https://www.mercadobitcoin.com.br) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.mercadobitcoin.com.br/api-doc) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![mexc](https://user-images.githubusercontent.com/1294454/137283979-8b2a818d-8633-461b-bfca-de89e8c446b2.jpg)](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | mexc | [MEXC Global](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://mexcdevelop.github.io/apidocs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![myokx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.my.okx.com/join/CCXT2023) | myokx | [MyOKX (EEA)](https://www.my.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://my.okx.com/docs-v5/en/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![ndax](https://user-images.githubusercontent.com/1294454/108623144-67a3ef00-744e-11eb-8140-75c6b851e945.jpg)](https://one.ndax.io/bfQiSL) | ndax | [NDAX](https://one.ndax.io/bfQiSL) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidoc.ndax.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![novadax](https://user-images.githubusercontent.com/1294454/92337550-2b085500-f0b3-11ea-98e7-5794fb07dd3b.jpg)](https://www.novadax.com.br/?s=ccxt) | novadax | [NovaDAX](https://www.novadax.com.br/?s=ccxt) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://doc.novadax.com/pt-BR/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![oceanex](https://user-images.githubusercontent.com/1294454/58385970-794e2d80-8001-11e9-889c-0567cd79b78e.jpg)](https://oceanex.pro/signup?referral=VE24QX) | oceanex | [OceanEx](https://oceanex.pro/signup?referral=VE24QX) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api.oceanex.pro/doc/v1) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![okcoin](https://user-images.githubusercontent.com/51840849/87295551-102fbf00-c50e-11ea-90a9-462eebba5829.jpg)](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | okcoin | [OKCoin](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okcoin.com/docs/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![okx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.okx.com/join/CCXT2023) | okx | [OKX](https://www.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okx.com/docs-v5/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![onetrading](https://github.com/ccxt/ccxt/assets/43336371/bdbc26fd-02f2-4ca7-9f1e-17333690bb1c)](https://onetrading.com/) | onetrading | [One Trading](https://onetrading.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.onetrading.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![oxfun](https://github.com/ccxt/ccxt/assets/43336371/6a196124-c1ee-4fae-8573-962071b61a85)](https://ox.fun/register?shareAccountId=5ZUD4a7G) | oxfun | [OXFUN](https://ox.fun/register?shareAccountId=5ZUD4a7G) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.ox.fun/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![p2b](https://github.com/ccxt/ccxt/assets/43336371/8da13a80-1f0a-49be-bb90-ff8b25164755)](https://p2pb2b.com?referral=ee784c53) | p2b | [p2b](https://p2pb2b.com?referral=ee784c53) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![paradex](https://github.com/user-attachments/assets/84628770-784e-4ec4-a759-ec2fbb2244ea)](https://app.paradex.trade/r/ccxt24) | paradex | [Paradex](https://app.paradex.trade/r/ccxt24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.api.testnet.paradex.trade/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![paymium](https://user-images.githubusercontent.com/51840849/87153930-f0f02200-c2c0-11ea-9c0a-40337375ae89.jpg)](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | paymium | [Paymium](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Paymium/api-documentation) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![phemex](https://user-images.githubusercontent.com/1294454/85225056-221eb600-b3d7-11ea-930d-564d2690e3f6.jpg)](https://phemex.com/register?referralCode=EDNVJ) | phemex | [Phemex](https://phemex.com/register?referralCode=EDNVJ) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://phemex-docs.github.io/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![poloniex](https://user-images.githubusercontent.com/1294454/27766817-e9456312-5ee6-11e7-9b3c-b628ca5626a5.jpg)](https://poloniex.com/signup?c=UBFZJRPJ) | poloniex | [Poloniex](https://poloniex.com/signup?c=UBFZJRPJ) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://api-docs.poloniex.com/spot/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![probit](https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg)](https://www.probit.com/r/34608773) | probit | [ProBit](https://www.probit.com/r/34608773) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs-en.probit.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![timex](https://user-images.githubusercontent.com/1294454/70423869-6839ab00-1a7f-11ea-8f94-13ae72c31115.jpg)](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | timex | [TimeX](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://plasma-relay-backend.timex.io/swagger-ui/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![tokocrypto](https://user-images.githubusercontent.com/1294454/183870484-d3398d0c-f6a1-4cce-91b8-d58792308716.jpg)](https://tokocrypto.com) | tokocrypto | [Tokocrypto](https://tokocrypto.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.tokocrypto.com/apidocs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![tradeogre](https://github.com/ccxt/ccxt/assets/43336371/3aa748b7-ea44-45e9-a9e7-b1d207a2578a)](https://tradeogre.com) | tradeogre | [tradeogre](https://tradeogre.com) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://tradeogre.com/help/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![upbit](https://user-images.githubusercontent.com/1294454/49245610-eeaabe00-f423-11e8-9cba-4b0aed794799.jpg)](https://upbit.com) | upbit | [Upbit](https://upbit.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![vertex](https://github.com/ccxt/ccxt/assets/43336371/bd04a0fa-3b48-47b6-9d8b-124954d520a8)](https://app.vertexprotocol.com?referrer=0xCfC9BaB96a2eA3d3c3F031c005e82E1D9F295aC1) | vertex | [Vertex](https://app.vertexprotocol.com?referrer=0xCfC9BaB96a2eA3d3c3F031c005e82E1D9F295aC1) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.vertexprotocol.com/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![wavesexchange](https://user-images.githubusercontent.com/1294454/84547058-5fb27d80-ad0b-11ea-8711-78ac8b3c7f31.jpg)](https://wx.network) | wavesexchange | [Waves.Exchange](https://wx.network) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.wx.network) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | | +| [![whitebit](https://user-images.githubusercontent.com/1294454/66732963-8eb7dd00-ee66-11e9-849b-10d9282bb9e0.jpg)](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | whitebit | [WhiteBit](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://github.com/whitebit-exchange/api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://woox.io/register?ref=DIJT0CNL) | woo | [WOO X](https://woox.io/register?ref=DIJT0CNL) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woox.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![woofipro](https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![xt](https://user-images.githubusercontent.com/14319357/232636712-466df2fc-560a-4ca4-aab2-b1d954a58e24.jpg)](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | xt | [XT](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://doc.xt.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![yobit](https://user-images.githubusercontent.com/1294454/27766910-cdcbfdae-5eea-11e7-9859-03fea873272d.jpg)](https://www.yobit.net) | yobit | [YoBit](https://www.yobit.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.yobit.net/en/api/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![zaif](https://user-images.githubusercontent.com/1294454/27766927-39ca2ada-5eeb-11e7-972f-1b4199518ca6.jpg)](https://zaif.jp) | zaif | [Zaif](https://zaif.jp) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://techbureau-api-document.readthedocs.io/ja/latest/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![zonda](https://user-images.githubusercontent.com/1294454/159202310-a0e38007-5e7c-4ba9-a32f-c8263a0291fe.jpg)](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | zonda | [Zonda](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.zondacrypto.exchange/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | \ No newline at end of file diff --git a/docs/ccxt/wiki/FAQ.md b/docs/ccxt/wiki/FAQ.md new file mode 100644 index 0000000..c0d1394 --- /dev/null +++ b/docs/ccxt/wiki/FAQ.md @@ -0,0 +1,172 @@ +# Frequently Asked Questions + + + ## I'm trying to run the code, but it's not working, how do I fix it? + + If your question is formulated in a short manner like the above, we won't help. We don't teach programming. If you're unable to read and understand the [Manual](https://github.com/ccxt/ccxt/wiki) or you can't follow precisely the guides from the [CONTRIBUTING](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md) doc on how to report an issue, we won't help either. Read the CONTRIBUTING guides on how to report an issue and read the Manual. You should not risk anyone's money and time without reading the entire Manual very carefully. You should not risk anything if you're not used to a lot of reading with tons of details. Also, if you don't have the confidence with the programming language you're using, there are much better places for coding fundamentals and practice. Search for `python tutorials`, `js videos`, play with examples, this is how other people climb up the learning curve. No shortcuts, if you want to learn something. + + ## What is required to get help? + + When asking a question: + + - Use the search button for duplicates first! + - **Post your request and response in `verbose` mode!** Add `exchange.verbose = true` right before the line you're having issues with, and copypaste what you see on your screen. It's written and mentioned everywhere, in the [Troubleshooting](https://github.com/ccxt/ccxt/wiki/Manual#troubleshooting) section, in the [README](https://github.com/ccxt/ccxt/blob/master/README.md) and in many answers to similar questions among [previous issues](https://github.com/ccxt/ccxt/issues) and [pull requests](https://github.com/ccxt/ccxt/pulls). No excuses. The verbose output should include both the request and response from the exchange. + - Include the full error callstack! + - Write your programming language **and language version number** + - Write the CCXT / CCXT Pro library version number + - Which exchange it is + - Which method you're trying to call + + - **Post your code** to reproduce the problem. Make it a complete short runnable program, don't swallow the lines and make it as compact as you can (5-10 lines of code), including the exchange instantation code. Remove all irrelevant parts from it, leaving just the essence of the code to reproduce the issue. + - **DON'T POST SCREENSHOTS OF CODE OR ERRORS, POST THE OUTPUT AND CODE IN PLAIN TEXT!** + - **Surround code and output with triple backticks: ```GOOD```**. + - Don't confuse the backtick symbol (`) with the quote symbol (\'): '''BAD''' + - Don't confuse a single backtick with triple backticks: `BAD` + + - **DO NOT POST YOUR `apiKey` AND `secret`!** Keep them safe (remove them before posting)! + + ## I am calling a method and I get an error, what am I doing wrong? + + You're not reporting the issue properly ) Please, help the community to help you ) Read this and follow the steps: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue. Once again, your code to reproduce the issue and your verbose request and response **ARE REQUIRED**. *Just the error traceback, or just the response, or just the request, or just the code – is not enough!* + + ## I got an incorrect result from a method call, can you help? + + Basically the same answer as the previous question. Read and follow **precisely**: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue. Once again, your code to reproduce the issue and your verbose request and response **ARE REQUIRED**. *Just the error traceback, or just the response, or just the request, or just the code – is not enough!* + + ## Can you implement feature `foo` in exchange `bar`? + + Yes, we can. And we will, if nobody else does that before us. There's very little point in asking this type of questions, because the answer is always positive. When someone asks if we can do this or that, the question is not about our abilities, it all boils down to time and management needed for implementing all accumulated feature requests. + + Moreover, this is an open-source library which is a work in progress. This means, that this project is intended to be developed by the community of users, who are using it. What you're asking is not whether we can or cannot implement it, in fact you're actually telling us to go do that particular task and this is not how we see a voluntary collaboration. Your contributions, PRs and commits are welcome: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code. + + We don't give promises or estimates on the free open-source work. If you wish to speed it up, feel free to reach out to us via info@ccxt.trade. + + ## When will you add feature `foo` for exchange `bar` ? What's the estimated time? When should we expect this? + + We don't give promises or estimates on the open-source work. The reasoning behind this is explained in the previous paragraph. + + ## When will you add the support for an exchange requested in the Issues? + + Again, we can't promise on the dates for adding this or that exchange, due to reasons outlined above. The answer will always remain the same: _as soon as we can_. + + ## How long should I wait for a feature to be added? I need to decide whether to implement it myself or to wait for the CCXT Dev Team to implement it for me. + + Please, go for implemeting it yourself, do not wait for us. We will add it as soon as we can. Also, your contributions are very welcome: + + - https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + + ## What's your progress on adding the feature `foo` that was requested earlier? How do you do implementing exchange `bar`? + + This type of questions is usually a waste of time, because answering it usually requires too much time for context-switching, and it often takes more time to answer this question, than to actually satisfy the request with code for a new feature or a new exchange. The progress of this open-source project is also open, so, whenever you're wondering how it is doing, take a look into commit history. + + ## What is the status of this PR? Any update? + + If it is not merged, it means that the PR contains errors, that should be fixed first. If it could be merged as is – we would merge it, and you wouldn't have asked this question in the first place. The most frequent reason for not merging a PR is a violation of any of the [CONTRIBUTING guidelines](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#derived-exchange-classes). Those guidelines should be taken literally, cannot skip a single line or word from there if you want your PR to be merged quickly. Code contributions that do not break the guidelines get merged almost immediately (usually, within hours). + + ## Can you point out the errors or what should I edit in my PR to get it merged into master branch? + + Unfortunately, we don't always have the time to quickly list out each and every single error in the code that prevents it from merging. It is often easier and faster to just go and fix the error rather than explain what one should do to fix it. Most of them are already outlined in the [CONTRIBUTING guidelines](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#derived-exchange-classes). The main rule of thumb is to follow **all guidelines literally**. + + ## Hey! The fix you've uploaded is in TypeScript, would you fix JavaScript / Python / PHP as well, please? + + Our build system generates exchange-specific JavaScript, Python and PHP code for us automatically, so it is transpiled from TypeScript, and there's no need to fix all languages separately one by one. + + Thus, if it is fixed in TypeScript, it is fixed in JavaScript NPM, Python pip and PHP Composer as well. The automatic build usually takes 15-20 minutes. Just upgrade your version with `npm`, `pip` or `composer` **after the new version arrives** and you'll be fine. + + More about it here: + + - https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#multilanguage-support + - https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#transpiled-generated-files + + + + ## How to create an order with takeProfit+stopLoss? + Some exchanges support `createOrder` with the additional "attached" `stopLoss` & `takeProfit` sub-orders - view [StopLoss And TakeProfit Orders Attached To A Position](Manual.md#stoploss-and-takeprofit-orders-attached-to-a-position). + However, some exchanges might not support that feature and you will need to run separate `createOrder` methods to add conditional order (e.g. ***trigger order | stoploss order | takeprofit order**) to the already open position - view [Conditional orders](Manual.md#Conditional Orders). + You can also check them by looking at `exchange.has['createOrderWithTakeProfitAndStopLoss']`, `exchange.has['createStopLossOrder']` and `exchange.has['createTakeProfitOrder']`, however they are not as precise as `.features` property. + + ## How to create a spot market buy with cost? + To create a market-buy order with cost, first, you need to check if the exchange supports that feature (`exchange.has['createMarketBuyOrderWithCost']). + If it does, then you can use the `createMarketBuyOrderWithCost` method. + Example: + ```Python + order = await exchange.createMarketBuyOrderWithCost(symbol, cost) + ``` + +## What does the `createMarketBuyRequiresPrice` option mean? + +Many exchanges require the amount to be in the quote currency (they don't accept the base amount) when placing spot-market buy orders. In those cases, the exchange will have the option `createMarketBuyRequiresPrice` set to `true`. + +Example: If you wanted to buy BTC/USDT with a market buy-order, you would need to provide an amount = 5 USDT instead of 0.000X. We have a check to prevent errors that explicitly require the price because users will usually provide the amount in the base currency. + +So by default, if you do, `create_order(symbol, 'market,' 'buy,' 10)` will throw an error if the exchange has that option (`createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false...`). + +If the exchange requires the cost and the user provided the base amount, we need to request an extra parameter **price** and multiply them to get the cost. If you're aware of this behavior, you can simply disable `createMarketBuyOrderRequiresPrice` and pass the cost in the amount parameter, but disabling it does not mean you can place the order using the base amount instead of the quote. + +If you do `create_order(symbol, 'market', 'buy', 0.001, 20000)` ccxt will use the required price to calculate the cost by doing `0.01*20000` and send that value to the exchange. + +If you want to provide the cost directly in the amount argument, you can do `exchange.options['createMarketBuyOrderRequiresPrice'] = False` (you acknowledge that the amount will be the cost for market-buy) and then you can do `create_order(symbol, 'market', 'buy', 10)` + +This is basically to avoid a user doing this: `create_order('SHIB/USDT', market, buy, 1000000)` and thinking he's trying to buy 1kk of shib but in reality he's buying 1kk USDT worth of SHIB. For that reason, by default ccxt always accepts the base currency in the amount parameter. + +Alternatively, you can use the functions `createMarketBuyOrderWithCost`/ `createMarketSellOrderWithCost` if they are available. + + See more: [Market Buys](Manual.md#market-buys) + + ## What's the difference between trading spot and swap/perpetual futures? + Spot trading involves buying or selling a financial instrument (like a cryptocurrency) for immediate delivery. It's straightforward, involving the direct exchange of assets. + + Swap trading, on the other hand, involves derivative contracts where two parties exchange financial instruments or cash flows at a set date in the future, based on the underlying asset. Swaps are often used for leverage, speculation, or hedging and do not necessarily involve the exchange of the underlying asset until the contract expires. + + + Besides that, you will be handling contracts if you're trading swaps and not the base currency (e.g., BTC) directly, so if you create an order with `amount = 1`, the amount in BTC will vary depending on the `contractSize`. You can check the contract size by doing: + + ```Python + await exchange.loadMarkets() + symbol = 'XRP/USDT:USDT' + market = exchange.market(symbol) + print(market['contractSize']) + ``` + + ## How to place a reduceOnly order? + A reduceOnly order is a type of order that can only reduce a position, not increase it. To place a reduceOnly order, you typically use the createOrder method with a reduceOnly parameter set to true. This ensures that the order will only execute if it decreases the size of an open position, and it will either partially fill or not fill at all if executing it would increase the position size. + + +#### **Javascript** +```javascript +const params = { + 'reduceOnly': true, // set to true if you want to close a position, set to false if you want to open a new position +} +const order = await exchange.createOrder (symbol, type, side, amount, price, params) +``` +#### **Python** +```python +params = { + 'reduceOnly': True, # set to True if you want to close a position, set to False if you want to open a new position +} +order = exchange.create_order (symbol, type, side, amount, price, params) +``` +#### **PHP** +```php +$params = { + 'reduceOnly': true, // set to true if you want to close a position, set to false if you want to open a new position +} +$order = $exchange->create_order ($symbol, $type, $side, $amount, $price, $params); +``` + + + + See more: [Trailing Orders](Manual.md#trailing-orders) + + ## How to check the endpoint used by the unified method? + To check the endpoint used by a unified method in the CCXT library, you would typically need to refer to the source code of the library for the specific exchange implementation you're interested in. The unified methods in CCXT abstract away the details of the specific endpoints they interact with, so this information is not directly exposed via the library's API. For detailed inspection, you can look at the implementation of the method for the particular exchange in the CCXT library's source code on GitHub. + + See more: [Unified API](Manual.md#unified-api) + + ## How to differentiate between previousFundingRate, fundingRate and nextFundingRate in the funding rate structure? + The funding rate structure has three different funding rate values that can be returned: + 1. `previousFundingRate`refers to the most recently completed rate. + 2. `fundingRate` is the upcoming rate. This value is always changing until the funding time passes and then it becomes the previousFundingRate. + 3. `nextFundingRate` is only supported on a few exchanges and is the predicted funding rate after the upcoming rate. This value is two funding rates from now. + + As an example, say it is 12:30. The `previousFundingRate` happened at 12:00 and we're looking to see what the upcoming funding rate will be by checking the `fundingRate` value. In this example, given 4-hour intervals, the `fundingRate` will happen in the future at 4:00 and the `nextFundingRate` is the predicted rate that will happen at 8:00. diff --git a/docs/ccxt/wiki/Install.md b/docs/ccxt/wiki/Install.md new file mode 100644 index 0000000..fbb44ae --- /dev/null +++ b/docs/ccxt/wiki/Install.md @@ -0,0 +1,235 @@ +## Install + +The easiest way to install the ccxt library is to use builtin package managers: + +- [ccxt in **NPM**](http://npmjs.com/package/ccxt) (JavaScript / Node v15+) +- [ccxt in **PyPI**](https://pypi.python.org/pypi/ccxt) (Python 3) + +This library is shipped as an all-in-one module implementation with minimalistic dependencies and requirements: + +- [ccxt.js](https://github.com/ccxt/ccxt/blob/master/js/ccxt.js) in JavaScript +- [./python/](https://github.com/ccxt/ccxt/blob/master/python/) in Python (generated from JS) +- [ccxt.php](https://github.com/ccxt/ccxt/blob/master/ccxt.php) in PHP (generated from JS) + +You can also clone it into your project directory from [ccxt GitHub repository](https://github.com/ccxt/ccxt) and copy files +manually into your working directory with language extension appropriate for your environment. + +```shell +git clone https://github.com/ccxt/ccxt.git +``` + +An alternative way of installing this library is to build a custom bundle from source. Choose exchanges you need in `exchanges.cfg`. + +### JavaScript (NPM) + +JavaScript version of ccxt works both in Node and web browsers. Requires ES6 and `async/await` syntax support (Node 15+). When compiling with Webpack and Babel, make sure it is [not excluded](https://github.com/ccxt-dev/ccxt/issues/225#issuecomment-331582275) in your `babel-loader` config. + +[ccxt crypto trading library in npm](http://npmjs.com/package/ccxt) + +```shell +npm install ccxt +``` + +```javascript +var ccxt = require ('ccxt') + +console.log (ccxt.exchanges) // print all available exchanges +``` + +### JavaScript (for use with the ` +``` + +We also provide webpack minified and tree-shaken versions of the library starting from version 3.0.35 - Visit https://cdn.ccxt.com to browse the prebundled versions we distribute. + +| name | size | +|----------------|--------| +| binance.min.js | ~300kb | +| bitget.min.js | ~200kb | +| bitmart.min.js | ~200kb | +| bybit.min.js | ~300kb | +| ccxt.min.js | ~3mb | +| huobi.min.js | ~300kb | +| kucoin.min.js | ~200kb | +| mexc.min.js | ~200kb | +| okx.min.js | ~250kb | + +Note: the file sizes are subject to change. + +```html + +``` + +Here is an [example](https://cdn.ccxt.com/example.html) using a custom bybit bundle from our cdn in the browser + +```html + + + + + + + +

The current bitcoin bid on bybit is

and the best ask is

+
    + + +``` + +The default entry point for the browser is `window.ccxt` and it creates a global ccxt object: + +```javascript +console.log (ccxt.exchanges) // print all available exchanges +``` + +### Custom JavaScript Builds + +It takes time to load all scripts and resources. The problem with in-browser usage is that the entire CCXT library weighs a few megabytes which is a lot for a web application. Sometimes it is also critical for a Node app. Therefore to lower the loading time you might want to make your own custom build of CCXT for your app with just the exchanges you need. CCXT uses webpack to remove dead code paths to make the package smaller. + +Follow these steps: + +```bash +# 1. clone the repository + +git clone --depth 1 https://github.com/ccxt/ccxt.git + +# 2. go to the cloned repository + +cd ccxt + +# 3. install dependencies + +npm install + +# 4. edit exchanges.cfg for the exchanges of your interest + +echo -e "binance\nokx" > exchanges.cfg + +# 5. build the library + +npm run export-exchanges +npm run bundle-browser + +# 6a. copy the browser file to your project folder if you are buildig a web application + +cp dist/ccxt.browser.js path/to/your/html/project + +# 6b. or link against the library if you are building a Node.js application +npm link +cd path/to/your/node/project +npm link ccxt + +# 6c. directly import ccxt from the entry point +touch app.js + +# inside of app.js + +import ccxt from './js/ccxt.js' +console.log (ccxt) + +# now you can run your app like so + +node app.js +``` + +### Python + +[ccxt algotrading library in PyPI](https://pypi.python.org/pypi/ccxt) + +```shell +pip install ccxt +``` + +```python +import ccxt +print(ccxt.exchanges) # print a list of all available exchange classes +``` + +The library supports concurrent asynchronous mode with asyncio and async/await in Python 3.5.3+ + +```python +import ccxt.async_support as ccxt # link against the asynchronous version of ccxt +``` + +### PHP + +The autoloadable version of ccxt can be installed with [**Packagist/Composer**](https://packagist.org/packages/ccxt/ccxt) (PHP 8.1+). + +It can also be installed from the source code: [**`ccxt.php`**](https://raw.githubusercontent.com/ccxt/ccxt/master/php) + +It requires common PHP modules: + +- cURL +- mbstring (using UTF-8 is highly recommended) +- PCRE +- iconv +- gmp + +```php +include "ccxt.php"; +var_dump (\ccxt\Exchange::$exchanges); // print a list of all available exchange classes +``` + +The library supports concurrent asynchronous mode using tools from [ReactPHP](https://reactphp.org/) in PHP 8.1+. Read the [Manual](https://github.com/ccxt/ccxt/wiki) for more details. + +### .net/C# + +[ccxt in C# with **Nugget**](https://www.nuget.org/packages/ccxt) (netstandard 2.0 and netstandard 2.1) +```c# +using ccxt; +Console.WriteLine(ccxt.Exchanges) // check this later +``` + +### Docker + +You can get CCXT installed in a container along with all the supported languages and dependencies. This may be useful if you want to contribute to CCXT (e.g. run the build scripts and tests — please see the [Contributing](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md) document for the details on that). + +You don't need the Docker image if you're not going to develop CCXT. If you just want to use CCXT – just install it as a regular package into your project. + +Using `docker-compose` (in the cloned CCXT repository): + +```shell +docker-compose run --rm ccxt +``` + +Alternatively: + +```shell +docker build . --tag ccxt +docker run -it ccxt +``` + +## Proxy +If you are unable to obtain data from exchanges due to location restrictions read the [proxy](https://github.com/ccxt/ccxt/wiki/Manual#proxy) section. \ No newline at end of file diff --git a/docs/ccxt/wiki/Manual.md b/docs/ccxt/wiki/Manual.md new file mode 100644 index 0000000..17b7464 --- /dev/null +++ b/docs/ccxt/wiki/Manual.md @@ -0,0 +1,7347 @@ +# Overview + +The ccxt library is a collection of available crypto *exchanges* or exchange classes. Each class implements the public and private API for a particular crypto exchange. All exchanges are derived from the base Exchange class and share a set of common methods. To access a particular exchange from ccxt library you need to create an instance of corresponding exchange class. Supported exchanges are updated frequently and new exchanges are added regularly. + +The structure of the library can be outlined as follows: + +```text + User + +-------------------------------------------------------------+ + | CCXT | + +------------------------------+------------------------------+ + | Public | Private | + +=============================================================+ + │ . | + │ The Unified CCXT API | + │ . | + | loadMarkets . fetchBalance | + | fetchMarkets . createOrder | + | fetchCurrencies . cancelOrder | + | fetchTicker . fetchOrder | + | fetchTickers . fetchOrders | + | fetchOrderBook . fetchOpenOrders | + | fetchOHLCV . fetchClosedOrders | + | fetchStatus . fetchMyTrades | + | fetchTrades . deposit | + | . withdraw | + │ . | + +=============================================================+ + │ . | + | Custom Exchange API | + | (Derived Classes And Their Implicit Methods) | + │ . | + | publicGet... . privateGet... | + | publicPost... . privatePost... | + | . privatePut... | + | . privateDelete... | + | . sign | + │ . | + +=============================================================+ + │ . | + | Base Exchange Class | + │ . | + +=============================================================+ +``` + +Full public and private HTTP REST APIs for all exchanges are implemented. WebSocket implementations in JavaScript, PHP, Python are available in [CCXT Pro](https://ccxt.pro), which is a professional addon to CCXT with support for WebSocket streams. + +- [**Exchanges**](#exchanges) +- [**Markets**](#markets) +- [**Implicit API**](#implicit-api) +- [**Unified API**](#unified-api) +- [**Public API**](#public-api) +- [**Private API**](#private-api) +- [**Error Handling**](#error-handling) +- [**Troubleshooting**](#troubleshooting) +- [**CCXT Pro**](#ccxt-pro) + +## Social + +- [![Twitter](https://img.shields.io/twitter/follow/ccxt_official?style=social)](https://twitter.com/ccxt_official) Follow us on Twitter +- [![Medium](https://img.shields.io/badge/read-our%20blog-black?logo=medium)](https://medium.com/@ccxt) Read our blog on Medium +- [![Discord](https://img.shields.io/discord/690203284119617602?logo=discord&logoColor=white)](https://discord.gg/dhzSKYU) Join our Discord +- [![Telegram Chat](https://img.shields.io/badge/CCXT-Chat-blue?logo=telegram)](https://t.me/ccxt_chat) CCXT Chat on Telegram (technical support) + +- Announcement channels: +- - [![Telegram](https://img.shields.io/badge/CCXT-Channel-blue?logo=telegram)](https://t.me/ccxt_announcements) +- - [![Discord](https://img.shields.io/badge/CCXT-Channel-blue?logo=discord)](https://discord.com/channels/690203284119617602/1057748769690619984) + + +# Exchanges + +- [Instantiation](#instantiation) +- [Exchange Structure](#exchange-structure) +- [Rate Limit](#rate-limit) +The CCXT library currently supports the following 103 cryptocurrency exchange markets and trading APIs: + +|logo |id |name |ver |type |certified |pro | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|-----------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------:|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------| +| [![alpaca](https://github.com/user-attachments/assets/e9476df8-a450-4c3e-ab9a-1a7794219e1b)](https://alpaca.markets) | alpaca | [Alpaca](https://alpaca.markets) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://alpaca.markets/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![apex](https://github.com/user-attachments/assets/fef8f2f7-4265-46aa-965e-33a91881cb00)](https://omni.apex.exchange/trade) | apex | [Apex](https://omni.apex.exchange/trade) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api-docs.pro.apex.exchange) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![ascendex](https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1)](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | ascendex | [AscendEX](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://ascendex.github.io/ascendex-pro-api/#ascendex-pro-api-documentation) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![backpack](https://github.com/user-attachments/assets/cc04c278-679f-4554-9f72-930dd632b80f)](https://backpack.exchange/join/ccxt) | backpack | [Backpack](https://backpack.exchange/join/ccxt) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.backpack.exchange/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bequant](https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867)](https://bequant.io/referral/dd104e3bee7634ec) | bequant | [Bequant](https://bequant.io/referral/dd104e3bee7634ec) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.bequant.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bigone](https://github.com/user-attachments/assets/4e5cfd53-98cc-4b90-92cd-0d7b512653d1)](https://b1.run/users/new?code=D3LLBVFT) | bigone | [BigONE](https://b1.run/users/new?code=D3LLBVFT) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://open.big.one/docs/api.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![binance](https://github.com/user-attachments/assets/e9419b93-ccb0-46aa-9bff-c883f096274b)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binance | [Binance](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://developers.binance.com/en) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binancecoinm](https://github.com/user-attachments/assets/387cfc4e-5f33-48cd-8f5c-cd4854dabf0c)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binancecoinm | [Binance COIN-M](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://binance-docs.github.io/apidocs/delivery/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binanceus](https://github.com/user-attachments/assets/a9667919-b632-4d52-a832-df89f8a35e8c)](https://www.binance.us/?ref=35005074) | binanceus | [Binance US](https://www.binance.us/?ref=35005074) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/binance-us/binance-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binanceusdm](https://github.com/user-attachments/assets/871cbea7-eebb-4b28-b260-c1c91df0487a)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binanceusdm | [Binance USDⓈ-M](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://binance-docs.github.io/apidocs/futures/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bingx](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg)](https://bingx.com/invite/OHETOM) | bingx | [BingX](https://bingx.com/invite/OHETOM) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://bingx-api.github.io/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bit2c](https://github.com/user-attachments/assets/db0bce50-6842-4c09-a1d5-0c87d22118aa)](https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf) | bit2c | [Bit2C](https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0baf) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.bit2c.co.il/home/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitbank](https://github.com/user-attachments/assets/9d616de0-8a88-4468-8e38-d269acab0348)](https://bitbank.cc/) | bitbank | [bitbank](https://bitbank.cc/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.bitbank.cc/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitbns](https://github.com/user-attachments/assets/a5b9a562-cdd8-4bea-9fa7-fd24c1dad3d9)](https://ref.bitbns.com/1090961) | bitbns | [Bitbns](https://ref.bitbns.com/1090961) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://bitbns.com/trade/#/api-trading/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitfinex](https://github.com/user-attachments/assets/4a8e947f-ab46-481a-a8ae-8b20e9b03178)](https://www.bitfinex.com) | bitfinex | [Bitfinex](https://www.bitfinex.com) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitfinex.com/v2/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitflyer](https://github.com/user-attachments/assets/d0217747-e54d-4533-8416-0d553dca74bb)](https://bitflyer.com) | bitflyer | [bitFlyer](https://bitflyer.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://lightning.bitflyer.com/docs?lang=en) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitget](https://github.com/user-attachments/assets/fbaa10cc-a277-441d-a5b7-997dd9a87658)](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | bitget | [Bitget](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitget.com/api-doc/common/intro) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bithumb](https://github.com/user-attachments/assets/c9e0eefb-4777-46b9-8f09-9d7f7c4af82d)](https://www.bithumb.com) | bithumb | [Bithumb](https://www.bithumb.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidocs.bithumb.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitmart](https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitmex](https://github.com/user-attachments/assets/c78425ab-78d5-49d6-bd14-db7734798f04)](https://www.bitmex.com/app/register/NZTR1q) | bitmex | [BitMEX](https://www.bitmex.com/app/register/NZTR1q) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.bitmex.com/app/apiOverview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitopro](https://github.com/user-attachments/assets/affc6337-b95a-44bf-aacd-04f9722364f6)](https://www.bitopro.com) | bitopro | [BitoPro](https://www.bitopro.com) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://github.com/bitoex/bitopro-offical-api-docs/blob/master/v3-1/rest-1/rest.md) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitrue](https://github.com/user-attachments/assets/67abe346-1273-461a-bd7c-42fa32907c8e)](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | bitrue | [Bitrue](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Bitrue-exchange/bitrue-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitso](https://github.com/user-attachments/assets/178c8e56-9054-4107-b192-5e5053d4f975)](https://bitso.com/?ref=itej) | bitso | [Bitso](https://bitso.com/?ref=itej) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://bitso.com/api_info) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bitstamp](https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024)](https://www.bitstamp.net) | bitstamp | [Bitstamp](https://www.bitstamp.net) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitstamp.net/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitteam](https://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135)](https://bit.team/auth/sign-up?ref=bitboy2023) | bitteam | [BIT.TEAM](https://bit.team/auth/sign-up?ref=bitboy2023) | [![API Version 2.0.6](https://img.shields.io/badge/2.0.6-lightgray)](https://bit.team/trade/api/documentation) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bittrade](https://user-images.githubusercontent.com/1294454/85734211-85755480-b705-11ea-8b35-0b7f1db33a2f.jpg)](https://www.bittrade.co.jp/register/?invite_code=znnq3) | bittrade | [BitTrade](https://www.bittrade.co.jp/register/?invite_code=znnq3) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api-doc.bittrade.co.jp) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitvavo](https://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8)](https://bitvavo.com/?a=24F34952F7) | bitvavo | [Bitvavo](https://bitvavo.com/?a=24F34952F7) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitvavo.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![blockchaincom](https://github.com/user-attachments/assets/975e3054-3399-4363-bcee-ec3c6d63d4e8)](https://blockchain.com) | blockchaincom | [Blockchain.com](https://blockchain.com) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.blockchain.com/v3) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![blofin](https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b)](https://blofin.com/register?referral_code=f79EsS) | blofin | [BloFin](https://blofin.com/register?referral_code=f79EsS) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://blofin.com/docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![btcalpha](https://github.com/user-attachments/assets/dce49f3a-61e5-4ba0-a2fe-41d192fd0e5d)](https://btc-alpha.com/?r=123788) | btcalpha | [BTC-Alpha](https://btc-alpha.com/?r=123788) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://btc-alpha.github.io/api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![btcbox](https://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76b)](https://www.btcbox.co.jp/) | btcbox | [BtcBox](https://www.btcbox.co.jp/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://blog.btcbox.jp/en/archives/8762) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![btcmarkets](https://github.com/user-attachments/assets/8c8d6907-3873-4cc4-ad20-e22fba28247e)](https://btcmarkets.net) | btcmarkets | [BTC Markets](https://btcmarkets.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.btcmarkets.net/doc/v3) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![btcturk](https://github.com/user-attachments/assets/10e0a238-9f60-4b06-9dda-edfc7602f1d6)](https://www.btcturk.com) | btcturk | [BTCTurk](https://www.btcturk.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/BTCTrader/broker-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![bybit](https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://trade.cex.io/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbaseexchange](https://github.com/ccxt/ccxt/assets/43336371/34a65553-88aa-4a38-a714-064bd228b97e)](https://coinbase.com/) | coinbaseexchange | [Coinbase Exchange](https://coinbase.com/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.cloud.coinbase.com/exchange/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coincatch](https://github.com/user-attachments/assets/3d49065f-f05d-4573-88a2-1b5201ec6ff3)](https://partner.coincatch.cc/bg/92hy70391729607848548) | coincatch | [CoinCatch](https://partner.coincatch.cc/bg/92hy70391729607848548) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coincatch.github.io/github.io/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coincheck](https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg)](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coincheck.com/documents/exchange/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.coinex.com/api/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinmate](https://user-images.githubusercontent.com/51840849/87460806-1c9f3f00-c616-11ea-8c46-a77018a8f3f4.jpg)](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | coinmate | [CoinMate](https://coinmate.io?referral=YTFkM1RsOWFObVpmY1ZjMGREQmpTRnBsWjJJNVp3PT0) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coinmate.docs.apiary.io) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinmetro](https://github.com/ccxt/ccxt/assets/43336371/e86f87ec-6ba3-4410-962b-f7988c5db539)](https://go.coinmetro.com/?ref=crypto24) | coinmetro | [Coinmetro](https://go.coinmetro.com/?ref=crypto24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://documenter.getpostman.com/view/3653795/SVfWN6KS) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinone](https://user-images.githubusercontent.com/1294454/38003300-adc12fba-323f-11e8-8525-725f53c4a659.jpg)](https://coinone.co.kr) | coinone | [CoinOne](https://coinone.co.kr) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://doc.coinone.co.kr) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinsph](https://user-images.githubusercontent.com/1294454/225719995-48ab2026-4ddb-496c-9da7-0d7566617c9b.jpg)](https://coins.ph/) | coinsph | [Coins.ph](https://coins.ph/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coins-docs.github.io/rest-api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![coinspot](https://user-images.githubusercontent.com/1294454/28208429-3cacdf9a-6896-11e7-854e-4c79a772a30f.jpg)](https://www.coinspot.com.au/register?code=PJURCU) | coinspot | [CoinSpot](https://www.coinspot.com.au/register?code=PJURCU) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.coinspot.com.au/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![cryptocom](https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg)](https://crypto.com/exch/kdacthrnxt) | cryptocom | [Crypto.com](https://crypto.com/exch/kdacthrnxt) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![cryptomus](https://github.com/user-attachments/assets/8e0b1c48-7c01-4177-9224-f1b01d89d7e7)](https://app.cryptomus.com/signup/?ref=JRP4yj) | cryptomus | [Cryptomus](https://app.cryptomus.com/signup/?ref=JRP4yj) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://doc.cryptomus.com/personal) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![defx](https://github.com/user-attachments/assets/4e92bace-d7a9-45ea-92be-122168dc87e4)](https://app.defx.com/join/6I2CZ7) | defx | [Defx X](https://app.defx.com/join/6I2CZ7) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.defx.com/docs) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | | +| [![delta](https://user-images.githubusercontent.com/1294454/99450025-3be60a00-2931-11eb-9302-f4fd8d8589aa.jpg)](https://www.delta.exchange/app/signup/?code=IULYNB) | delta | [Delta Exchange](https://www.delta.exchange/app/signup/?code=IULYNB) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.delta.exchange) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![deribit](https://user-images.githubusercontent.com/1294454/41933112-9e2dd65a-798b-11e8-8440-5bab2959fcb8.jpg)](https://www.deribit.com/reg-1189.4038) | deribit | [Deribit](https://www.deribit.com/reg-1189.4038) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.deribit.com/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![derive](https://github.com/user-attachments/assets/f835b95f-033a-43dd-b6bb-24e698fc498c)](https://www.derive.xyz/invite/3VB0B) | derive | [derive](https://www.derive.xyz/invite/3VB0B) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.derive.xyz/docs/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![digifinex](https://user-images.githubusercontent.com/51840849/87443315-01283a00-c5fe-11ea-8628-c2a0feaf07ac.jpg)](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | digifinex | [DigiFinex](https://www.digifinex.com/en-ww/from/DhOzBg?channelCode=ljaUPp) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.digifinex.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![exmo](https://user-images.githubusercontent.com/1294454/27766491-1b0ea956-5eda-11e7-9225-40d67b481b8d.jpg)](https://exmo.me/?ref=131685) | exmo | [EXMO](https://exmo.me/?ref=131685) | [![API Version 1.1](https://img.shields.io/badge/1.1-lightgray)](https://exmo.me/en/api_doc?ref=131685) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![fmfwio](https://user-images.githubusercontent.com/1294454/159177712-b685b40c-5269-4cea-ac83-f7894c49525d.jpg)](https://fmfw.io/referral/da948b21d6c92d69) | fmfwio | [FMFW.io](https://fmfw.io/referral/da948b21d6c92d69) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.fmfw.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![foxbit](https://github.com/user-attachments/assets/1f8faca2-ae2f-4222-b33e-5671e7d873dd)](https://app.foxbit.com.br) | foxbit | [Foxbit](https://app.foxbit.com.br) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.foxbit.com.br) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![gate](https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85)](https://www.gate.io/signup/2436035) | gate | [Gate.io](https://www.gate.io/signup/2436035) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://www.gate.io/docs/developers/apiv4/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![gemini](https://user-images.githubusercontent.com/1294454/27816857-ce7be644-6096-11e7-82d6-3c257263229c.jpg)](https://gemini.com/) | gemini | [Gemini](https://gemini.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.gemini.com/rest-api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hashkey](https://github.com/user-attachments/assets/6dd6127b-cc19-4a13-9b29-a98d81f80e98)](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | hashkey | [HashKey Global](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://hashkeyglobal-apidoc.readme.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hibachi](https://github.com/user-attachments/assets/7301bbb1-4f27-4167-8a55-75f74b14e973)](hibachi.xyz/r/ZBL2YFWIHU) | hibachi | [Hibachi](hibachi.xyz/r/ZBL2YFWIHU) | [![API Version *](https://img.shields.io/badge/*-lightgray)](undefined) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | | +| [![hitbtc](https://user-images.githubusercontent.com/1294454/27766555-8eaec20e-5edc-11e7-9c5b-6dc69fc42f5e.jpg)](https://hitbtc.com/?ref_id=5a5d39a65d466) | hitbtc | [HitBTC](https://hitbtc.com/?ref_id=5a5d39a65d466) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.hitbtc.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![hollaex](https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg)](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | hollaex | [HollaEx](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://apidocs.hollaex.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![htx](https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg)](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | htx | [HTX](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://huobiapi.github.io/docs/spot/v1/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hyperliquid](https://github.com/ccxt/ccxt/assets/43336371/b371bc6c-4a8c-489f-87f4-20a913dd8d4b)](https://app.hyperliquid.xyz/) | hyperliquid | [Hyperliquid](https://app.hyperliquid.xyz/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![independentreserve](https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg)](https://www.independentreserve.com) | independentreserve | [Independent Reserve](https://www.independentreserve.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.independentreserve.com/API) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![indodax](https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg)](https://indodax.com/ref/testbitcoincoid/1) | indodax | [INDODAX](https://indodax.com/ref/testbitcoincoid/1) | [![API Version 2.0](https://img.shields.io/badge/2.0-lightgray)](https://github.com/btcid/indodax-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![kraken](https://user-images.githubusercontent.com/51840849/76173629-fc67fb00-61b1-11ea-84fe-f2de582f58a3.jpg)](https://www.kraken.com) | kraken | [Kraken](https://www.kraken.com) | [![API Version 0](https://img.shields.io/badge/0-lightgray)](https://docs.kraken.com/rest/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![krakenfutures](https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg)](https://futures.kraken.com/) | krakenfutures | [Kraken Futures](https://futures.kraken.com/) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.kraken.com/api/docs/futures-api/trading/market-data/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kucoin](https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg)](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | kucoin | [KuCoin](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.kucoin.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kucoinfutures](https://user-images.githubusercontent.com/1294454/147508995-9e35030a-d046-43a1-a006-6fabd981b554.jpg)](https://futures.kucoin.com/?rcode=E5wkqe) | kucoinfutures | [KuCoin Futures](https://futures.kucoin.com/?rcode=E5wkqe) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.kucoin.com/futures) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![latoken](https://user-images.githubusercontent.com/1294454/61511972-24c39f00-aa01-11e9-9f7c-471f1d6e5214.jpg)](https://latoken.com/invite?r=mvgp2djk) | latoken | [Latoken](https://latoken.com/invite?r=mvgp2djk) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://api.latoken.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![lbank](https://user-images.githubusercontent.com/1294454/38063602-9605e28a-3302-11e8-81be-64b1e53c4cfb.jpg)](https://www.lbank.com/login/?icode=7QCY) | lbank | [LBank](https://www.lbank.com/login/?icode=7QCY) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.lbank.com/en-US/docs/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![luno](https://user-images.githubusercontent.com/1294454/27766607-8c1a69d8-5ede-11e7-930c-540b5eb9be24.jpg)](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.luno.com/en/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![mercado](https://user-images.githubusercontent.com/1294454/27837060-e7c58714-60ea-11e7-9192-f05e86adb83f.jpg)](https://www.mercadobitcoin.com.br) | mercado | [Mercado Bitcoin](https://www.mercadobitcoin.com.br) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.mercadobitcoin.com.br/api-doc) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![mexc](https://user-images.githubusercontent.com/1294454/137283979-8b2a818d-8633-461b-bfca-de89e8c446b2.jpg)](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | mexc | [MEXC Global](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://mexcdevelop.github.io/apidocs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![modetrade](https://github.com/user-attachments/assets/cec2b7f1-3b2b-4502-971b-447ee1937d6b)](https://trade.mode.network?ref=MODETRADE) | modetrade | [Mode Trade](https://trade.mode.network?ref=MODETRADE) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](undefined) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![myokx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.my.okx.com/join/CCXT2023) | myokx | [MyOKX (EEA)](https://www.my.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://my.okx.com/docs-v5/en/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![ndax](https://user-images.githubusercontent.com/1294454/108623144-67a3ef00-744e-11eb-8140-75c6b851e945.jpg)](https://one.ndax.io/bfQiSL) | ndax | [NDAX](https://one.ndax.io/bfQiSL) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidoc.ndax.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![novadax](https://user-images.githubusercontent.com/1294454/92337550-2b085500-f0b3-11ea-98e7-5794fb07dd3b.jpg)](https://www.novadax.com.br/?s=ccxt) | novadax | [NovaDAX](https://www.novadax.com.br/?s=ccxt) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://doc.novadax.com/pt-BR/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![oceanex](https://user-images.githubusercontent.com/1294454/58385970-794e2d80-8001-11e9-889c-0567cd79b78e.jpg)](https://oceanex.pro/signup?referral=VE24QX) | oceanex | [OceanEx](https://oceanex.pro/signup?referral=VE24QX) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api.oceanex.pro/doc/v1) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![okcoin](https://user-images.githubusercontent.com/51840849/87295551-102fbf00-c50e-11ea-90a9-462eebba5829.jpg)](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | okcoin | [OKCoin](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okcoin.com/docs/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![okx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.okx.com/join/CCXT2023) | okx | [OKX](https://www.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okx.com/docs-v5/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![okxus](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.app.okx.com/join/CCXT2023) | okxus | [OKX (US)](https://www.app.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://app.okx.com/docs-v5/en/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![onetrading](https://github.com/ccxt/ccxt/assets/43336371/bdbc26fd-02f2-4ca7-9f1e-17333690bb1c)](https://onetrading.com/) | onetrading | [One Trading](https://onetrading.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.onetrading.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![oxfun](https://github.com/ccxt/ccxt/assets/43336371/6a196124-c1ee-4fae-8573-962071b61a85)](https://ox.fun/register?shareAccountId=5ZUD4a7G) | oxfun | [OXFUN](https://ox.fun/register?shareAccountId=5ZUD4a7G) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.ox.fun/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![p2b](https://github.com/ccxt/ccxt/assets/43336371/8da13a80-1f0a-49be-bb90-ff8b25164755)](https://p2pb2b.com?referral=ee784c53) | p2b | [p2b](https://p2pb2b.com?referral=ee784c53) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![paradex](https://github.com/user-attachments/assets/84628770-784e-4ec4-a759-ec2fbb2244ea)](https://app.paradex.trade/r/ccxt24) | paradex | [Paradex](https://app.paradex.trade/r/ccxt24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.api.testnet.paradex.trade/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![paymium](https://user-images.githubusercontent.com/51840849/87153930-f0f02200-c2c0-11ea-9c0a-40337375ae89.jpg)](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | paymium | [Paymium](https://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Paymium/api-documentation) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![phemex](https://user-images.githubusercontent.com/1294454/85225056-221eb600-b3d7-11ea-930d-564d2690e3f6.jpg)](https://phemex.com/register?referralCode=EDNVJ) | phemex | [Phemex](https://phemex.com/register?referralCode=EDNVJ) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://phemex-docs.github.io/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![poloniex](https://user-images.githubusercontent.com/1294454/27766817-e9456312-5ee6-11e7-9b3c-b628ca5626a5.jpg)](https://poloniex.com/signup?c=UBFZJRPJ) | poloniex | [Poloniex](https://poloniex.com/signup?c=UBFZJRPJ) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://api-docs.poloniex.com/spot/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![probit](https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg)](https://www.probit.com/r/34608773) | probit | [ProBit](https://www.probit.com/r/34608773) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs-en.probit.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![timex](https://user-images.githubusercontent.com/1294454/70423869-6839ab00-1a7f-11ea-8f94-13ae72c31115.jpg)](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | timex | [TimeX](https://timex.io/?refcode=1x27vNkTbP1uwkCck) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://plasma-relay-backend.timex.io/swagger-ui/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![tokocrypto](https://user-images.githubusercontent.com/1294454/183870484-d3398d0c-f6a1-4cce-91b8-d58792308716.jpg)](https://tokocrypto.com) | tokocrypto | [Tokocrypto](https://tokocrypto.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.tokocrypto.com/apidocs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![toobit](https://github.com/user-attachments/assets/3fc13870-5406-431b-8be0-2aab69c4f225)](https://www.toobit.com/en-US/r?i=IFFPy0) | toobit | [Toobit](https://www.toobit.com/en-US/r?i=IFFPy0) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://toobit-docs.github.io/apidocs/spot/v1/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![upbit](https://user-images.githubusercontent.com/1294454/49245610-eeaabe00-f423-11e8-9cba-4b0aed794799.jpg)](https://upbit.com) | upbit | [Upbit](https://upbit.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![wavesexchange](https://user-images.githubusercontent.com/1294454/84547058-5fb27d80-ad0b-11ea-8711-78ac8b3c7f31.jpg)](https://wx.network) | wavesexchange | [Waves.Exchange](https://wx.network) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.wx.network) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | | +| [![whitebit](https://user-images.githubusercontent.com/1294454/66732963-8eb7dd00-ee66-11e9-849b-10d9282bb9e0.jpg)](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | whitebit | [WhiteBit](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://github.com/whitebit-exchange/api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://woox.io/register?ref=DIJT0CNL) | woo | [WOO X](https://woox.io/register?ref=DIJT0CNL) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woox.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![woofipro](https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![xt](https://user-images.githubusercontent.com/14319357/232636712-466df2fc-560a-4ca4-aab2-b1d954a58e24.jpg)](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | xt | [XT](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://doc.xt.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![yobit](https://user-images.githubusercontent.com/1294454/27766910-cdcbfdae-5eea-11e7-9859-03fea873272d.jpg)](https://www.yobit.net) | yobit | [YoBit](https://www.yobit.net) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://www.yobit.net/en/api/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![zaif](https://user-images.githubusercontent.com/1294454/27766927-39ca2ada-5eeb-11e7-972f-1b4199518ca6.jpg)](https://zaif.jp) | zaif | [Zaif](https://zaif.jp) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://techbureau-api-document.readthedocs.io/ja/latest/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | +| [![zonda](https://user-images.githubusercontent.com/1294454/159202310-a0e38007-5e7c-4ba9-a32f-c8263a0291fe.jpg)](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | zonda | [Zonda](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.zondacrypto.exchange/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | | + + + +Besides making basic market and limit orders, some exchanges offer margin trading (leverage), various derivatives (like futures contracts and options) and also have [dark pools](https://en.wikipedia.org/wiki/Dark_pool), [OTC](https://en.wikipedia.org/wiki/Over-the-counter_(finance)) (over-the-counter trading), merchant APIs and much more. + +## Instantiation + +To connect to an exchange and start trading you need to instantiate an exchange class from ccxt library. + +To get the full list of ids of supported exchanges programmatically: + + +#### **Javascript** +```javascript +const ccxt = require ('ccxt') +console.log (ccxt.exchanges) +``` +#### **Python** +```python +import ccxt +print (ccxt.exchanges) +``` +#### **PHP** +```php +include 'ccxt.php'; +var_dump (\ccxt\Exchange::$exchanges); +``` + + +An exchange can be instantiated like shown in the examples below: + + +#### **Javascript** +```javascript +const ccxt = require ('ccxt') +let exchange = new ccxt.kraken () // default id +let kraken1 = new ccxt.kraken ({ id: 'kraken1' }) +let kraken2 = new ccxt.kraken ({ id: 'kraken2' }) +let id = 'coinbasepro' +let coinbasepro = new ccxt[id] (); + +// from variable id +const exchangeId = 'binance' + , exchangeClass = ccxt[exchangeId] + , exchange = new exchangeClass ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) +``` +#### **Python** +```python +import ccxt +exchange = ccxt.okcoin () # default id +okcoin1 = ccxt.okcoin ({ 'id': 'okcoin1' }) +okcoin2 = ccxt.okcoin ({ 'id': 'okcoin2' }) +id = 'btcchina' +btcchina = eval ('ccxt.%s ()' % id) +coinbasepro = getattr (ccxt, 'coinbasepro') () + +# from variable id +exchange_id = 'binance' +exchange_class = getattr(ccxt, exchange_id) +exchange = exchange_class({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) +``` +#### **PHP** + +The ccxt library in PHP uses builtin UTC/GMT time functions, therefore you are required to set date.timezone in your php.ini or call [date_default_timezone_set()](http://php.net/manual/en/function.date-default-timezone-set.php) function before using the PHP version of the library. The recommended timezone setting is `"UTC"`. + +```php +// PHP +date_default_timezone_set('UTC'); +include 'ccxt.php'; +$bitfinex = new \ccxt\bitfinex(); // default id +$bitfinex1 = new \ccxt\bitfinex(array('id' => 'bitfinex1')); +$bitfinex2 = new \ccxt\bitfinex(array('id' => 'bitfinex2')); +$id = 'kraken'; +$exchange = '\\ccxt\\' . $id; +$kraken = new $exchange(); + +// from variable id +$exchange_id = 'binance'; +$exchange_class = "\\ccxt\\$exchange_id"; +$exchange = new $exchange_class(array( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', +)); +``` + + +### Features + +Major exchanges have the `.features` property available, where you can see what methods and functionalities are supported for each market-type (if any method is set to `null/undefined` it means method is "not supported" by the exchange) + +*this feature is currently a work in progress and might be incomplete, feel free to report any issues you find in it* + +```Javascript +const exchange = new ccxt.binance() +console.log(exchange.features); + +// outputs like: +{ + spot: { + sandbox: true, // whether testnet is supported + createOrder: { + triggerPrice: true, // if trigger order is supported + triggerPriceType: undefined, // if trigger price type is supported (last, mark, index) + triggerDirection: false, // if trigger direction is supported (up, down) + stopLossPrice: true, // if stop-loss order is supported (read "Stop Loss Orders" paragraph) + takeProfitPrice: true, // if take-profit order is supported + attachedStopLossTakeProfit: { + triggerPriceType: { + last: true, + mark: true, + index: true, + }, + price: true, // whether 'limit' price can be used (instead of market order) + }, + marginMode: true, // if `marginMode` param is supported (cross, isolated) + timeInForce: { // supported TIF types + GTC: true, + IOC: true, + FOK: true, + PO: true, + GTD: false + }, + hedged: false, // if `hedged` param is supported (true, false) + leverage: false, // if `leverage` param is supported (true, false) + selfTradePrevention: true, // if `selfTradePrevention` param is supported (true, false) + trailing: true, // if trailing order is supported + iceberg: true, // if iceberg order is supported + marketBuyByCost: true, // if creating market buy order is possible with `cost` param + marketBuyRequiresPrice: true,// if creating market buy order (if 'cost' not used) requires `price` param to be set + }, + createOrders: { + 'max': 50, // if batch order creation is supported + }, + fetchMyTrades: { + limit: 1000, // max limit per call + daysBack: undefined, // max historical period that can be accessed + untilDays: 1 // if `until` param is supported, then this is permitted distance from `since` + }, + fetchOrder: { + marginMode: true, // when supported, margin order should be fetched with this flag + trigger: false, // similar as above + trailing: false // similar as above + }, + // other methods have similar properties + fetchOpenOrders: { + limit: undefined, + marginMode: true, + trigger: false, + trailing: false + }, + fetchOrders: { + limit: 1000, + daysBack: undefined, + untilDays: 10000, + marginMode: true, + trigger: false, + trailing: false + }, + fetchClosedOrders: { + limit: 1000, + daysBackClosed: undefined, // max days-back for closed orders + daysBackCanceled: undefined, // max days-back for canceled orders + untilDays: 10000, + marginMode: true, + trigger: false, + trailing: false + }, + fetchOHLCV: { + paginate: true, + limit: 1000 + } + }, + swap: { + linear: { ... }, // similar to above dict + inverse: { ... }, // similar to above dict + } + future: { + linear: { ... }, // similar to above dict + inverse: { ... }, // similar to above dict + } +} +``` + + +### Overriding Exchange Properties Upon Instantiation + +Most of exchange properties as well as specific options can be overrided upon exchange class instantiation or afterwards, like shown below: + + + +#### **Javascript** +```javascript + +const exchange = new ccxt.binance ({ + 'rateLimit': 10000, // unified exchange property + 'headers': { + 'YOUR_CUSTOM_HTTP_HEADER': 'YOUR_CUSTOM_VALUE', + }, + 'options': { + 'adjustForTimeDifference': true, // exchange-specific option + } +}) +exchange.options['adjustForTimeDifference'] = false +``` + + +#### **Python** +```python +exchange = ccxt.binance ({ + 'rateLimit': 10000, # unified exchange property + 'headers': { + 'YOUR_CUSTOM_HTTP_HEADER': 'YOUR_CUSTOM_VALUE', + }, + 'options': { + 'adjustForTimeDifference': True, # exchange-specific option + } +}) +exchange.options['adjustForTimeDifference'] = False +``` + +#### **PHP** +```php +$exchange_id = 'binance'; +$exchange_class = "\\ccxt\\$exchange_id"; +$exchange = new $exchange_class(array( + 'rateLimit' => 10000, // unified exchange property + 'headers' => array( + 'YOUR_CUSTOM_HTTP_HEADER' => 'YOUR_CUSTOM_VALUE', + ), + 'options' => array( + 'adjustForTimeDifference' => true, // exchange-specific option + ), +)); +$exchange->options['adjustForTimeDifference'] = false; +``` + + +### Overriding Exchange Methods + +In all CCXT-supported languages, you can override instance methods during runtime: + + + +#### **Javascript** +```javascript + +const ex = new ccxt.binance (); +ex.fetch_ticker = function (symbol, params = {}) { + // your codes go here +}; +console.log (ex.fetch_ticker('BTC/USDT')); +``` +#### **Python** +```python +ex = ccxt.binance() +def my_overload(symbol, params = {}): + # your codes go here + +ex.fetch_ticker = my_overload +print(ex.fetch_ticker('BTC/USDT')) +``` + +#### **PHP** +```php +$ex = new \ccxt\binance(); +$ex->add_method('fetch_ticker', function($symbol, $params = []) { + // your codes go here +}); +var_dump($ex->call_method('fetch_ticker', ['BTC/USDT'])); +``` + + + + +### Testnets And Sandbox Environments + +Some exchanges also offer separate APIs for testing purposes that allows developers to trade virtual money for free and test out their ideas. Those APIs are called _"testnets", "sandboxes" or "staging environments"_ (with virtual testing assets) as opposed to _"mainnets" and "production environments"_ (with real assets). Most often a sandboxed API is a clone of a production API, so, it's literally the same API, except for the URL to the exchange server. + +CCXT unifies that aspect and allows the user to switch to the exchange's sandbox (if supported by the underlying exchange). +To switch to the sandbox one has to call the `exchange.setSandboxMode (true)` or `exchange.set_sandbox_mode(true)` **immediately after creating the exchange before any other call**! + + + +#### **Javascript** +```javascript +const exchange = new ccxt.binance (config) +exchange.setSandboxMode (true) // enable sandbox mode +``` + +#### **Python** +```python +exchange = ccxt.binance(config) +exchange.set_sandbox_mode(True) # enable sandbox mode +``` + +#### **PHP** +```php +$exchange = new \ccxt\binance($config); +$exchange->set_sandbox_mode(true); // enable sandbox mode +``` + + + +- The `exchange.setSandboxMode (true) / exchange.set_sandbox_mode (True)` has to be your first call immediately after creating the exchange (before any other calls) +- To obtain the [API keys](#authentication) to the sandbox the user has to register with the sandbox website of the exchange in question and create a sandbox keypair +- **Sandbox keys are not interchangeable with production keys!** + +## Exchange Structure + +Every exchange has a set of properties and methods, most of which you can override by passing an associative array of params to an exchange constructor. You can also make a subclass and override everything. + +Here's an overview of generic exchange properties with values added for example: + +```javascript +{ + 'id': 'exchange' // lowercase string exchange id + 'name': 'Exchange' // human-readable string + 'countries': [ 'US', 'CN', 'EU' ], // array of ISO country codes + 'urls': { + 'api': 'https://api.example.com/data', // string or dictionary of base API URLs + 'www': 'https://www.example.com' // string website URL + 'doc': 'https://docs.example.com/api', // string URL or array of URLs + }, + 'version': 'v1', // string ending with digits + 'api': { ... }, // dictionary of api endpoints + 'has': { // exchange capabilities + 'CORS': false, + 'cancelOrder': true, + 'createDepositAddress': false, + 'createOrder': true, + 'fetchBalance': true, + 'fetchCanceledOrders': false, + 'fetchClosedOrder': false, + 'fetchClosedOrders': false, + 'fetchCurrencies': false, + 'fetchDepositAddress': false, + 'fetchMarkets': true, + 'fetchMyTrades': false, + 'fetchOHLCV': false, + 'fetchOpenOrder': false, + 'fetchOpenOrders': false, + 'fetchOrder': false, + 'fetchOrderBook': true, + 'fetchOrders': false, + 'fetchStatus': 'emulated', + 'fetchTicker': true, + 'fetchTickers': false, + 'fetchBidsAsks': false, + 'fetchTrades': true, + 'withdraw': false, + }, + 'timeframes': { // empty if the exchange.has['fetchOHLCV'] !== true + '1m': '1minute', + '1h': '1hour', + '1d': '1day', + '1M': '1month', + '1y': '1year', + }, + 'timeout': 10000, // number in milliseconds + 'rateLimit': 2000, // number in milliseconds + 'userAgent': 'ccxt/1.1.1 ...' // string, HTTP User-Agent header + 'verbose': false, // boolean, output error details + 'markets': { ... } // dictionary of markets/pairs by symbol + 'symbols': [ ... ] // sorted list of string symbols (traded pairs) + 'currencies': { ... } // dictionary of currencies by currency code + 'markets_by_id': { ... }, // dictionary of array of dictionaries (markets) by id + 'currencies_by_id': { ... }, // dictionary of dictionaries (markets) by id + 'apiKey': '92560ffae9b8a0421...', // string public apiKey (ASCII, hex, Base64, ...) + 'secret': '9aHjPmW+EtRRKN/Oi...' // string private secret key + 'password': '6kszf4aci8r', // string password + 'uid': '123456', // string user id + 'options': { ... }, // exchange-specific options + // ... other properties here ... +} +``` + +### Exchange Properties + +Below is a detailed description of each of the base exchange properties: + +- `id`: Each exchange has a default id. The id is not used for anything, it's a string literal for user-land exchange instance identification purposes. You can have multiple links to the same exchange and differentiate them by ids. Default ids are all lowercase and correspond to exchange names. + +- `name`: This is a string literal containing the human-readable exchange name. + +- `countries`: An array of string literals of 2-symbol ISO country codes, where the exchange is operating from. + +- `urls['api']`: The single string literal base URL for API calls or an associative array of separate URLs for private and public APIs. + +- `urls['www']`: The main HTTP website URL. + +- `urls['doc']`: A single string URL link to original documentation for exchange API on their website or an array of links to docs. + +- `version`: A string literal containing version identifier for current exchange API. The ccxt library will append this version string to the API Base URL upon each request. You don't have to modify it, unless you are implementing a new exchange API. The version identifier is a usually a numeric string starting with a letter 'v' in some cases, like v1.1. Do not override it unless you are implementing your own new crypto exchange class. + +- `api`: An associative array containing a definition of all API endpoints exposed by a crypto exchange. The API definition is used by ccxt to automatically construct callable instance methods for each available endpoint. + +- `has`: This is an associative array of exchange capabilities (e.g `fetchTickers`, `fetchOHLCV` or `CORS`). + +- `timeframes`: An associative array of timeframes, supported by the fetchOHLCV method of the exchange. This is only populated when `has['fetchOHLCV']` property is true. + +- `timeout`: A timeout in milliseconds for a request-response roundtrip (default timeout is 10000 ms = 10 seconds). If the response is not received in that time, the library will throw an `RequestTimeout` exception. You can leave the default timeout value or set it to a reasonable value. Hanging forever with no timeout is not your option, for sure. You don't have to override this option in general case. + +- `rateLimit`: A request rate limit in milliseconds. Specifies the required minimal delay between two consequent HTTP requests to the same exchange. The built-in rate-limiter is enabled by default and can be turned off by setting the `enableRateLimit` property to false. + +- `enableRateLimit`: A boolean (true/false) value that enables the built-in rate limiter and throttles consecutive requests. This setting is `true` (enabled) by default. **The user is required to implement own [rate limiting](#rate-limit) or leave the built-in rate limiter enabled to avoid being banned from the exchange**. + +- `userAgent`: An object to set HTTP User-Agent header to. The ccxt library will set its User-Agent by default. Some exchanges may not like it. If you are having difficulties getting a reply from an exchange and want to turn User-Agent off or use the default one, set this value to false, undefined, or an empty string. The value of `userAgent` may be overrided by HTTP `headers` property below. + +- `headers`: An associative array of HTTP headers and their values. Default value is empty `{}`. All headers will be prepended to all requests. If the `User-Agent` header is set within `headers`, it will override whatever value is set in the `userAgent` property above. + +- `verbose`: A boolean flag indicating whether to log HTTP requests to stdout (verbose flag is false by default). Python people have an alternative way of DEBUG logging with a standard pythonic logger, which is enabled by adding these two lines to the beginning of their code: + ```python + import logging + logging.basicConfig(level=logging.DEBUG) + ``` +- `returnResponseHeaders`: If set to `true`, the HTTP response headers from the exchange will be included in the `responseHeaders` property inside the `info` field of the returned result for REST API calls. This can be useful for accessing metadata such as rate limit information or exchange-specific headers. By default, this is `false` and headers are not included in the response. Note: it's only supported when response is an object and not a list or string + + +- `markets`: An associative array of markets indexed by common trading pairs or symbols. Markets should be loaded prior to accessing this property. Markets are unavailable until you call the `loadMarkets() / load_markets()` method on exchange instance. + +- `symbols`: A non-associative array (a list) of symbols available with an exchange, sorted in alphabetical order. These are the keys of the `markets` property. Symbols are loaded and reloaded from markets. This property is a convenient shorthand for all market keys. + +- `currencies`: An associative array (a dict) of currencies by codes (usually 3 or 4 letters) available with an exchange. Currencies are loaded and reloaded from markets. + +- `markets_by_id`: An associative array of arrays of markets indexed by exchange-specific ids. Typically a length one array unless there are multiple markets with the same marketId. Markets should be loaded prior to accessing this property. + +- `apiKey`: This is your public API key string literal. Most exchanges require [API keys setup](#api-keys-setup). + +- `secret`: Your private secret API key string literal. Most exchanges require this as well together with the apiKey. + +- `password`: A string literal with your password/phrase. Some exchanges require this parameter for trading, but most of them don't. + +- `uid`: A unique id of your account. This can be a string literal or a number. Some exchanges also require this for trading, but most of them don't. + +- `requiredCredentials`: A unified associative dictionary that shows which of the above API credentials are required for sending private API calls to the underlying exchange (an exchange may require a specific set of keys). + +- `options`: An exchange-specific associative dictionary containing special keys and options that are accepted by the underlying exchange and supported in CCXT. + +- `precisionMode`: The exchange decimal precision counting mode, read more about [Precision And Limits](#precision-and-limits) + +- For proxies - `proxyUrl`, `httpUrl`, `httpsUrl`, `socksProxy`, `wsProxy`, `wssProxy`, `wsSocksProxy` : An url of specific proxy. Read details in [Proxy](#proxy) section. + +See this section on [Overriding exchange properties](#overriding-exchange-properties-upon-instantiation). + +#### Exchange Metadata + +- `has`: An assoc-array containing flags for exchange capabilities, including the following: + + ```javascript + 'has': { + + 'CORS': false, // has Cross-Origin Resource Sharing enabled (works from browser) or not + + // unified methods availability flags (can be true, false, or 'emulated'): + + 'cancelOrder': true, + 'createDepositAddress': false, + 'createOrder': true, + 'fetchBalance': true, + 'fetchCanceledOrders': false, + 'fetchClosedOrder': false, + 'fetchClosedOrders': false, + 'fetchCurrencies': false, + 'fetchDepositAddress': false, + 'fetchMarkets': true, + 'fetchMyTrades': false, + 'fetchOHLCV': false, + 'fetchOpenOrder': false, + 'fetchOpenOrders': false, + 'fetchOrder': false, + 'fetchOrderBook': true, + 'fetchOrders': false, + 'fetchStatus': 'emulated', + 'fetchTicker': true, + 'fetchTickers': false, + 'fetchBidsAsks': false, + 'fetchTrades': true, + 'withdraw': false, + ... + } + ``` + + The meaning of each flag showing availability of this or that method is: + + - a value of `undefined` / `None` / `null` means the method is not currently implemented in ccxt (either ccxt has not unified it yet or the method isn't natively available from the exchange API) + - boolean `false` specifically means that the endpoint isn't natively available from the exchange API + - boolean `true` means the endpoint is natively available from the exchange API and unified in the ccxt library + - `'emulated'` string means the endpoint isn't natively available from the exchange API but reconstructed (as much as possible) by the ccxt library from other available true-methods + + For a complete list of all exchanges and their supported methods, please, refer to this example: https://github.com/ccxt/ccxt/blob/master/examples/js/exchange-capabilities.js + +## Rate Limit + +Exchanges usually impose what is called a *rate limit*. Exchanges will remember and track your user credentials and your IP address and will not allow you to query the API too frequently. They balance their load and control traffic congestion to protect API servers from (D)DoS and misuse. + +**WARNING: Stay under the rate limit to avoid ban!** + +Most exchanges allow **up to 1 or 2 requests per second**. Exchanges may temporarily restrict your access to their API or ban you for some period of time if you are too aggressive with your requests. + +**The `exchange.rateLimit` property is set to a safe default which is sub-optimal. Some exchanges may have varying rate limits for different endpoints. It is up to the user to tweak `rateLimit` according to application-specific purposes.** + +The CCXT library has a built-in experimental rate-limiter that will do the necessary throttling in background transparently to the user. **WARNING: users are responsible for at least some type of rate-limiting: either by implementing a custom algorithm or by doing it with the built-in rate-limiter.**. + +You can turn on/off the built-in rate-limiter with `.enableRateLimit` property, like so: + + + +#### **Javascript** +```javascript +// enable built-in rate limiting upon instantiation of the exchange +const exchange = new ccxt.bitfinex ({ + // 'enableRateLimit': true, // enabled by default +}) + +// or switch the built-in rate-limiter on or off later after instantiation +exchange.enableRateLimit = true // enable +exchange.enableRateLimit = false // disable +``` +#### **Python** +```python + +# enable built-in rate limiting upon instantiation of the exchange +exchange = ccxt.bitfinex({ + # 'enableRateLimit': True, # enabled by default +}) + +# or switch the built-in rate-limiter on or off later after instantiation +exchange.enableRateLimit = True # enable +exchange.enableRateLimit = False # disable +``` + +#### **PHP** +```php + +// enable built-in rate limiting upon instantiation of the exchange +$exchange = new \ccxt\bitfinex (array ( + // 'enableRateLimit' => true, // enabled by default +)); + +// or switch the built-in rate-limiter on or off later after instantiation +$exchange->enableRateLimit = true; // enable +$exchange->enableRateLimit = false; // disable +``` + + + +In case your calls hit a rate limit or get nonce errors, the ccxt library will throw an `InvalidNonce` exception, or, in some cases, one of the following types: + +- `DDoSProtection` +- `ExchangeNotAvailable` +- `ExchangeError` +- `InvalidNonce` + +A later retry is usually enough to handle that. + +### Notes On Rate Limiter +#### One Rate Limiter Per Each Exchange Instance + +The rate limiter is a property of the exchange instance, in other words, each exchange instance has its own rate limiter that is not aware of the other instances. In many cases the user should reuse the same exchange instance throughout the program. Do not use multiple instances of the same exchange with the same API keypair from the same IP address. + +```javascript +// DO NOT DO THIS! + +const binance1 = new ccxt.binance () +const binance2 = new ccxt.binance () +const binance3 = new ccxt.binance () + +while (true) { + const result = await Promise.all ([ + binance1.fetchOrderBook ('BTC/USDT'), + binance2.fetchOrderBook ('ETH/USDT'), + binance3.fetchOrderBook ('ETH/BTC'), + ]) + console.log (result) +} +``` + +Reuse the exchange instance as much as possible as shown below: + +```javascript +// DO THIS INSTEAD: + +const binance = new ccxt.binance () + +while (true) { + const result = await Promise.all ([ + binance.fetchOrderBook ('BTC/USDT'), + binance.fetchOrderBook ('ETH/USDT'), + binance.fetchOrderBook ('ETH/BTC'), + ]) + console.log (result) +} +``` + +Since the rate limiter belongs to the exchange instance, destroying the exchange instance will destroy the rate limiter as well. Among the most common pitfalls with the rate limiting is creating and dropping the exchange instance over and over again. If in your program you are creating and destroying the exchange instance (say, inside a function that is called multiple times), then you are effectively resetting the rate limiter over and over and that will eventually break the rate limits. If you are recreating the exchange instance every time instead of reusing it, CCXT will try to load the markets every time. Therefore, you will force-load the markets over and over as explained in the [Loading Markets](#loading-markets) section. Abusing the markets endpoint will eventually break the rate limiter as well. + +```javascript +// DO NOT DO THIS! + +async function tick () { + const exchange = new ccxt.binance () + const response = await exchange.fetchOrderBook ('BTC/USDT') + // ... some processing here ... + return response +} + +while (true) { + const result = await tick () + console.log (result) +} +``` + +Do not break this rule unless you really understand the inner workings of the rate-limiter and you are 100% sure you know what you're doing. In order to stay safe always reuse the exchange instance throughout your functions and methods callchain like shown below: + +```javascript +// DO THIS INSTEAD: + +async function tick (exchange) { + const response = await exchange.fetchOrderBook ('BTC/USDT') + // ... some processing here ... + return response +} + +const exchange = new ccxt.binance () +while (true) { + const result = await tick (exchange) + console.log (result) +} +``` + +### DDoS Protection By Cloudflare / Incapsula + +Some exchanges are [DDoS](https://en.wikipedia.org/wiki/Denial-of-service_attack)-protected by [Cloudflare](https://www.cloudflare.com) or [Incapsula](https://www.incapsula.com). Your IP can get temporarily blocked during periods of high load. Sometimes they even restrict whole countries and regions. In that case their servers usually return a page that states a HTTP 40x error or runs an AJAX test of your browser / captcha test and delays the reload of the page for several seconds. Then your browser/fingerprint is granted access temporarily and gets added to a whitelist or receives a HTTP cookie for further use. + +The most common symptoms for a DDoS protection problem, rate-limiting problem or for a location-based filtering issue: +- Getting `RequestTimeout` exceptions with all types of exchange methods +- Catching `ExchangeError` or `ExchangeNotAvailable` with HTTP error codes 400, 403, 404, 429, 500, 501, 503, etc.. +- Having DNS resolving issues, SSL certificate issues and low-level connectivity issues +- Getting a template HTML page instead of JSON from the exchange + +If you encounter DDoS protection errors and cannot reach a particular exchange then: + +- use a [proxy](#proxy) (this is less responsive, though) +- ask the exchange support to add you to a whitelist +- try an alternative IP within a different geographic region +- run your software in a distributed network of servers +- run your software in close proximity to the exchange (same country, same city, same datacenter, same server rack, same server) +- ... + +# Markets + +- [Currency Structure](#currency-structure) +- [Market Structure](#market-structure) +- [Precision And Limits](#precision-and-limits) +- [Loading Markets](#loading-markets) +- [Symbols And Market Ids](#symbols-and-market-ids) +- [Market Cache Force Reload](#market-cache-force-reload) + +Each exchange is a place for trading some kinds of valuables. The exchanges may use differing terms to call them: _"a currency"_, _"an asset"_, _"a coin"_, _"a token"_, _"stock"_, _"commodity"_, _"crypto"_, "fiat", etc. A place for trading one asset for another is usually called _"a market"_, _"a symbol"_, _"a trading pair"_, _"a contract"_, etc. + +In terms of the ccxt library, every exchange offers multiple **markets** within itself. Each market is defined by two or more **currencies**. The set of markets differs from exchange to exchange opening possibilities for cross-exchange and cross-market arbitrage. + +## Currency Structure + +```javascript +{ + 'id': 'btc', // string literal for referencing within an exchange + 'code': 'BTC', // uppercase unified string literal code of the currency + 'name': 'Bitcoin', // string, human-readable name, if specified + 'active': true, // boolean, currency status (tradeable and withdrawable) + 'fee': 0.123, // withdrawal fee, flat + 'precision': 8, // number of decimal digits "after the dot" (depends on exchange.precisionMode) + 'deposit': true // boolean, deposits are available + 'withdraw': true // boolean, withdraws are available + 'limits': { // value limits when placing orders on this market + 'amount': { + 'min': 0.01, // order amount should be > min + 'max': 1000, // order amount should be < max + }, + 'withdraw': { ... }, // withdrawal limits + 'deposit': {...}, + }, + 'networks': {...} // network structures indexed by unified network identifiers (ERC20, TRC20, BSC, etc) + 'info': { ... }, // the original unparsed currency info from the exchange +} +``` + +Each currency is an associative array (aka dictionary) with the following keys: + +- `id`. The string or numeric ID of the currency within the exchange. Currency ids are used inside exchanges internally to identify coins during the request/response process. +- `code`. An uppercase string code representation of a particular currency. Currency codes are used to reference currencies within the ccxt library (explained below). +- `name`. A human-readable name of the currency (can be a mix of uppercase & lowercase characters). +- `fee`. The withdrawal fee value as specified by the exchange. In most cases it means a flat fixed amount paid in the same currency. If the exchange does not specify it via public endpoints, the `fee` can be `undefined/None/null` or missing. +- `active`. A boolean indicating whether trading or funding (depositing or withdrawing) for this currency is currently possible, more about it here: [`active` status](#active-status). +- `info`. An associative array of non-common market properties, including fees, rates, limits and other general market information. The internal info array is different for each particular market, its contents depend on the exchange. +- `precision`. Precision accepted in values by exchanges upon referencing this currency. The value of this property depends on [`exchange.precisionMode`](#precision-mode). +- `limits`. The minimums and maximums for amounts (volumes), withdrawals and deposits. + +## Network Structure + +```javascript +{ + 'id': 'tron', // string literal for referencing within an exchange + 'network': 'TRC20' // unified network + 'name': 'Tron Network', // string, human-readable name, if specified + 'active': true, // boolean, currency status (tradeable and withdrawable) + 'fee': 0.123, // withdrawal fee, flat + 'precision': 8, // number of decimal digits "after the dot" (depends on exchange.precisionMode) + 'deposit': true // boolean, deposits are available + 'withdraw': true // boolean, withdraws are available + 'limits': { // value limits when placing orders on this market + 'amount': { + 'min': 0.01, // order amount should be > min + 'max': 1000, // order amount should be < max + }, + 'withdraw': { ... }, // withdrawal limits + 'deposit': {...}, // deposit limits + }, + 'info': { ... }, // the original unparsed currency info from the exchange +} +``` + +Each network is an associative array (aka dictionary) with the following keys: + +- `id`. The string or numeric ID of the network within the exchange. Network ids are used inside exchanges internally to identify networks during the request/response process. +- `network`. An uppercase string representation of a particular network. Networks are used to reference networks within the ccxt library. +- `name`. A human-readable name of the network (can be a mix of uppercase & lowercase characters). +- `fee`. The withdrawal fee value as specified by the exchange. In most cases it means a flat fixed amount paid in the same currency. If the exchange does not specify it via public endpoints, the `fee` can be `undefined/None/null` or missing. +- `active`. A boolean indicating whether trading or funding (depositing or withdrawing) for this currency is currently possible, more about it here: [`active` status](#active-status). +- `info`. An associative array of non-common market properties, including fees, rates, limits and other general market information. The internal info array is different for each particular market, its contents depend on the exchange. +- `precision`. Precision accepted in values by exchanges upon referencing this currency. The value of this property depends on [`exchange.precisionMode`](#precision-mode). +- `limits`. The minimums and maximums for amounts (volumes), withdrawals and deposits. + +## Market Structure + +```javascript +{ + 'id': 'btcusd', // string literal for referencing within an exchange + 'symbol': 'BTC/USD', // uppercase string literal of a pair of currencies + 'base': 'BTC', // uppercase string, unified base currency code, 3 or more letters + 'quote': 'USD', // uppercase string, unified quote currency code, 3 or more letters + 'baseId': 'btc', // any string, exchange-specific base currency id + 'quoteId': 'usd', // any string, exchange-specific quote currency id + 'active': true, // boolean, market status + 'type': 'spot', // spot for spot, future for expiry futures, swap for perpetual swaps, 'option' for options + 'spot': true, // whether the market is a spot market + 'margin': true, // whether the market is a margin market + 'future': false, // whether the market is a expiring future + 'swap': false, // whether the market is a perpetual swap + 'option': false, // whether the market is an option contract + 'contract': false, // whether the market is a future, a perpetual swap, or an option + 'settle': 'USDT', // the unified currency code that the contract will settle in, only set if `contract` is true + 'settleId': 'usdt', // the currencyId of that the contract will settle in, only set if `contract` is true + 'contractSize': 1, // the size of one contract, only used if `contract` is true + 'linear': true, // the contract is a linear contract (settled in quote currency) + 'inverse': false, // the contract is an inverse contract (settled in base currency) + 'expiry': 1641370465121, // the unix expiry timestamp in milliseconds, undefined for everything except market['type'] `future` + 'expiryDatetime': '2022-03-26T00:00:00.000Z', // The datetime contract will in iso8601 format + 'strike': 4000, // price at which a put or call option can be exercised + 'optionType': 'call', // call or put string, call option represents an option with the right to buy and put an option with the right to sell + // note, 'taker' and 'maker' compose extended data for markets, however it might be better to use `fetchTradingFees` for more accuracy + 'taker': 0.002, // taker fee rate, 0.002 = 0.2% + 'maker': 0.0016, // maker fee rate, 0.0016 = 0.16% + 'percentage': true, // whether the taker and maker fee rate is a multiplier or a fixed flat amount + 'tierBased': false, // whether the fee depends on your trading tier (your trading volume) + 'feeSide': 'get', // string literal can be 'get', 'give', 'base', 'quote', 'other' + 'precision': { // number of decimal digits "after the dot" + 'price': 8, // integer or float for TICK_SIZE roundingMode, might be missing if not supplied by the exchange + 'amount': 8, // integer, might be missing if not supplied by the exchange + 'cost': 8, // integer, very few exchanges actually have it + }, + 'limits': { // value limits when placing orders on this market + 'amount': { + 'min': 0.01, // order amount should be > min + 'max': 1000, // order amount should be < max + }, + 'price': { ... }, // same min/max limits for the price of the order + 'cost': { ... }, // same limits for order cost = price * amount + 'leverage': { ... }, // same min/max limits for the leverage of the order + }, + 'marginModes': { + 'cross': false, // whether pair supports cross-margin trading + 'isolated': false, // whether pair supports isolated-margin trading + }, + 'info': { ... }, // the original unparsed market info from the exchange +} +``` + +Each market is an associative array (aka dictionary) with the following keys: + +- `id`. The string or numeric ID of the market or trade instrument within the exchange. Market ids are used inside exchanges internally to identify trading pairs during the request/response process. +- `symbol`. An uppercase string code representation of a particular trading pair or instrument. This is usually written as `BaseCurrency/QuoteCurrency` with a slash as in `BTC/USD`, `LTC/CNY` or `ETH/EUR`, etc. Symbols are used to reference markets within the ccxt library (explained below). +- `base`. A unified uppercase string code of base fiat or crypto currency. This is the standardized currency code that is used to refer to that currency or token throughout CCXT and throughout the Unified CCXT API, it's the language that CCXT understands. +- `quote`. A unified uppercase string code of quoted fiat or crypto currency. +- `baseId`. An exchange-specific id of the base currency for this market, not unified. Can be any string, literally. This is communicated to the exchange using the language the exchange understands. +- `quoteId`. An exchange-specific id of the quote currency, not unified. +- `active`. A boolean indicating whether or not trading this market is currently possible, more about it here: [`active` status](#active-status). +- `maker`. Float, 0.0015 = 0.15%. Maker fees are paid when you provide liquidity to the exchange i.e. you *market-make* an order and someone else fills it. Maker fees are usually lower than taker fees. Fees can be negative, this is very common amongst derivative exchanges. A negative fee means the exchange will pay a rebate (reward) to the user for trading this market (note, 'taker' and 'maker' publicly available fees, not taking into consideration your vip-level/volume/etc. Use [`fetchTradingFees`](#fee-schedule) to get the fees specific to your account). +- `taker`. Float, 0.002 = 0.2%. Taker fees are paid when you *take* liquidity from the exchange and fill someone else's order. +- `percentage`. A boolean true/false value indicating whether `taker` and `maker` are multipliers or fixed flat amounts. +- `tierBased`. A boolean true/false value indicating whether the fee depends on your trading tier (usually, your traded volume over a period of time). +- `info`. An associative array of non-common market properties, including fees, rates, limits and other general market information. The internal info array is different for each particular market, its contents depend on the exchange. +- `precision`. Precision accepted in order values by exchanges upon order placement for price, amount and cost. (The value inside this property depend on the [`exchange.precisionMode`](#precision-mode)). +- `limits`. The minimums and maximums for prices, amounts (volumes) and costs (where cost = price * amount). +- `optionType`. The type of the option, `call` option represents an option with the right to buy and `put` an option with the right to sell. +- `strike`. Price at which an option can be bought or sold when it is exercised. + +## Active Status + +The `active` flag is typically used in [`currencies`](#currency-structure) and [`markets`](#market-structure). The exchanges might put a slightly different meaning into it. If a currency is inactive, most of the time all corresponding tickers, orderbooks and other related endpoints return empty responses, all zeroes, no data or outdated information. The user should check if the currency is `active` and [reload markets periodically](#market-cache-force-reload). + +Note: the `false` value for the `active` property doesn't always guarantee that all of the possible features like trading, withdrawing or depositing are disabled on the exchange. Likewise, neither the `true` value guarantees that all those features are enabled on the exchange. Check the underlying exchanges' documentation and the code in CCXT for the exact meaning of the `active` flag for this or that exchange. This flag is not yet supported or implemented by all markets and may be missing. + +**WARNING! The information about the fee is experimental, unstable and may be partial or not available at all.** + +## Precision And Limits + +**Do not confuse `limits` with `precision`!** Precision has nothing to do with min limits. A precision of `0.01` does not necessarily mean that a minimum limit for market is `0.01`. The opposite is also true: a min limit of `0.01` does not necessarily mean a precision is `0.01`. + +Examples: + +1. +``` +market['limits']['amount']['min'] == 0.05 && +market['precision']['amount'] == 0.0001 && +market['precision']['price'] == 0.01 +``` + + - The *amount value* should be >= 0.05: + ```diff + + good: 0.05, 0.051, 0.0501, 0.0502, ..., 0.0599, 0.06, 0.0601, ... + - bad: 0.04, 0.049, 0.0499 + ``` + - *Precision of the amount* should be up to 4 digits after dot (0.0001): + ```diff + + good: 0.05, 0.0501, ..., 0.06, ..., 0.0719, ... + - bad: 0.05001, 0.05000, 0.06001 + ``` + - *Precision of the price* should be up to 2 digits after dot (0.01): + ```diff + + good: 1.6, 1.61, 123.01, ..., 1234.56, ... + - bad: 1.601, ..., 123.012, ..., 1234.567 + ``` + - + +2. `(market['precision']['amount'] == -1)` + + A negative *precision* might only theoretically happen if exchange's `precisionMode` is `SIGNIFICANT_DIGIT` or `DECIMAL_PRECISION`. It means that the amount should be an integer multiple of 10 (to the absolute power specified): + ```diff + + good: 10, 50, ..., 110, ... 1230, ..., 1000000, ..., 1234560, ... + - bad: 9.5, ... 10.1, ..., 11, ... 200.71, ... + ``` + In case of `-2` the acceptable values would be multiple of `100` (e.g. 100, 200, ... ), and so on. + + +#### Precision Mode + +Supported precision modes in `exchange['precisionMode']` are: + +- `TICK_SIZE` – almost all exchanges use this precision mode. In this mode, the numbers in `market_or_currency['precision']` designate the minimal precision fractions (floats) for rounding or truncating. +- `SIGNIFICANT_DIGITS` – counts non-zero digits only, some exchanges (`bitfinex` and maybe a few other) implement this mode of counting decimals. With this mode of precision, the numbers in `market_or_currency['precision']` designate the Nth place of the last significant (non-zero) decimal digit after the dot. +- `DECIMAL_PLACES` (**DEPRECATED, CCXT no longer uses this mode anywhere**) – counts all digits. With this mode of precision, the numbers in `market_or_currency['precision']` designate the number of decimal digits after the dot for further rounding or truncation. + +### Notes On Precision And Limits + +The user is required to stay within all limits and precision! The values of the order should satisfy the following conditions: + +- Order `amount` >= `limits['amount']['min']` +- Order `amount` <= `limits['amount']['max']` +- Order `price` >= `limits['price']['min']` +- Order `price` <= `limits['price']['max']` +- Order `cost` (`amount * price`) >= `limits['cost']['min']` +- Order `cost` (`amount * price`) <= `limits['cost']['max']` +- Precision of `amount` must be <= `precision['amount']` +- Precision of `price` must be <= `precision['price']` + +The above values can be missing with some exchanges that don't provide info on limits from their API or don't have it implemented yet. + +### Methods For Formatting Decimals + +Each exchange has its own rounding, counting and padding modes. + +Supported rounding modes are: + +- `ROUND` – will round the last decimal digits to precision +- `TRUNCATE`– will cut off the digits after certain precision + +The decimal precision counting mode is available in the `exchange.precisionMode` property. + +#### Padding Mode + +Supported padding modes are: + +- `NO_PADDING` – default for most cases +- `PAD_WITH_ZERO` – appends zero characters up to precision + +#### Formatting To Precision + +Most of the time the user does not have to take care of precision formatting, since CCXT will handle that for the user when the user places orders or sends withdrawal requests, if the user follows the rules as described on [Precision And Limits](#precision-and-limits). However, in some cases precision-formatting details may be important, so the following methods may be useful in the userland. + +The exchange base class contains the `decimalToPrecision` method to help format values to the required decimal precision with support for different rounding, counting and padding modes. + + + +#### **Javascript** +```javascript + +function decimalToPrecision (x, roundingMode, numPrecisionDigits, countingMode = DECIMAL_PLACES, paddingMode = NO_PADDING) +``` + +#### **Python** +```python +# WARNING! The `decimal_to_precision` method is susceptible to getcontext().prec! +def decimal_to_precision(n, rounding_mode=ROUND, precision=None, counting_mode=DECIMAL_PLACES, padding_mode=NO_PADDING): +``` + +#### **PHP** +```php +function decimalToPrecision ($x, $roundingMode = ROUND, $numPrecisionDigits = null, $countingMode = DECIMAL_PLACES, $paddingMode = NO_PADDING) +``` + + + +For examples of how to use the `decimalToPrecision` to format strings and floats, please, see the following files: + +- Typescript: https://github.com/ccxt/ccxt/blob/master/ts/src/test/base/functions/test.number.ts +- JavaScript: https://github.com/ccxt/ccxt/blob/master/js/src/test/base/functions/test.number.js +- Python: https://github.com/ccxt/ccxt/blob/master/python/ccxt/test/base/test_number.py +- PHP: https://github.com/ccxt/ccxt/blob/master/php/test/base/test_number.php + +**Python WARNING! The `decimal_to_precision` method is susceptible to `getcontext().prec!`** + +For users' convenience CCXT base exchange class also implements the following methods: + + +#### **Javascript** +```javascript +function amountToPrecision (symbol, amount) +function priceToPrecision (symbol, price) +function costToPrecision (symbol, cost) +function currencyToPrecision (code, amount) +``` +#### **Python** +```python +def amount_to_precision (symbol, amount): +def price_to_precision (symbol, price): +def cost_to_precision (symbol, cost): +def currency_to_precision (code, amount): +``` +#### **PHP** +```php +function amount_to_precision($symbol, $amount) +function price_to_precision($symbol, $price) +function cost_to_precision($symbol, $cost) +function currency_to_precision($code, $amount) +``` + + +Every exchange has its own precision settings, the above methods will help format those values according to exchange-specific precision rules, in a way that is portable and agnostic of the underlying exchange. In order to make that possible, markets and currencies have to be loaded prior to formatting any values. + +**Make sure to [load the markets with `exchange.loadMarkets()`](#loading-markets) before calling these methods!** + +For example: + + + +#### **Javascript** +```javascript +await exchange.loadMarkets () +const symbol = 'BTC/USDT' +const amount = 1.2345678 // amount in base currency BTC +const price = 87654.321 // price in quote currency USDT +const formattedAmount = exchange.amountToPrecision (symbol, amount) +const formattedPrice = exchange.priceToPrecision (symbol, price) +console.log (formattedAmount, formattedPrice) +``` + + +#### **Python** +```python +exchange.load_markets() +symbol = 'BTC/USDT' +amount = 1.2345678 # amount in base currency BTC +price = 87654.321 # price in quote currency USDT +formatted_amount = exchange.amount_to_precision(symbol, amount) +formatted_price = exchange.price_to_precision(symbol, price) +print(formatted_amount, formatted_price) +``` + +#### **PHP** +```php +$exchange->load_markets(); +$symbol = 'BTC/USDT'; +$amount = 1.2345678; // amount in base currency BTC +$price = 87654.321; // price in quote currency USDT +$formatted_amount = $exchange->amount_to_precision($symbol, $amount); +$formatted_price = $exchange->price_to_precision($symbol, $price); +echo $formatted_amount, " ", $formatted_price, "\n"; +``` + + +More practical examples that describe the behavior of `exchange.precisionMode`: + +```javascript +// case A +exchange.precisionMode = ccxt.DECIMAL_PLACES +market = exchange.market (symbol) +market['precision']['amount'] === 8 // up to 8 decimals after the dot +exchange.amountToPrecision (symbol, 0.123456789) === 0.12345678 +exchange.amountToPrecision (symbol, 0.0000000000123456789) === 0.0000000 === 0.0 +``` + +```javascript +// case B +exchange.precisionMode = ccxt.TICK_SIZE +market = exchange.market (symbol) +market['precision']['amount'] === 0.00000001 // up to 0.00000001 precision +exchange.amountToPrecision (symbol, 0.123456789) === 0.12345678 +exchange.amountToPrecision (symbol, 0.0000000000123456789) === 0.00000000 === 0.0 +``` + +```javascript +// case C +exchange.precisionMode = ccxt.SIGNIFICANT_DIGITS +market = exchange.market (symbol) +market['precision']['amount'] === 8 // up to 8 significant non-zero digits +exchange.amountToPrecision (symbol, 0.0000000000123456789) === 0.000000000012345678 +exchange.amountToPrecision (symbol, 123.4567890123456789) === 123.45678 +``` + +## Loading Markets + +In most cases you are required to load the list of markets and trading symbols for a particular exchange prior to accessing other API methods. If you forget to load markets the ccxt library will do that automatically upon your first call to the unified API. It will send two HTTP requests, first for markets and then the second one for other data, sequentially. For that reason, your first call to a unified CCXT API method like fetchTicker, fetchBalance, etc will take more time, than the consequent calls, since it has to do more work loading the market information from the exchange API. See [Notes On Rate Limiter](#notes-on-rate-limiter) for more details. + +In order to load markets manually beforehand call the `loadMarkets ()` / `load_markets ()` method on an exchange instance. It returns an associative array of markets indexed by trading symbol. If you want more control over the execution of your logic, preloading markets by hand is recommended. + + + +#### **Javascript** +```javascript +(async () => { + let kraken = new ccxt.kraken () + let markets = await kraken.loadMarkets () + console.log (kraken.id, markets) +}) () +``` + +#### **Python** +```python +okcoin = ccxt.okcoin() +markets = okcoin.load_markets() +print(okcoin.id, markets) +``` + +#### **PHP** +```php +$id = 'huobipro'; +$exchange = '\\ccxt\\' . $id; +$huobipro = new $exchange(); +$markets = $huobipro->load_markets(); +var_dump($huobipro->id, $markets); +``` + + + +Apart from the market info, the `loadMarkets()` call will also load the currencies from the exchange and will cache the info in the `.markets` and the `.currencies` properties respectively. + +The user can also bypass the cache and call unified methods for fetching that information from the exchange endpoints directly, `fetchMarkets()` and `fetchCurrencies()`, though using these methods is not recommended for end-users. The recommended way to preload markets is by calling the `loadMarkets()` unified method. However, new exchange integrations are required to implement these methods if the underlying exchange has the corresponding API endpoints. + +### Sharing Markets Between Exchange Instances + +To optimize memory usage and reduce redundant API calls, you can share market data between multiple instances of the same exchange. This is especially useful when creating multiple exchange instances or when you want to reuse market data that has already been loaded. + + + +#### **Javascript** +```javascript +(async () => { + // Create first exchange instance and load markets + let exchange1 = new ccxt.binance() + await exchange1.loadMarkets() + + // Create second exchange instance + let exchange2 = new ccxt.binance() + + // Share markets from first instance to second using the setMarketsFromExchange method + exchange2.setMarketsFromExchange(exchange1) + + // Now exchange2 can use the shared markets without loading them + console.log(exchange2.symbols) // Available immediately + + // When calling loadMarkets on exchange2, it will use cached markets + await exchange2.loadMarkets() // No API call, uses shared markets +})() +``` + +#### **Python** +```python +# Create first exchange instance and load markets +exchange1 = ccxt.binance() +exchange1.load_markets() + +# Create second exchange instance +exchange2 = ccxt.binance() + +# Share markets from first instance to second using the setMarketsFromExchange method +exchange2.set_markets_from_exchange(exchange1) + +# Now exchange2 can use the shared markets without loading them +print(exchange2.symbols) # Available immediately + +# When calling load_markets on exchange2, it will use cached markets +exchange2.load_markets() # No API call, uses shared markets +``` + +#### **PHP** +```php +// Create first exchange instance and load markets +$exchange1 = new \ccxt\binance(); +$exchange1->load_markets(); + +// Create second exchange instance +$exchange2 = new \ccxt\binance(); + +// Share markets from first instance to second using the setMarketsFromExchange method +$exchange2->set_markets_from_exchange($exchange1); + +// Now exchange2 can use the shared markets without loading them +var_dump($exchange2->symbols); // Available immediately + +// When calling load_markets on exchange2, it will use cached markets +$exchange2->load_markets(); // No API call, uses shared markets +``` + +#### **Go** +```go +// Create first exchange instance and load markets +binance1 := ccxt.NewBinance(nil) +markets, err := binance1.LoadMarkets() +if err != nil { + // Handle error +} + +// Create second exchange instance +binance2 := ccxt.NewBinance(nil) + +// Share markets from first instance to second using the SetMarketsFromExchange method +binance2.SetMarketsFromExchange(binance1) + +// Now binance2 can use the shared markets without loading them +fmt.Printf("Symbols loaded: %d\n", len(binance2.GetSymbols())) +``` + +#### **C#** +```csharp +// Create first exchange instance and load markets +var binance1 = new Binance(); +await binance1.LoadMarkets(); + +// Create second exchange instance +var binance2 = new Binance(); + +// Share markets from first instance to second using the setMarketsFromExchange method +binance2.setMarketsFromExchange(binance1); + +// Now binance2 can use the shared markets without loading them +Console.WriteLine($"Symbols loaded: {binance2.symbols?.Count ?? 0}"); +``` + + + +**Benefits of Market Sharing:** +- **Memory Efficiency**: Multiple exchange instances share the same market objects in memory +- **Performance**: Eliminates redundant API calls for market data +- **Resource Conservation**: Reduces network requests and API rate limit usage +- **Persistence**: Market data remains available even if individual exchange instances are destroyed + +**Alternative Simple Assignment:** + +If you prefer direct property assignment, you can also share markets by directly assigning the `markets` property: + +```javascript +// Simple direct assignment (ensure both exchanges are of same type) +exchange2.markets = exchange1.markets; +exchange2.symbols = exchange1.symbols; // Also copy symbols for full functionality +``` + +However, using the `setMarketsFromExchange()` method is recommended as it: +- Validates that both exchanges are of the same type +- Ensures all related market data is properly copied +- Provides better error handling + +**Important Notes:** +- Only share markets between instances of the same exchange type +- Market sharing is most effective when both instances use the same API credentials and configuration +- The shared market objects will persist in memory as long as at least one reference exists +- Both the `setMarketsFromExchange()` method and direct assignment create shared references, not copies + +## Symbols And Market Ids + +A currency code is a code of three to five letters, like `BTC`, `ETH`, `USD`, `GBP`, `CNY`, `JPY`, `DOGE`, `RUB`, `ZEC`, `XRP`, `XMR`, etc. Some exchanges have exotic currencies with longer codes. + +A symbol is usually an uppercase string literal name of a pair of traded currencies with a slash in between. The first currency before the slash is usually called *base currency*, and the one after the slash is called *quote currency*. Examples of a symbol are: `BTC/USD`, `DOGE/LTC`, `ETH/EUR`, `DASH/XRP`, `BTC/CNY`, `ZEC/XMR`, `ETH/JPY`. + +Market ids are used during the REST request-response process to reference trading pairs within exchanges. The set of market ids is unique per exchange and cannot be used across exchanges. For example, the BTC/USD pair/market may have different ids on various popular exchanges, like `btcusd`, `BTCUSD`, `XBTUSD`, `btc/usd`, `42` (numeric id), `BTC/USD`, `Btc/Usd`, `tBTCUSD`, `XXBTZUSD`. You don't need to remember or use market ids, they are there for internal HTTP request-response purposes inside exchange implementations. + +The ccxt library abstracts uncommon market ids to symbols, standardized to a common format. Symbols aren't the same as market ids. Every market is referenced by a corresponding symbol. Symbols are common across exchanges which makes them suitable for arbitrage and many other things. + +Sometimes the user might notice a symbol like `'XBTM18'` or `'.XRPUSDM20180101'` or some other *"exotic/rare symbols"*. The symbol is **not required** to have a slash or to be a pair of currencies. The string in the symbol really depends on the type of the market (whether it is a spot market or a futures market, a darkpool market or an expired market, etc). Attempting to parse the symbol string is highly discouraged, one should not rely on the symbol format, it is recommended to use market properties instead. + +Market structures are indexed by symbols and ids. The base exchange class also has builtin methods for accessing markets by symbols. Most API methods require a symbol to be passed in their first argument. You are often required to specify a symbol when querying current prices, making orders, etc. + +Most of the time users will be working with market symbols. You will get a standard userland exception if you access non-existent keys in these dicts. + +### Methods For Markets And Currencies + + +#### **Javascript** +```javascript +(async () => { + + console.log (await exchange.loadMarkets ()) + + let btcusd1 = exchange.markets['BTC/USD'] // get market structure by symbol + let btcusd2 = exchange.market ('BTC/USD') // same result in a slightly different way + + let btcusdId = exchange.marketId ('BTC/USD') // get market id by symbol + + let symbols = exchange.symbols // get an array of symbols + let symbols2 = Object.keys (exchange.markets) // same as previous line + + console.log (exchange.id, symbols) // print all symbols + + let currencies = exchange.currencies // a dictionary of currencies + + let bitfinex = new ccxt.bitfinex () + await bitfinex.loadMarkets () + + bitfinex.markets['BTC/USD'] // symbol → market (get market by symbol) + bitfinex.markets_by_id['XRPBTC'][0] // id → market (get market by id) + + bitfinex.markets['BTC/USD']['id'] // symbol → id (get id by symbol) + bitfinex.markets_by_id['XRPBTC'][0]['symbol'] // id → symbol (get symbol by id) + +}) () +``` + +#### **Python** +```python +print(exchange.load_markets()) + +etheur1 = exchange.markets['ETH/EUR'] # get market structure by symbol +etheur2 = exchange.market('ETH/EUR') # same result in a slightly different way + +etheurId = exchange.market_id('ETH/EUR') # get market id by symbol + +symbols = exchange.symbols # get a list of symbols +symbols2 = list(exchange.markets.keys()) # same as previous line + +print(exchange.id, symbols) # print all symbols + +currencies = exchange.currencies # a dictionary of currencies + +kraken = ccxt.kraken() +kraken.load_markets() + +kraken.markets['BTC/USD'] # symbol → market (get market by symbol) +kraken.markets_by_id['XXRPZUSD'][0] # id → market (get market by id) + +kraken.markets['BTC/USD']['id'] # symbol → id (get id by symbol) +kraken.markets_by_id['XXRPZUSD'][0]['symbol'] # id → symbol (get symbol by id) +``` + +#### **PHP** +```php +$var_dump($exchange->load_markets()); + +$dashcny1 = $exchange->markets['DASH/CNY']; // get market structure by symbol +$dashcny2 = $exchange->market('DASH/CNY'); // same result in a slightly different way + +$dashcnyId = $exchange->market_id('DASH/CNY'); // get market id by symbol + +$symbols = $exchange->symbols; // get an array of symbols +$symbols2 = array_keys($exchange->markets); // same as previous line + +var_dump($exchange->id, $symbols); // print all symbols + +$currencies = $exchange->currencies; // an associative array of currencies + +$okcoin = '\\ccxt\\okcoin'; +$okcoin = new $okcoin(); + +$okcoin->load_markets(); + +$okcoin->markets['BTC/USD']; // symbol → market (get market by symbol) +$okcoin->markets_by_id['btc_usd'][0]; // id → market (get market by id) + +$okcoin->markets['BTC/USD']['id']; // symbol → id (get id by symbol) +$okcoin->markets_by_id['btc_usd'][0]['symbol']; // id → symbol (get symbol by id) +``` + + + +### Naming Consistency + +There is a bit of term ambiguity across various exchanges that may cause confusion among newcoming traders. Some exchanges call markets as *pairs*, whereas other exchanges call symbols as *products*. In terms of the ccxt library, each exchange contains one or more trading markets. Each market has an id and a symbol. Most symbols are pairs of base currency and quote currency. + +```Exchanges → Markets → Symbols → Currencies``` + +Historically various symbolic names have been used to designate same trading pairs. Some cryptocurrencies (like Dash) even changed their names more than once during their ongoing lifetime. For consistency across exchanges the ccxt library will perform the following known substitutions for symbols and currencies: + +- `XBT → BTC`: `XBT` is newer but `BTC` is more common among exchanges and sounds more like bitcoin ([read more](https://www.google.ru/search?q=xbt+vs+btc)). +- `BCC → BCH`: The Bitcoin Cash fork is often called with two different symbolic names: `BCC` and `BCH`. The name `BCC` is ambiguous for Bitcoin Cash, it is confused with BitConnect. The ccxt library will convert `BCC` to `BCH` where it is appropriate (some exchanges and aggregators confuse them). +- `DRK → DASH`: `DASH` was Darkcoin then became Dash ([read more](https://minergate.com/blog/dashcoin-and-dash/)). +- `BCHABC → BCH`: On November 15 2018 Bitcoin Cash forked the second time, so, now there is `BCH` (for BCH ABC) and `BSV` (for BCH SV). +- `BCHSV → BSV`: This is a common substitution mapping for the Bitcoin Cash SV fork (some exchanges call it `BSV`, others call it `BCHSV`, we use the former). +- `DSH → DASH`: Try not to confuse symbols and currencies. The `DSH` (Dashcoin) is not the same as `DASH` (Dash). Some exchanges have `DASH` labelled inconsistently as `DSH`, the ccxt library does a correction for that as well (`DSH → DASH`), but only on certain exchanges that have these two currencies confused, whereas most exchanges have them both correct. Just remember that `DASH/BTC` is not the same as `DSH/BTC`. +- `XRB` → `NANO`: `NANO` is the newer code for RaiBlocks, thus, CCXT unified API will replace the older `XRB` with `NANO` where needed. https://hackernoon.com/nano-rebrand-announcement-9101528a7b76 +- `USD` → `USDT`: Some exchanges, like Bitfinex, HitBTC and a few other name the currency as `USD` in their listings, but those markets are actually trading `USDT`. The confusion can come from a 3-letter limitation on symbol names or may be due to other reasons. In cases where the traded currency is actually `USDT` and is not `USD` – the CCXT library will perform `USD` → `USDT` conversion. Note, however, that some exchanges have both `USD` and `USDT` symbols, for example, Kraken has a `USDT/USD` trading pair. + +#### Notes On Naming Consistency + +Each exchange has an associative array of substitutions for cryptocurrency symbolic codes in the `exchange.commonCurrencies` property, like: +``` +'commonCurrencies' : { + 'XBT': 'BTC', + 'OPTIMISM': 'OP', + // ... etc +} +``` +where key represents actual name how exchange engine refers to that coin, and the value represents what you want to refer to it with through ccxt. + +Sometimes the user may notice exotic symbol names with mixed-case words and spaces in the code. The logic behind having these names is explained by the rules for resolving conflicts in naming and currency-coding when one or more currencies have the same symbolic code with different exchanges: + +- First, we gather all info available from the exchanges themselves about the currency codes in question. They usually have a description of their coin listings somewhere in their API or their docs, knowledgebases or elsewhere on their websites. +- When we identify each particular cryptocurrency standing behind the currency code, we look them up on [CoinMarketCap](https://coinmarketcap.com). +- The currency that has the greatest market capitalization of all wins the currency code and keeps it. For example, HOT often stand for either `Holo` or `Hydro Protocol`. In this case `Holo` retains the code `HOT`, and `Hydro Protocol` will have its name as its code, literally, `Hydro Protocol`. So, there may be trading pairs with symbols like `HOT/USD` (for `Holo`) and `Hydro Protocol/USD` – those are two different markets. +- If market cap of a particular coin is unknown or is not enough to determine the winner, we also take trading volumes and other factors into consideration. +- When the winner is determined all other competing currencies get their code names properly remapped and substituted within conflicting exchanges via `.commonCurrencies`. **Note, it should be defined before '.loadMarkets()' happens!** +- Unfortunately this is a work in progress, because new currencies get listed daily and new exchanges are added from time to time, so, in general this is a never-ending process of self-correction in a quickly changing environment, practically, in *"live mode"*. We are thankful for all reported conflicts and mismatches you may find. + +#### Questions On Naming Consistency + +_Is it possible for symbols to change?_ + +In short, yes, sometimes, but rarely. Symbolic mappings can be changed if that is absolutely required and cannot be avoided. However, all previous symbolic changes were related to resolving conflicts or forks. So far, there was no precedent of a market cap of one coin overtaking another coin with the same symbolic code in CCXT. + +_Can we rely on always listing the same crypto with the same symbol?_ + +More or less ) First, this library is a work in progress, and it is trying to adapt to the everchanging reality, so there may be conflicts that we will fix by changing some mappings in the future. Ultimately, the license says "no warranties, use at your own risk". However, we don't change symbolic mappings randomly all over the place, because we understand the consequences and we'd want to rely on the library as well and we don't like to break the backward-compatibility at all. + +If it so happens that a symbol of a major token is forked or has to be changed, then the control is still in the users' hands. The `exchange.commonCurrencies` property can be [overrided upon initialization or later](#overriding-exchange-properties-upon-instantiation), just like any other exchange property. If a significant token is involved, we usually post instructions on how to retain the old behavior by adding a couple of lines to the constructor params. + +#### Consistency Of Base And Quote Currencies + +It depends on which exchange you are using, but some of them have a reversed (inconsistent) pairing of `base` and `quote`. They actually have base and quote misplaced (switched/reversed sides). In that case you'll see a difference of parsed `base` and `quote` currency values with the unparsed `info` in the market substructure. + +For those exchanges the ccxt will do a correction, switching and normalizing sides of base and quote currencies when parsing exchange replies. This logic is financially and terminologically correct. If you want less confusion, remember the following rule: **base is always before the slash, quote is always after the slash in any symbol and with any market**. + +```text +base currency ↓ + BTC / USDT + ETH / BTC + DASH / ETH + ↑ quote currency +``` + +#### Contract Naming Conventions + +We currently load spot markets with the unified `BASE/QUOTE` symbol schema into the `.markets` mapping, indexed by symbol. This would cause a naming conflict for futures and other derivatives that have the same symbol as their spot market counterparts. To accomodate both types of markets in the `.markets` we require the symbols between 'future' and 'spot' markets to be distinct, as well as the symbols between 'linear' and 'inverse' contracts to be distinct. + +**Please, check this announcement: [Unified contract naming conventions](https://github.com/ccxt/ccxt/issues/10931)** + +CCXT supports the following types of derivative contracts: + +- `future` – for expiring futures contracts that have a delivery/settlement date [](https://en.wikipedia.org/wiki/Futures_contract) +- `swap` – for perpetual swap futures that don't have a delivery date [](https://en.wikipedia.org/wiki/Perpetual_futures) +- `option` – for option contracts (https://en.wikipedia.org/wiki/Option_contract) + +##### Future + +A future market symbol consists of the underlying currency, the quoting currency, the settlement currency and an arbitrary identifier. Most often the identifier is the settlement date of the future contract in `YYMMDD` format: + +```javascript +// +// base asset or currency +// ↓ +// ↓ quote asset or currency +// ↓ ↓ +// ↓ ↓ settlement asset or currency +// ↓ ↓ ↓ +// ↓ ↓ ↓ identifier (settlement date) +// ↓ ↓ ↓ ↓ +// ↓ ↓ ↓ ↓ +'BTC/USDT:BTC-211225' // BTC/USDT futures contract settled in BTC (inverse) on 2021-12-25 +'BTC/USDT:USDT-211225' // BTC/USDT futures contract settled in USDT (linear, vanilla) on 2021-12-25 +'ETH/USDT:ETH-210625' // ETH/USDT futures contract settled in ETH (inverse) on 2021-06-25 +'ETH/USDT:USDT-210625' // ETH/USDT futures contract settled in USDT (linear, vanilla) on 2021-06-25 +``` + +##### Perpetual Swap (Perpetual Future) + +```javascript +// base asset or currency +// ↓ +// ↓ quote asset or currency +// ↓ ↓ +// ↓ ↓ settlement asset or currency +// ↓ ↓ ↓ +// ↓ ↓ ↓ +'BTC/USDT:BTC' // BTC/USDT inverse perpetual swap contract funded in BTC +'BTC/USDT:USDT' // BTC/USDT linear perpetual swap contract funded in USDT +'ETH/USDT:ETH' // ETH/USDT inverse perpetual swap contract funded in ETH +'ETH/USDT:USDT' // ETH/USDT linear perpetual swap contract funded in USDT +``` + +##### Option + +```javascript +// +// base asset or currency +// ↓ +// ↓ quote asset or currency +// ↓ ↓ +// ↓ ↓ settlement asset or currency +// ↓ ↓ ↓ +// ↓ ↓ ↓ identifier (settlement date) +// ↓ ↓ ↓ ↓ +// ↓ ↓ ↓ ↓ strike price +// ↓ ↓ ↓ ↓ ↓ +// ↓ ↓ ↓ ↓ ↓ type, put (P) or call (C) +// ↓ ↓ ↓ ↓ ↓ ↓ +'BTC/USDT:BTC-211225-60000-P' // BTC/USDT put option contract strike price 60000 USDT settled in BTC (inverse) on 2021-12-25 +'ETH/USDT:USDT-211225-40000-C' // BTC/USDT call option contract strike price 40000 USDT settled in USDT (linear, vanilla) on 2021-12-25 +'ETH/USDT:ETH-210625-5000-P' // ETH/USDT put option contract strike price 5000 USDT settled in ETH (inverse) on 2021-06-25 +'ETH/USDT:USDT-210625-5000-C' // ETH/USDT call option contract strike price 5000 USDT settled in USDT (linear, vanilla) on 2021-06-25 +``` + +### Unified Networks + +| Network | CCXT Code | +|---------------------------------------|--------------| +| Bitcoin | BTC | +| Ethereum | ETH (For Ethereum) / ERC20 (For Tokens) | +| Ripple | XRP | +| Litecoin | LTC | +| Dogecoin | DOGE | +| Stellar | XLM | +| Tron | TRX (For TRX) / TRC20 (For Tokens) | +| Ethereum Classic | ETC | +| Zcash | ZEC | +| BSC (Binance Smart Chain) | BEP20 | +| Monero | XMR | +| Cardano | ADA | +| Tezos | XTZ | +| Cosmos | ATOM | +| Solana | SOL | +| BNB Beacon Chain | BEP2 | +| Polkadot | DOT | +| Algorand | ALGO | +| Avalanche | AVAX | +| Chainlink | LINK | +| Bitcoin Cash | BCH | +| Filecoin | FIL | +| Kusama | KSM | +| Elrond | EGLD | +| THORChain | RUNE | +| Internet Computer | ICP | +| Near Protocol | NEAR | +| Celo | CELO | +| Hedera Hashgraph | HBAR | +| IOTA | MIOTA | +| Klaytn | KLAY | +| VeChain | VET | +| Theta Network | THETA | +| Stacks | STX | +| Bitcoin Lightning Network | LIGHTNING | +| Optimism | OPTIMISM | +| Arbitrum | ARBITRUM | +| zkSync | zkSync | +| Polygon | MATIC | +| Fantom | FTM | + +## Market Cache Force Reload + +The `loadMarkets () / load_markets ()` is also a dirty method with a side effect of saving the array of markets on the exchange instance. You only need to call it once per exchange. All subsequent calls to the same method will return the locally saved (cached) array of markets. + +When exchange markets are loaded, you can then access market information any time via the `markets` property. This property contains an associative array of markets indexed by symbol. If you need to force reload the list of markets after you have them loaded already, pass the reload = true flag to the same method again. + + +#### **Javascript** +```javascript +(async () => { + let kraken = new ccxt.kraken ({ verbose: true }) // log HTTP requests + await kraken.loadMarkets () // request markets + console.log (kraken.id, kraken.markets) // output a full list of all loaded markets + console.log (Object.keys (kraken.markets)) // output a short list of market symbols + console.log (kraken.markets['BTC/USD']) // output single market details + await kraken.loadMarkets () // return a locally cached version, no reload + let reloadedMarkets = await kraken.loadMarkets (true) // force HTTP reload = true + console.log (reloadedMarkets['ETH/BTC']) +}) () +``` +#### **Python** +```python +poloniex = ccxt.poloniex({'verbose': True}) # log HTTP requests +poloniex.load_markets() # request markets +print(poloniex.id, poloniex.markets) # output a full list of all loaded markets +print(list(poloniex.markets.keys())) # output a short list of market symbols +print(poloniex.markets['BTC/ETH']) # output single market details +poloniex.load_markets() # return a locally cached version, no reload +reloadedMarkets = poloniex.load_markets(True) # force HTTP reload = True +print(reloadedMarkets['ETH/ZEC']) +``` +#### **PHP** +```php +$bitfinex = new \ccxt\bitfinex(array('verbose' => true)); // log HTTP requests +$bitfinex.load_markets(); // request markets +var_dump($bitfinex->id, $bitfinex->markets); // output a full list of all loaded markets +var_dump(array_keys ($bitfinex->markets)); // output a short list of market symbols +var_dump($bitfinex->markets['XRP/USD']); // output single market details +$bitfinex->load_markets(); // return a locally cached version, no reload +$reloadedMarkets = $bitfinex->load_markets(true); // force HTTP reload = true +var_dump($bitfinex->markets['XRP/BTC']); +``` + + + +# Implicit API + +- [API Methods / Endpoints](#api-methods--endpoints) +- [Implicit API Methods](#implicit-api-methods) +- [Public/Private API](#publicprivate-api) +- [Synchronous vs Asynchronous Calls](#synchronous-vs-asynchronous-calls) +- [Passing Parameters To API Methods](#passing-parameters-to-api-methods) + +## API Methods / Endpoints + +Each exchange offers a set of API methods. Each method of the API is called an *endpoint*. Endpoints are HTTP URLs for querying various types of information. All endpoints return JSON in response to client requests. + +Usually, there is an endpoint for getting a list of markets from an exchange, an endpoint for retrieving an order book for a particular market, an endpoint for retrieving trade history, endpoints for placing and canceling orders, for money deposit and withdrawal, etc... Basically every kind of action you could perform within a particular exchange has a separate endpoint URL offered by the API. + +Because the set of methods differs from exchange to exchange, the ccxt library implements the following: +- a public and private API for all possible URLs and methods +- a unified API supporting a subset of common methods + +The endpoint URLs are predefined in the `api` property for each exchange. You don't have to override it, unless you are implementing a new exchange API (at least you should know what you're doing). + +Most of exchange-specific API methods are implicit, meaning that they aren't defined explicitly anywhere in code. The library implements a declarative approach for defining implicit (non-unified) exchanges' API methods. + +## Implicit API Methods + +Each method of the API usually has its own endpoint. The library defines all endpoints for each particular exchange in the `.api` property. Upon exchange construction an implicit *magic* method (aka *partial function* or *closure*) will be created inside `defineRestApi()/define_rest_api()` on the exchange instance for each endpoint from the list of `.api` endpoints. This is performed for all exchanges universally. Each generated method will be accessible in both `camelCase` and `under_score` notations. + +The endpoints definition is a **full list of ALL API URLs** exposed by an exchange. This list gets converted to callable methods upon exchange instantiation. Each URL in the API endpoint list gets a corresponding callable method. This is done automatically for all exchanges, therefore the ccxt library supports **all possible URLs** offered by crypto exchanges. + +Each implicit method gets a unique name which is constructed from the `.api` definition. For example, a private HTTPS PUT `https://api.exchange.com/order/{id}/cancel` endpoint will have a corresponding exchange method named `.privatePutOrderIdCancel()`/`.private_put_order_id_cancel()`. A public HTTPS GET `https://api.exchange.com/market/ticker/{pair}` endpoint would result in the corresponding method named `.publicGetTickerPair()`/`.public_get_ticker_pair()`, and so on. + +An implicit method takes a dictionary of parameters, sends the request to the exchange and returns an exchange-specific JSON result from the API **as is, unparsed**. To pass a parameter, add it to the dictionary explicitly under a key equal to the parameter's name. For the examples above, this would look like `.privatePutOrderIdCancel ({ id: '41987a2b-...' })` and `.publicGetTickerPair ({ pair: 'BTC/USD' })`. + +The recommended way of working with exchanges is not using exchange-specific implicit methods but using the unified ccxt methods instead. The exchange-specific methods should be used as a fallback in cases when a corresponding unified method isn't available (yet). + +To get a list of all available methods with an exchange instance, including implicit methods and unified methods you can simply do the following: + +```text +console.log (new ccxt.kraken ()) // JavaScript +print(dir(ccxt.kraken())) # Python +var_dump (new \ccxt\kraken ()); // PHP +``` + +## Public/Private API + +API URLs are often grouped into two sets of methods called a *public API* for market data and a *private API* for trading and account access. These groups of API methods are usually prefixed with a word 'public' or 'private'. + +A public API is used to access market data and does not require any authentication whatsoever. Most exchanges provide market data openly to all (under their rate limit). With the ccxt library anyone can access market data out of the box without having to register with the exchanges and without setting up account keys and passwords. + +Public APIs include the following: + +- instruments/trading pairs +- price feeds (exchange rates) +- order books (L1, L2, L3...) +- trade history (closed orders, transactions, executions) +- tickers (spot / 24h price) +- OHLCV series for charting +- other public endpoints + +The private API is mostly used for trading and for accessing account-specific private data, therefore it requires authentication. You have to get the private API keys from the exchanges. It often means registering with an exchange website and creating the API keys for your account. Most exchanges require personal information or identification. Some exchanges will only allow trading after completing the KYC verification. +Private APIs allow the following: + +- manage personal account info +- query account balances +- trade by making market and limit orders +- create deposit addresses and fund accounts +- request withdrawal of fiat and crypto funds +- query personal open / closed orders +- query positions in margin/leverage trading +- get ledger history +- transfer funds between accounts +- use merchant services + +Some exchanges offer the same logic under different names. For example, a public API is also often called *market data*, *basic*, *market*, *mapi*, *api*, *price*, etc... All of them mean a set of methods for accessing data available to public. A private API is also often called *trading*, *trade*, *tapi*, *exchange*, *account*, etc... + +A few exchanges also expose a merchant API which allows you to create invoices and accept crypto and fiat payments from your clients. This kind of API is often called *merchant*, *wallet*, *payment*, *ecapi* (for e-commerce). + +To get a list of all available methods with an exchange instance, you can simply do the following: + +```text +console.log (new ccxt.kraken ()) // JavaScript +print(dir(ccxt.kraken())) # Python +var_dump (new \ccxt\kraken ()); // PHP +``` + +**contract only and margin only** + +- methods in this documentation that are documented as **contract only** or **margin only** are only intended to be used for contract trading and margin trading respectively. They may work when trading in other types of markets but will most likely return irrelevant information. + +## Synchronous vs Asynchronous Calls + + + +#### **Javascript** + +In the JavaScript version of CCXT all methods are asynchronous and return [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolve with a decoded JSON object. In CCXT we use the modern *async/await* syntax to work with Promises. If you're not familiar with that syntax, you can read more about it [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). + +```javascript +// JavaScript + +(async () => { + let pairs = await kraken.publicGetSymbolsDetails () + let marketIds = Object.keys (pairs['result']) + let marketId = marketIds[0] + let ticker = await kraken.publicGetTicker ({ pair: marketId }) + console.log (kraken.id, marketId, ticker) +}) () +``` + + +#### **Python** + +The ccxt library supports asynchronous concurrency mode in Python 3.5+ with async/await syntax. The asynchronous Python version uses pure [asyncio](https://docs.python.org/3/library/asyncio.html) with [aiohttp](http://aiohttp.readthedocs.io). In async mode you have all the same properties and methods, but most methods are decorated with an async keyword. If you want to use async mode, you should link against the `ccxt.async_support` subpackage, like in the following example: + +```python +# Python + +import asyncio +import ccxt.async_support as ccxt + +async def print_poloniex_ethbtc_ticker(): + poloniex = ccxt.poloniex() + print(await poloniex.fetch_ticker('ETH/BTC')) + await polonix.close() # close the exchange instance when you don't need it anymore + +asyncio.run(print_poloniex_ethbtc_ticker()) +``` + +#### **PHP** + +CCXT support PHP 8+ versions. The library has both synchronous and asynchronous versions. To use synchronous version, use `\ccxt` namespace (i.e. `new ccxt\binance()`) and to use asynchronous version, use `\ccxt\async` namespace (i.e. `new ccxt\async\binance()`). Asynchronous version uses [ReactPHP](https://reactphp.org/) library in the background. In async mode you have all the same properties and methods, but any networking API method should be decorated with the `\React\Async\await` keyword and your script should be in a ReactPHP wrapper: +```php +// PHP +fetch_ticker('ETH/BTC')); + var_dump($result); +} +``` + +See further examples in the `examples/php` directory; look for filenames that include the `async` word. Also, make sure you have installed the required dependencies using `composer require recoil/recoil clue/buzz-react react/event-loop recoil/react react/http`. Lastly, [this article](https://sergeyzhuk.me/2018/10/26/from-promise-to-coroutines/) provides a good introduction to the methods used here. While syntactically the change is simple (i.e., just using a `yield` keyword before relevant methods), concurrency has significant implications for the overall design of your code. + + + +### Returned JSON Objects + +All public and private API methods return raw decoded JSON objects in response from the exchanges, as is, untouched. The unified API returns JSON-decoded objects in a common format and structured uniformly across all exchanges. + +## Passing Parameters To API Methods + +The set of all possible API endpoints differs from exchange to exchange. Most of methods accept a single associative array (or a Python dict) of key-value parameters. The params are passed as follows: + +```text +bitso.publicGetTicker ({ book: 'eth_mxn' }) // JavaScript +ccxt.zaif().public_get_ticker_pair ({ 'pair': 'btc_jpy' }) # Python +$luno->public_get_ticker (array ('pair' => 'XBTIDR')); // PHP +``` + +The unified methods of exchanges might expect and will accept various `params` which affect their functionality, like: + +```python +params = {'type':'margin', 'isIsolated': 'TRUE'} # --------------┑ +# params will go as the last argument to the unified method | +# v +binance.create_order('BTC/USDT', 'limit', 'buy', amount, price, params) +``` + +An exchange will not accept the params from a different exchange, they're not interchangeable. The list of accepted parameters is defined by each specific exchange. + +To find which parameters can be passed to a unified method: + +- either open the [exchange-specific implementation](https://github.com/ccxt/ccxt/tree/master/js) file and search for the desired function (i.e. `createOrder`) to inspect and find out the details of `params` usage +- or go to the exchange's API docs and read the list of parameters for your specific function or endpoint (i.e. `order`) + +For a full list of accepted method parameters for each exchange, please consult [API docs](#exchanges). + +### API Method Naming Conventions + +An exchange method name is a concatenated string consisting of type (public or private), HTTP method (GET, POST, PUT, DELETE) and endpoint URL path like in the following examples: + +| Method Name | Base API URL | Endpoint URL | +|------------------------------|--------------------------------|--------------------------------| +| publicGetIdOrderbook | https://bitbay.net/API/Public | {id}/orderbook | +| publicGetPairs | https://bitlish.com/api | pairs | +| publicGetJsonMarketTicker | https://www.bitmarket.net | json/{market}/ticker | +| privateGetUserMargin | https://bitmex.com | user/margin | +| privatePostTrade | https://btc-x.is/api | trade | +| tapiCancelOrder | https://yobit.net | tapi/CancelOrder | +| ... | ... | ... | + +The ccxt library supports both camelcase notation (preferred in JavaScript) and underscore notation (preferred in Python and PHP), therefore all methods can be called in either notation or coding style in any language. Both of these notations work in JavaScript, Python and PHP: + +```text +exchange.methodName () // camelcase pseudocode +exchange.method_name() // underscore pseudocode +``` + +To get a list of all available methods with an exchange instance, you can simply do the following: + +```text +console.log (new ccxt.kraken ()) // JavaScript +print(dir(ccxt.hitbtc())) # Python +var_dump (new \ccxt\okcoin ()); // PHP +``` + +# Unified API + +- [Overriding Unified API Params](#overriding-unified-api-params) +- [Pagination](#pagination) +- [Automatic Pagination](#automatic-pagination) + +The unified ccxt API is a subset of methods common among the exchanges. It currently contains the following methods: + +- `fetchMarkets ()`: Fetches a list of all available markets from an exchange and returns an array of markets (objects with properties such as `symbol`, `base`, `quote` etc.). Some exchanges do not have means for obtaining a list of markets via their online API. For those, the list of markets is hardcoded. +- `fetchCurrencies ()`: Fetches all available currencies from an exchange and returns an associative dictionary of currencies (objects with properties such as `code`, `name`, etc.). Some exchanges do not have means for obtaining currencies via their online API. For those, the currencies will be extracted from market pairs or hardcoded. +- `loadMarkets ([reload])`: Returns the list of markets as an object indexed by symbol and caches it with the exchange instance. Returns cached markets if loaded already, unless the `reload = true` flag is forced. +- `fetchOrderBook (symbol, limit = undefined, params = {})`: Fetch L2/L3 order book for a particular market trading symbol. +- `fetchStatus (params = {})`: Returns information regarding the exchange status from either the info hardcoded in the exchange instance or the API, if available. +- `fetchL2OrderBook (symbol, limit = undefined, params)`: Level 2 (price-aggregated) order book for a particular symbol. +- `fetchTrades (symbol, since, limit, params)`: Fetch recent trades for a particular trading symbol. +- `fetchTicker (symbol)`: Fetch latest ticker data by trading symbol. +- `fetchBalance ()`: Fetch Balance. +- `createOrder (symbol, type, side, amount, price, params)` +- `createOrders(orders, params)` +- `createLimitBuyOrder (symbol, amount, price, param)` +- `createLimitSellOrder (symbol, amount, price, param)` +- `createMarketBuyOrder (symbol, amount, param)` +- `createMarketSellOrder (symbol, amount, param)` +- `cancelOrder (id, symbol, params)` +- `fetchOrder (id, symbol, params)` +- `fetchOrders (symbol, since, limit, params)` +- `fetchOpenOrders (symbol, since, limit, params)` +- `fetchCanceledOrders (symbol, since, limit, params)` +- `fetchClosedOrders (symbol, since, limit, params)` +- `fetchMyTrades (symbol, since, limit, params)` +- `fetchOpenInterest (symbol, params)` +- `fetchVolatilityHistory (code, params)` +- `fetchUnderlyingAssets ()` +- `fetchSettlementHistory (symbol, since, limit, params)` +- `fetchLiquidations (symbol, since, limit, params)` +- `fetchMyLiquidations (symbol, since, limit, params)` +- `fetchGreeks (symbol, params)` +- `fetchAllGreeks (symbols, params)` +- `fetchCrossBorrowRate (code, params)` +- `fetchCrossBorrowRates (params)` +- `fetchIsolatedBorrowRate (symbol, params)` +- `fetchIsolatedBorrowRates (params)` +- `fetchOption (symbol, params)` +- `fetchOptionChain (code, params)` +- `fetchConvertQuote (fromCode, toCode, amount, params)` +- `createConvertTrade (id, fromCode, toCode, amount, params)` +- `fetchFundingRate (symbol, params)` +- `fetchFundingRates (symbols, params)` +- `fetchFundingRateHistory (symbol, since, limit, params)` +- `fetchFundingRateInterval (symbol, params)` +- `fetchFundingRateIntervals (symbols, params)` +- `fetchLongShortRatio (symbol, params)` +- ... + +```text +TODO: better formatting +``` + +## Overriding Unified API Params + +Note, that most of methods of the unified API accept an optional `params` argument. It is an associative array (a dictionary, empty by default) containing the params you want to override. The contents of `params` are exchange-specific, consult the exchanges' API documentation for supported fields and values. Use the `params` dictionary if you need to pass a custom setting or an optional parameter to your unified query. + + + +#### **Javascript** +```javascript +(async () => { + + const params = { + 'foo': 'bar', // exchange-specific overrides in unified queries + 'Hello': 'World!', // see their docs for more details on parameter names + } + + // the overrides go into the last argument to the unified call ↓ HERE + const result = await exchange.fetchOrderBook (symbol, length, params) +}) () +``` + +#### **Python** +```python +params = { + 'foo': 'bar', # exchange-specific overrides in unified queries + 'Hello': 'World!', # see their docs for more details on parameter names +} + +# overrides go in the last argument to the unified call ↓ HERE +result = exchange.fetch_order_book(symbol, length, params) +``` + +#### **PHP** +```php +$params = array ( + 'foo' => 'bar', // exchange-specific overrides in unified queries + 'Hello' => 'World!', // see their docs for more details on parameter names +} + +// overrides go into the last argument to the unified call ↓ HERE +$result = $exchange->fetch_order_book ($symbol, $length, $params); +``` + + + +## Pagination + +Most of unified methods will return either a single object or a plain array (a list) of objects (trades, orders, transactions and so on). However, very few exchanges (if any at all) will return all orders, all trades, all ohlcv candles or all transactions at once. Most often their APIs `limit` output to a certain number of most recent objects. **YOU CANNOT GET ALL OBJECTS SINCE THE BEGINNING OF TIME TO THE PRESENT MOMENT IN JUST ONE CALL**. Practically, very few exchanges will tolerate or allow that. + +To fetch historical orders or trades, the user will need to traverse the data in portions or "pages" of objects. Pagination often implies *"fetching portions of data one by one"* in a loop. + +In most cases users are **required to use at least some type of pagination** in order to get the expected results consistently. If the user does not apply any pagination, most methods will return the exchanges' default, which may start from the beginning of history or may be a subset of most recent objects. The default behaviour (without pagination) is exchange-specific! The means of pagination are often used with the following methods in particular: + +- `fetchTrades()` +- `fetchOHLCV()` +- `fetchOrders()` +- `fetchCanceledOrders()` +- `fetchClosedOrder()` +- `fetchClosedOrders()` +- `fetchOpenOrder()` +- `fetchOpenOrders()` +- `fetchMyTrades()` +- `fetchTransactions()` +- `fetchDeposit()` +- `fetchDeposits()` +- `fetchWithdrawals()` + +With methods returning lists of objects, exchanges may offer one or more types of pagination. CCXT unifies **date-based pagination** by default, with timestamps **in milliseconds** throughout the entire library. + + +### Automatic Pagination + +*Warning: this is an experimental feature and might produce unexpected/incorrect results in some instances.* + +Recently, CCXT introduced a way to paginate through several results automatically by just providing the `paginate` flag inside `params,` lifting this work from the userland. Most leading exchanges support it, and more will be added in the future, but the easiest way to check it is to look in the method's documentation and search for the *pagination* parameter. As always there are exceptions, and some endpoints might not provide a way to paginate either through a timestamp or a cursor, and in those cases, there's nothing CCXT can do about it. + + +Right now, we have three different ways of paginating: +- **dynamic/time-based**: uses the `until` and `since` parameters to paginate through dynamic results like (trades, orders, transactions, etc). Since we don't know a priori how many entries are available to be fetched, it will perform one request at a time until we reach the end of the data or the maximum amount of pagination calls (configurable through an option) +- **deterministic**: when we can pre-compute the boundaries of each page, it will perform the requests concurrently for maximum performance. This applies to OHLCV, Funding Rates, and Open Interest and also respects the `paginationCalls` option. +- **cursor-based**: when the exchange provides a cursor inside the response, we extract the cursor and perform the subsequent request until the end of the data or reach the maximum number of pagination calls. + +The user cannot select the pagination method used, it will depend from implementation to implementation, considering the exchange API's features. + +#### Pagination params + +We can't perform an infinite amount of requests, and some of them might throw an error for different reasons, thus, we have some options that allow the user to control these variables and other pagination specificities. + +*All the options below, should be provided inside `params`, you can check the examples below* + +- **paginate**: (**boolean**) indicates that the user wants to paginate through different pages to get more data. Default is *false*. +- **paginationCalls**: (**integer**) allows the user to control the maximum amount of requests to paginate the data. Due to the rate limits, this value should not be too high. Default is 10. +- **maxRetries**: (**integer**) how many times should the pagination mechanism retry upon getting an error. Default is 3 +- **paginationDirection**: (**string**) Only applies to the dynamic pagination and it can be either *forward* (start the pagination from some time in the past and paginate forward) or *backward* (start from the most recent time and paginate backward). If *forward* is selected then a *since* parameter must also be provided. Default is *backward*. +- **maxEntriesPerRequest**: (**integer**): The max amount of entries per request so that we can maximize the data retrieved per call. It varies from endpoint to endpoint and CCXT will populate this value for you, but you can override it if needed. + +#### Examples + +```Python + +trades = await binance.fetch_trades("BTC/USDT", params = {"paginate": True}) # dynamic/time-based + +ohlcv = await binance.fetch_ohlcv("BTC/USDT", params = {"paginate": True, "paginationCalls": 5}) # deterministic-pagination will perform 5 requests + +trades = await binance.fetch_trades("BTC/USDT", since = 1664812416000, params = {"paginate": True, "paginationDirection": "forward"}) # dynamic/time-based pagination starting from 1664812416000 + +ledger = await bybit.fetch_ledger(params = {"paginate": True}) # bybit returns a cursor so the pagination will be cursor-based + +funding_rates = await binance.fetch_funding_rate_history("BTC/USDT:USDT", params = {"paginate": True, "maxEntriesPerRequest": 50}) # customizes the number of entries per request + +``` + + +### Working With Datetimes And Timestamps + +All unified timestamps throughout the CCXT library are integers **in milliseconds** unless explicitly stated otherwise. + +Below is the set of methods for working with UTC dates and timestamps and for converting between them: + +```JavaScript +exchange.parse8601 ('2018-01-01T00:00:00Z') == 1514764800000 // integer in milliseconds, Z = UTC +exchange.iso8601 (1514764800000) == '2018-01-01T00:00:00Z' // from milliseconds to iso8601 string +exchange.seconds () // integer UTC timestamp in seconds +exchange.milliseconds () // integer UTC timestamp in milliseconds +``` + +### Date-based Pagination + +This is the type of pagination currently used throughout the CCXT Unified API. The user supplies a `since` timestamp **in milliseconds** (!) and a number to `limit` results. To traverse the objects of interest page by page, the user runs the following (below is pseudocode, it may require overriding some exchange-specific params, depending on the exchange in question): + + +#### **Javascript** +```javascript +if (exchange.has['fetchTrades']) { + let since = exchange.milliseconds () - 86400000 // -1 day from now + // alternatively, fetch from a certain starting datetime + // let since = exchange.parse8601 ('2018-01-01T00:00:00Z') + let allTrades = [] + while (since < exchange.milliseconds ()) { + const symbol = undefined // change for your symbol + const limit = 20 // change for your limit + const trades = await exchange.fetchTrades (symbol, since, limit) + if (trades.length) { + since = trades[trades.length - 1]['timestamp'] + 1 + allTrades = allTrades.concat (trades) + } else { + break + } + } +} +``` + +#### **Python** +```python +if exchange.has['fetchOrders']: + since = exchange.milliseconds () - 86400000 # -1 day from now + # alternatively, fetch from a certain starting datetime + # since = exchange.parse8601('2018-01-01T00:00:00Z') + all_orders = [] + while since < exchange.milliseconds (): + symbol = None # change for your symbol + limit = 20 # change for your limit + orders = await exchange.fetch_orders(symbol, since, limit) + if len(orders): + since = orders[len(orders) - 1]['timestamp'] + 1 + all_orders += orders + else: + break +``` + +#### **PHP** +```php +if ($exchange->has['fetchMyTrades']) { + $since = exchange->milliseconds () - 86400000; // -1 day from now + // alternatively, fetch from a certain starting datetime + // $since = $exchange->parse8601 ('2018-01-01T00:00:00Z'); + $all_trades = array (); + while (since < exchange->milliseconds ()) { + $symbol = null; // change for your symbol + $limit = 20; // change for your limit + $trades = $exchange->fetchMyTrades ($symbol, $since, $limit); + if (count($trades)) { + $since = $trades[count($trades) - 1]['timestamp'] + 1; + $all_trades = array_merge ($all_trades, $trades); + } else { + break; + } + } +} +``` + + + +### id-based Pagination + +The user supplies a `from_id` of the object, from where the query should continue returning results, and a number to `limit` results. This is the default with some exchanges, however, this type is not unified (yet). To paginate objects based on their ids, the user would run the following: + + + +#### **Javascript** +```javascript +if (exchange.has['fetchTrades']) { + let from_id = 'abc123' // all ids are strings + let allTrades = [] + while (true) { + const symbol = undefined // change for your symbol + const since = undefined + const limit = 20 // change for your limit + const params = { + 'from_id': from_id, // exchange-specific non-unified parameter name + } + const trades = await exchange.fetchTrades (symbol, since, limit, params) + if (trades.length) { + from_id = trades[trades.length - 1]['id'] + allTrades.push (trades) + } else { + break + } + } +} +``` + +#### **Python** +```python +if exchange.has['fetchOrders']: + from_id = 'abc123' # all ids are strings + all_orders = [] + while True: + symbol = None # change for your symbol + since = None + limit = 20 # change for your limit + params = { + 'from_id': from_id, # exchange-specific non-unified parameter name + } + orders = await exchange.fetch_orders(symbol, since, limit, params) + if len(orders): + from_id = orders[len(orders) - 1]['id'] + all_orders += orders + else: + break +``` + +#### **PHP** +```php +if ($exchange->has['fetchMyTrades']) { + $from_id = 'abc123' // all ids are strings + $all_trades = array (); + while (true) { + $symbol = null; // change for your symbol + $since = null; + $limit = 20; // change for your limit + $params = array ( + 'from_id' => $from_id, // exchange-specific non-unified parameter name + ); + $trades = $exchange->fetchMyTrades ($symbol, $since, $limit, $params); + if (count($trades)) { + $from_id = $trades[count($trades) - 1]['id']; + $all_trades = array_merge ($all_trades, $trades); + } else { + break; + } + } +} +``` + + + + + + +### Pagenumber-based (Cursor) Pagination + +The user supplies a page number or an *initial "cursor"* value. The exchange returns a page of results and the *next "cursor"* value, to proceed from. Most of exchanges that implement this type of pagination will either return the next cursor within the response itself or will return the next cursor values within HTTP response headers. + +See an example implementation here: https://github.com/ccxt/ccxt/blob/master/examples/py/coinbasepro-fetch-my-trades-pagination.py + +Upon each iteration of the loop the user has to take the next cursor and put it into the overrided params for the next query (on the following iteration): + + +#### **Javascript** +```javascript +if (exchange.has['fetchTrades']) { + let page = 0 // exchange-specific type and value + let allTrades = [] + while (true) { + const symbol = undefined // change for your symbol + const since = undefined + const limit = 20 // change for your limit + const params = { + 'page': page, // exchange-specific non-unified parameter name + } + const trades = await exchange.fetchTrades (symbol, since, limit, params) + if (trades.length) { + // not thread-safe and exchange-specific! + last_json_response = exchange.parseJson (exchange.last_http_response) + page = last_json_response['cursor'] + allTrades.push (trades) + } else { + break + } + } +} +``` + +#### **Python** +```python +if exchange.has['fetchOrders']: + cursor = 0 # exchange-specific type and value + all_orders = [] + while True: + symbol = None # change for your symbol + since = None + limit = 20 # change for your limit + params = { + 'cursor': cursor, # exchange-specific non-unified parameter name + } + orders = await exchange.fetch_orders(symbol, since, limit, params) + if len(orders): + # not thread-safe and exchange-specific! + cursor = exchange.last_response_headers['CB-AFTER'] + all_orders += orders + else: + break +``` + +#### **PHP** +```php +if ($exchange->has['fetchMyTrades']) { + $start = '0' // exchange-specific type and value + $all_trades = array (); + while (true) { + $symbol = null; // change for your symbol + $since = null; + $limit = 20; // change for your limit + $params = array ( + 'start' => $start, // exchange-specific non-unified parameter name + ); + $trades = $exchange->fetchMyTrades ($symbol, $since, $limit, $params); + if (count($trades)) { + // not thread-safe and exchange-specific! + $last_json_response = $exchange->parse_json ($exchange->last_http_response); + $start = $last_json_response['next']; + $all_trades = array_merge ($all_trades, $trades); + } else { + break; + } + } +} +``` + + + +# Public API + +- [Order Book](#order-book) +- [Price Tickers](#price-tickers) +- [OHLCV Candlestick Charts](#ohlcv-candlestick-charts) +- [Public Trades](#public-trades) +- [Exchange Time](#exchange-time) +- [Exchange Status](#exchange-status) +- [Borrow Rates](#borrow-rates) +- [Borrow Rate History](#borrow-rate-history) +- [Leverage Tiers](#leverage-tiers) +- [Funding Rate](#funding-rate) +- [Funding Rate History](#funding-rate-history) +- [Open Interest History](#open-interest-history) +- [Volatility History](#volatility-history) +- [Underlying Assets](#underlying-assets) +- [Liquidations](#liquidations) +- [Greeks](#greeks) +- [OptionChain](#option-chain) + +## Order Book + +Exchanges expose information on open orders with bid (buy) and ask (sell) prices, volumes and other data. Usually there is a separate endpoint for querying current state (stack frame) of the *order book* for a particular market. An order book is also often called *market depth*. The order book information is used in the trading decision making process. + +To get data on order books, you can use + +- `fetchOrderBook ()` // for a single markets order books +- `fetchOrderBooks ( symbols )` // for multiple markets order books +- `fetchOrderBooks ()` // for the order books of all markets + +```javascript +async fetchOrderBook (symbol, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT symbol (e.g. `"BTC/USDT"`) +- **limit** (Integer) The number of orders to return in the order book (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An [order book structure](#order-book-structure) + +```javascript +async fetchOrderBooks (symbols = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbols** (\[String\]) Unified CCXT symbols (e.g. `["BTC/USDT", "ETH/USDT"]`) +- **limit** (Integer) The number of orders to return in the order book (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- A dictionary of [order book structures](#order-book-structure) indexed by market symbols + +### fetchOrderBook Examples + + +#### **Javascript** +```javascript +delay = 2000 // milliseconds = seconds * 1000 +(async () => { + for (symbol in exchange.markets) { + console.log (await exchange.fetchOrderBook (symbol)) + await new Promise (resolve => setTimeout (resolve, delay)) // rate limit + } +}) () +``` + +#### **Python** +```python +import time +delay = 2 # seconds +for symbol in exchange.markets: + print (exchange.fetch_order_book (symbol)) + time.sleep (delay) # rate limit +``` + +#### **PHP** +```php +$delay = 2000000; // microseconds = seconds * 1000000 +foreach ($exchange->markets as $symbol => $market) { + var_dump ($exchange->fetch_order_book ($symbol)); + usleep ($delay); // rate limit +} +``` + + + +### Order Book Structure + +```javascript +{ + 'bids': [ + [ price, amount ], // [ float, float ] + [ price, amount ], + ... + ], + 'asks': [ + [ price, amount ], + [ price, amount ], + ... + ], + 'symbol': 'ETH/BTC', // a unified market symbol + 'timestamp': 1499280391811, // Unix Timestamp in milliseconds (seconds * 1000) + 'datetime': '2017-07-05T18:47:14.692Z', // ISO8601 datetime string with milliseconds + 'nonce': 1499280391811, // an increasing unique identifier of the orderbook snapshot +} +``` + +**The timestamp and datetime may be missing (`undefined/None/null`) if the exchange in question does not provide a corresponding value in the API response.** + +Prices and amounts are floats. The bids array is sorted by price in descending order. The best (highest) bid price is the first element and the worst (lowest) bid price is the last element. The asks array is sorted by price in ascending order. The best (lowest) ask price is the first element and the worst (highest) ask price is the last element. Bid/ask arrays can be empty if there are no corresponding orders in the order book of an exchange. + +Exchanges may return the stack of orders in various levels of details for analysis. It is either in full detail containing each and every order, or it is aggregated having slightly less detail where orders are grouped and merged by price and volume. Having greater detail requires more traffic and bandwidth and is slower in general but gives a benefit of higher precision. Having less detail is usually faster, but may not be enough in some very specific cases. + +### Notes On Order Book Structure + +- The `orderbook['timestamp']` is the time when the exchange generated this orderbook response (before replying it back to you). This may be missing (`undefined/None/null`), as documented in the Manual, not all exchanges provide a timestamp there. If it is defined, then it is the UTC timestamp **in milliseconds** since 1 Jan 1970 00:00:00. +- Some exchanges may index orders in the orderbook by order ids, in that case the order id may be returned as the third element of bids and asks: `[ price, amount, id ]`. This is often the case with L3 orderbooks without aggregation. The order `id`, if shown in the orderbook, refers to the orderbook and does not necessarily correspond to the actual order id from the exchanges' database as seen by the owner or by the others. The order id is an `id` of the row inside the orderbook, but not necessarily the true-`id` of the order (though, they may be equal as well, depending on the exchange in question). +- In some cases the exchanges may supply L2 aggregated orderbooks with order counts for each aggregated level, in that case the order count may be returned as the third element of bids and asks: `[ price, amount, count ]`. The `count` tells how many orders are aggregated on each price level in bids and asks. +- Also, some exchanges may return the order timestamp as the third element of bids and asks: `[ price, amount, timestamp ]`. The `timestamp` tells when the order was placed on the orderbook. + +### Market Depth + +Some exchanges accept a dictionary of extra parameters to the `fetchOrderBook () / fetch_order_book ()` function. **All extra `params` are exchange-specific (non-unified)**. You will need to consult exchanges docs if you want to override a particular param, like the depth of the order book. You can get a limited count of returned orders or a desired level of aggregation (aka *market depth*) by specifying an limit argument and exchange-specific extra `params` like so: + + + +#### **Javascript** +```javascript + + +(async function test () { + const ccxt = require ('ccxt') + const exchange = new ccxt.bitfinex () + const limit = 5 + const orders = await exchange.fetchOrderBook ('BTC/USD', limit, { + // this parameter is exchange-specific, all extra params have unique names per exchange + 'group': 1, // 1 = orders are grouped by price, 0 = orders are separate + }) +}) () +``` + +#### **Python** +```python + +import ccxt +# return up to ten bidasks on each side of the order book stack +limit = 10 +ccxt.cex().fetch_order_book('BTC/USD', limit) +``` + +#### **PHP** +```php + +// instantiate the exchange by id +$exchange = '\\ccxt\\kraken'; +$exchange = new $exchange (); +// up to ten orders on each side, for example +$limit = 20; +var_dump ($exchange->fetch_order_book ('BTC/USD', $limit)); +``` + + + +The levels of detail or levels of order book aggregation are often number-labelled like L1, L2, L3... + +- **L1**: less detail for quickly obtaining very basic info, namely, the market price only. It appears to look like just one order in the order book. +- **L2**: most common level of aggregation where order volumes are grouped by price. If two orders have the same price, they appear as one single order for a volume equal to their total sum. This is most likely the level of aggregation you need for the majority of purposes. +- **L3**: most detailed level with no aggregation where each order is separate from other orders. This LOD naturally contains duplicates in the output. So, if two orders have equal prices they are **not** merged together and it's up to the exchange's matching engine to decide on their priority in the stack. You don't really need L3 detail for successful trading. In fact, you most probably don't need it at all. Therefore some exchanges don't support it and always return aggregated order books. + +If you want to get an L2 order book, whatever the exchange returns, use the `fetchL2OrderBook(symbol, limit, params)` or `fetch_l2_order_book(symbol, limit, params)` unified method for that. + +The `limit` argument does not guarantee that the number of bids or asks will always be equal to `limit`. It designates the upper boundary or the maximum, so at some moment in time there may be less than `limit` bids or asks. This is the case when the exchange does not have enough orders on the orderbook. However, if the underlying exchange API does not support a `limit` parameter for the orderbook endpoint at all, then the `limit` argument will be ignored. CCXT does not trim `bids` and `asks` if the exchange returns more than you request. + +### Market Price + +In order to get current best price (query market price) and calculate bidask spread take first elements from bid and ask, like so: + + + +#### **Javascript** +```javascript +let orderbook = await exchange.fetchOrderBook (exchange.symbols[0]) +let bid = orderbook.bids.length ? orderbook.bids[0][0] : undefined +let ask = orderbook.asks.length ? orderbook.asks[0][0] : undefined +let spread = (bid && ask) ? ask - bid : undefined +console.log (exchange.id, 'market price', { bid, ask, spread }) +``` + + +#### **Python** +```python +orderbook = exchange.fetch_order_book (exchange.symbols[0]) +bid = orderbook['bids'][0][0] if len (orderbook['bids']) > 0 else None +ask = orderbook['asks'][0][0] if len (orderbook['asks']) > 0 else None +spread = (ask - bid) if (bid and ask) else None +print (exchange.id, 'market price', { 'bid': bid, 'ask': ask, 'spread': spread }) +``` + +#### **PHP** +```php +$orderbook = $exchange->fetch_order_book ($exchange->symbols[0]); +$bid = count ($orderbook['bids']) ? $orderbook['bids'][0][0] : null; +$ask = count ($orderbook['asks']) ? $orderbook['asks'][0][0] : null; +$spread = ($bid && $ask) ? $ask - $bid : null; +$result = array ('bid' => $bid, 'ask' => $ask, 'spread' => $spread); +var_dump ($exchange->id, 'market price', $result); +``` + + +## Price Tickers + +A price ticker contains statistics for a particular market/symbol for some period of time in recent past, usually last 24 hours. The methods for fetching tickers are described below. + +### A Single Ticker For One Symbol + +```javascript +// one ticker +fetchTicker (symbol, params = {}) + +// example +fetchTicker ('ETH/BTC') +fetchTicker ('BTC/USDT') +``` + +### Multiple Tickers For All Or Many Symbols + +```javascript +// multiple tickers +fetchTickers (symbols = undefined, params = {}) // for all tickers at once + +// for example +fetchTickers () // all symbols +fetchTickers ([ 'ETH/BTC', 'BTC/USDT' ]) // an array of specific symbols +``` + +Check the `exchange.has['fetchTicker']` and `exchange.has['fetchTickers']` properties of the exchange instance to determine if the exchange in question does support these methods. + +**Please, note, that calling `fetchTickers ()` without a symbol is usually strictly rate-limited, an exchange may ban you if you poll that endpoint too frequently.** + +### Ticker Structure + +A ticker is a statistical calculation with the information calculated over the past 24 hours for a specific market. + +The structure of a ticker is as follows: + +```javascript +{ + 'symbol': string symbol of the market ('BTC/USD', 'ETH/BTC', ...) + 'info': { the original non-modified unparsed reply from exchange API }, + 'timestamp': int (64-bit Unix Timestamp in milliseconds since Epoch 1 Jan 1970) + 'datetime': ISO8601 datetime string with milliseconds + 'high': float, // highest price + 'low': float, // lowest price + 'bid': float, // current best bid (buy) price + 'bidVolume': float, // current best bid (buy) amount (may be missing or undefined) + 'ask': float, // current best ask (sell) price + 'askVolume': float, // current best ask (sell) amount (may be missing or undefined) + 'vwap': float, // volume weighed average price + 'open': float, // opening price + 'close': float, // price of last trade (closing price for current period) + 'last': float, // same as `close`, duplicated for convenience + 'previousClose': float, // closing price for the previous period + 'change': float, // absolute change, `last - open` + 'percentage': float, // relative change, `(change/open) * 100` + 'average': float, // average price, `(last + open) / 2` + 'baseVolume': float, // volume of base currency traded for last 24 hours + 'quoteVolume': float, // volume of quote currency traded for last 24 hours +} +``` + +#### Notes On Ticker Structure + +- All fields in the ticker represent the past 24 hours prior to `timestamp`. +- The `bidVolume` is the volume (amount) of current best bid in the orderbook. +- The `askVolume` is the volume (amount) of current best ask in the orderbook. +- The `baseVolume` is the amount of base currency traded (bought or sold) in last 24 hours. +- The `quoteVolume` is the amount of quote currency traded (bought or sold) in last 24 hours. + +**All prices in ticker structure are in quote currency. Some fields in a returned ticker structure may be undefined/None/null.** + +```text +base currency ↓ + BTC / USDT + ETH / BTC + DASH / ETH + ↑ quote currency +``` + +Timestamp and datetime are both Universal Time Coordinated (UTC) in milliseconds. + +- `ticker['timestamp']` is the time when the exchange generated this response (before replying it back to you). It may be missing (`undefined/None/null`), as documented in the Manual, not all exchanges provide a timestamp there. If it is defined, then it is a UTC timestamp **in milliseconds** since 1 Jan 1970 00:00:00. +- `exchange.last_response_headers['Date']` is the date-time string of the last HTTP response received (from HTTP headers). The 'Date' parser should respect the timezone designated there. The precision of the date-time is 1 second, 1000 milliseconds. This date should be set by the exchange server when the message originated according to the following standards: + - https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18 + - https://tools.ietf.org/html/rfc1123#section-5.2.14 + - https://tools.ietf.org/html/rfc822#section-5 + +Although some exchanges do mix-in orderbook's top bid/ask prices into their tickers (and some exchanges even serve top bid/ask volumes) you should not treat a ticker as a `fetchOrderBook` replacement. The main purpose of a ticker is to serve statistical data, as such, treat it as "live 24h OHLCV". It is known that exchanges discourage frequent `fetchTicker` requests by imposing stricter rate limits on these queries. If you need a unified way to access bids and asks you should use `fetchL[123]OrderBook` family instead. + +To get historical prices and volumes use the unified [`fetchOHLCV`](#ohlcv-candlestick-charts) method where available. To get historical mark, index, and premium index prices, add one of `'price': 'mark'`, `'price': 'index'`, `'price': 'premiumIndex'` respectively to the [params-overrides](#overriding-unified-api-params) of `fetchOHLCV`. There are also convenience methods `fetchMarkPriceOHLCV`, `fetchIndexPriceOHLCV`, and `fetchPremiumIndexOHLCV` that obtain the mark, index and premiumIndex historical prices and volumes. + +Methods for fetching tickers: + +- `fetchTicker (symbol[, params = {}])`, symbol is required, params are optional +- `fetchTickers ([symbols = undefined[, params = {}]])`, both arguments optional + +### Individually By Symbol + +To get the individual ticker data from an exchange for a particular trading pair or a specific symbol – call the `fetchTicker (symbol)`: + + +#### **Javascript** +```javascript +if (exchange.has['fetchTicker']) { + console.log (await (exchange.fetchTicker ('BTC/USD'))) // ticker for BTC/USD + let symbols = Object.keys (exchange.markets) + let random = Math.floor (Math.random () * (symbols.length - 1)) + console.log (exchange.fetchTicker (symbols[random])) // ticker for a random symbol +} +``` +#### **Python** +```python +import random +if (exchange.has['fetchTicker']): + print(exchange.fetch_ticker('LTC/ZEC')) # ticker for LTC/ZEC + symbols = list(exchange.markets.keys()) + print(exchange.fetch_ticker(random.choice(symbols))) # ticker for a random symbol +``` +#### **PHP** +```php +//(don't forget to set your timezone properly!) +if ($exchange->has['fetchTicker']) { + var_dump ($exchange->fetch_ticker ('ETH/CNY')); // ticker for ETH/CNY + $symbols = array_keys ($exchange->markets); + $random = rand () % count ($symbols); + var_dump ($exchange->fetch_ticker ($symbols[$random])); // ticker for a random symbol +} +``` + + +### All At Once + +Some exchanges (not all of them) also support fetching all tickers at once. See [their docs](#exchanges) for details. You can fetch all tickers with a single call like so: + + +#### **Javascript** +```javascript +if (exchange.has['fetchTickers']) { + console.log (await (exchange.fetchTickers ())) // all tickers indexed by their symbols +} +``` +#### **Python** +```python +if (exchange.has['fetchTickers']): + print(exchange.fetch_tickers()) # all tickers indexed by their symbols +``` +#### **PHP** +```php +if ($exchange->has['fetchTickers']) { + var_dump ($exchange->fetch_tickers ()); // all tickers indexed by their symbols +} +``` + + +Fetching all tickers requires more traffic than fetching a single ticker. Also, note that some exchanges impose higher rate-limits on subsequent fetches of all tickers (see their docs on corresponding endpoints for details). **The cost of the `fetchTickers()` call in terms of rate limit is often higher than average**. If you only need one ticker, fetching by a particular symbol is faster as well. You probably want to fetch all tickers only if you really need all of them and, most likely, you don't want to fetchTickers more frequently than once in a minute or so. + +Also, some exchanges may impose additional requirements on the `fetchTickers()` call, sometimes you can't fetch the tickers for all symbols because of the API limitations of the exchange in question. Some exchanges accept a list of symbols in HTTP URL query params, however, because URL length is limited, and in extreme cases exchanges can have thousands of markets – a list of all their symbols simply would not fit in the URL, so it has to be a limited subset of their symbols. Sometimes, there are other reasons for requiring a list of symbols, and there may be a limit on the number of symbols you can fetch at once, but whatever the limitation, please, blame the exchange. To pass the symbols of interest to the exchange, you can supply a list of strings as the first argument to fetchTickers: + + +#### **Javascript** +```javascript +//JavaScript +if (exchange.has['fetchTickers']) { + console.log (await (exchange.fetchTickers ([ 'ETH/BTC', 'LTC/BTC' ]))) // listed tickers indexed by their symbols +} +``` +#### **Python** +```python +if (exchange.has['fetchTickers']): + print(exchange.fetch_tickers(['ETH/BTC', 'LTC/BTC'])) # listed tickers indexed by their symbols +``` +#### **PHP** +```php +if ($exchange->has['fetchTickers']) { + var_dump ($exchange->fetch_tickers (array ('ETH/BTC', 'LTC/BTC'))); // listed tickers indexed by their symbols +} +``` + + +Note that the list of symbols is not required in most cases, but you must add additional logic if you want to handle all possible limitations that might be imposed on the exchanges' side. + +Like most methods of the Unified CCXT API, the last argument to fetchTickers is the `params` argument for overriding request parameters that are sent towards the exchange. + +The structure of the returned value is as follows: + +```javascript +{ + 'info': { ... }, // the original JSON response from the exchange as is + 'BTC/USD': { ... }, // a single ticker for BTC/USD + 'ETH/BTC': { ... }, // a ticker for ETH/BTC + ... +} +``` + +A general solution for fetching all tickers from all exchanges (even the ones that don't have a corresponding API endpoint) is on the way, this section will be updated soon. + +```text +UNDER CONSTRUCTION +``` + +## OHLCV Candlestick Charts + +Most exchanges have endpoints for fetching OHLCV data, but some of them don't. The exchange boolean (true/false) property named `has['fetchOHLCV']` indicates whether the exchange supports candlestick data series or not. + +To fetch OHLCV candles/bars from an exchange, ccxt has the `fetchOHLCV` method, which is declared in the following way: + +```javascript +fetchOHLCV (symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) +``` + +You can call the unified `fetchOHLCV` / `fetch_ohlcv` method to get the list of OHLCV candles for a particular symbol like so: + + +#### **Javascript** +```javascript +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)); +if (exchange.has.fetchOHLCV) { + for (symbol in exchange.markets) { + await sleep (exchange.rateLimit) // milliseconds + console.log (await exchange.fetchOHLCV (symbol, '1m')) // one minute + } +} +``` +#### **Python** +```python +import time +if exchange.has['fetchOHLCV']: + for symbol in exchange.markets: + time.sleep (exchange.rateLimit / 1000) # time.sleep wants seconds + print (symbol, exchange.fetch_ohlcv (symbol, '1d')) # one day +``` +#### **PHP** +```php +if ($exchange->has['fetchOHLCV']) { + foreach ($exchange->markets as $symbol => $market) { + usleep ($exchange->rateLimit * 1000); // usleep wants microseconds + var_dump ($exchange->fetch_ohlcv ($symbol, '1M')); // one month + } +} +``` + + +To get the list of available timeframes for your exchange see the `timeframes` property. Note that it is only populated when `has['fetchOHLCV']` is true as well. + +The returned list of candles may have one or more missing periods, if the exchange did not have any trades for the specified timerange and symbol. To a user that would appear as gaps in a continuous list of candles. That is considered normal. If the exchange did not have any candles at that time, the CCXT library will show the results as returned from the exchange itself. + +**There's a limit on how far back in time your requests can go.** Most of exchanges will not allow to query detailed candlestick history (like those for 1-minute and 5-minute timeframes) too far in the past. They usually keep a reasonable amount of most recent candles, like 1000 last candles for any timeframe is more than enough for most of needs. You can work around that limitation by continuously fetching (aka *REST polling*) latest OHLCVs and storing them in a CSV file or in a database. + +**Note that the info from the last (current) candle may be incomplete until the candle is closed (until the next candle starts).** + +Like with most other unified and implicit methods, the `fetchOHLCV` method accepts as its last argument an associative array (a dictionary) of extra `params`, which is used to [override default values](#overriding-unified-api-params) that are sent in requests to the exchanges. The contents of `params` are exchange-specific, consult the exchanges' API documentation for supported fields and values. + +The `since` argument is an integer UTC timestamp **in milliseconds** (everywhere throughout the library with all unified methods). + +If `since` is not specified the `fetchOHLCV` method will return the time range as is the default from the exchange itself. This is not a bug. Some exchanges will return candles from the beginning of time, others will return most recent candles only, the exchanges' default behaviour is expected. Thus, without specifying `since` the range of returned candles will be exchange-specific. One should pass the `since` argument to ensure getting precisely the history range needed. + +### Get raw OHLCV response + +Currently, the structure CCXT uses does not include the raw response from the exchange. However, users might be able to override the return value by doing: + + +#### **Javascript** +```javascript +const ex = new ccxt.coinbase(); +const originalParser = ex.parseOHLCV.bind(ex); +ex.parseOHLCV = ((ohlcv, market = undefined) => { + return { + 'result': originalParser(ohlcv, market), + 'raw': ohlcv, + }; +}); +const result = await ex.fetchOHLCV('BTC/USDT', '1m'); +console.log (result[0]); +``` +#### **Python** +```python +# add raw member at last position in list +async def test(): + ex = ccxt.async_support.coinbase() + prase_ohlcv_original = ex.parse_ohlcv + def prase_ohlcv_custom(ohlcv, market): + res = prase_ohlcv_original(ohlcv, market) + res.append(ohlcv) + return res + ex.parse_ohlcv = prase_ohlcv_custom + result = await ex.fetch_ohlcv('BTC/USDT', '1m') + print (result[0]) + +asyncio.run(test()) +``` + + + +### Notes On Latency + +Trading strategies require fresh up-to-date information for technical analysis, indicators and signals. Building a speculative trading strategy based on the OHLCV candles received from the exchange may have critical drawbacks. Developers should account for the details explained in this section to build successful bots. + +First and foremost, when using CCXT you're talking to the exchanges directly. CCXT is not a server, nor a service, it's a software library. All data that you are getting with CCXT is received directly from the exchanges first-hand. + +The exchanges usually provide two categories of public market data: + +1. Fast primary first-order data that includes real time orderbooks and trades or fills +2. Slow second-order data that includes secondary tickers and kline OHLCV candles, that are calculated from the first-order data + +The primary first-order data is updated by the exchanges APIs in pseudo real time, or as close to real time as possible, as fast as possible. The second-order data requires time for the exchange to calculate it. For example, a ticker is nothing more than a rolling 24-hour statistical cut of orderbooks and trades. OHLCV candles and volumes are also calculated from first-order trades and represent fixed statistical cuts of specific periods. The volume traded within an hour is just a sum of traded volumes of the corresponding trades that happened within that hour. + +Obviously, it takes some time for the exchange to collect the first-order data and calculate the secondary statistical data from it. That literally means that **tickers and OHLCVs are always slower than orderbooks and trades**. In other words, there is always some latency in the exchange API between the moment when a trade happens and the moment when a corresponding OHLCV candle is updated or published by the exchange API. + +The latency (or how much time is needed by the exchange API for calculating the secondary data) depends on how fast the exchange engine is, so it is exchange-specific. Top exchange engines will usually return and update fresh last-minute OHLCV candles and tickers at a very fast rate. Some exchanges might do it in regular intervals like once a second or once in a few seconds. Slow exchange engines might take minutes to update the secondary statistical information, their APIs might return the current most recent OHLCV candle a few minutes late. + +If your strategy depends on the fresh last-minute most recent data you don't want to build it based on tickers or OHLCVs received from the exchange. Tickers and exchanges' OHLCVs are only suitable for display purposes, or for simple trading strategies for hour-timeframes or day-timeframes that are less susceptible to latency. + +Thankfully, the developers of time-critical trading strategies don't have to rely on secondary data from the exchanges and can calculate the OHLCVs and tickers in the userland. That may be faster and more efficient than waiting for the exchanges to update the info on their end. One can aggregate the public trade history by polling it frequently and calculate candles by walking over the list of trades - please take a look into "build-ohlcv-bars" file inside [examples folder](https://github.com/ccxt/ccxt/tree/master/examples) + +Due to the differences in their internal implementations the exchanges may be faster to update their primary and secondary market data over WebSockets. The latency remains exchange-specific, cause the exchange engine still needs time to calculate the secondary data, regardless of whether you're polling it over the RESTful API with CCXT or getting updates via WebSockets with CCXT Pro. WebSockets can improve the networking latency, so a fast exchange will work even better, but adding the support for WS subscriptions will not make a slow exchange engine work much faster. + +If you want to stay on top of the second-order data latency, then you will have to calculate it on your side and beat the exchange engine in speed of doing so. Depending on the needs of your application, it may be tricky, since you will need to handle redundancy, "data holes" in the history, exchange downtimes, and other aspects of data aggregation which is a whole universe in itself that is impossible to fully cover in this Manual. + +### OHLCV Structure + +The fetchOHLCV method shown above returns a list (a flat array) of OHLCV candles represented by the following structure: + +```javascript +[ + [ + 1504541580000, // UTC timestamp in milliseconds, integer + 4235.4, // (O)pen price, float + 4240.6, // (H)ighest price, float + 4230.0, // (L)owest price, float + 4230.7, // (C)losing price, float + 37.72941911 // (V)olume float (usually in terms of the base currency, the exchanges docstring may list whether quote or base units are used) + ], + ... +] +``` + +The list of candles is returned sorted in ascending (historical/chronological) order, oldest candle first, most recent candle last. + +### Mark, Index and PremiumIndex Candlestick Charts + +To obtain historical Mark, Index Price and Premium Index candlesticks pass the `'price'` [params-override](overriding-unified-api-params) to `fetchOHLCV`. The `'price'` parameter accepts one of the following values: + +- `'mark'` +- `'index'` +- `'premiumIndex'` + +```javascript +// JavaScript +async function main () { + const exchange = new ccxt.binanceusdm () + const markKlines = await exchange.fetchOHLCV ('ADA/USDT', '1h', undefined, undefined, { 'price': 'mark' }) + console.log (markKlines) + const indexKlines = await exchange.fetchOHLCV ('ADA/USDT', '1h', undefined, undefined, { 'price': 'index' }) + console.log (indexKlines) +} + +main () +``` + +There are also convenience methods `fetchMarkOHLCV`, `fetchIndexOHLCV` and `fetchPremiumIndexOHLCV` + + +#### **Javascript** +```javascript +async function main () { + const exchange = new ccxt.binanceusdm () + const markKlines = await exchange.fetchMarkOHLCV ('ADA/USDT', '1h') + console.log (markKlines) + const indexKlines = await exchange.fetchIndexOHLCV ('ADA/USDT', '1h') + console.log (indexKlines) +} + +main () +``` +#### **Python** +```python +exchange = ccxt.binance() +response = exchange.fetch_ohlcv('ADA/USDT', '1h', params={'price':'index'}) +pprint(response) +# Convenience methods +mark_klines = exchange.fetch_mark_ohlcv('ADA/USDT', '1h') +index_klines = exchange.fetch_index_ohlcv('ADA/USDT', '1h') +pprint(mark_klines) +pprint(index_klines) +``` + + +### OHLCV Emulation + +Some exchanges don't offer any OHLCV method, and for those, the ccxt library will emulate OHLCV candles from [Public Trades](#public-trades). In that case you will see `exchange.has['fetchOHLCV'] = 'emulated'`. However, because the trade history is usually very limited, the emulated fetchOHLCV methods cover most recent info only and should only be used as a fallback, when no other option is available. + +**WARNING: the fetchOHLCV emulation is experimental!** + +```text +UNDER CONSTRUCTION +``` + +## Public Trades + +```diff +- this is under heavy development right now, contributions appreciated +``` + +You can call the unified `fetchTrades` / `fetch_trades` method to get the list of most recent trades for a particular symbol. The `fetchTrades` method is declared in the following way: + +```javascript +async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) +``` + +For example, if you want to print recent trades for all symbols one by one sequentially (mind the rateLimit!) you would do it like so: + + +#### **Typescript** +```javascript +if (exchange.has['fetchTrades']) { + let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)); + for (symbol in exchange.markets) { + console.log (await exchange.fetchTrades (symbol)) + } +} +``` +#### **Python** +```python +import time +if exchange.has['fetchTrades']: + for symbol in exchange.markets: # ensure you have called loadMarkets() or load_markets() method. + print (symbol, exchange.fetch_trades (symbol)) +``` +#### **PHP** +```php +if ($exchange->has['fetchTrades']) { + foreach ($exchange->markets as $symbol => $market) { + var_dump ($exchange->fetch_trades ($symbol)); + } +} +``` + + +The fetchTrades method shown above returns an ordered list of trades (a flat array, sorted by timestamp in ascending order, oldest trade first, most recent trade last). A list of trades is represented by the [trade structure](#trade-structure). + +```javascript +[ + { + 'info': { ... }, // the original decoded JSON as is + 'id': '12345-67890:09876/54321', // string trade id + 'timestamp': 1502962946216, // Unix timestamp in milliseconds + 'datetime': '2017-08-17 12:42:48.000', // ISO8601 datetime with milliseconds + 'symbol': 'ETH/BTC', // symbol + 'order': '12345-67890:09876/54321', // string order id or undefined/None/null + 'type': 'limit', // order type, 'market', 'limit' or undefined/None/null + 'side': 'buy', // direction of the trade, 'buy' or 'sell' + 'takerOrMaker': 'taker', // string, 'taker' or 'maker' + 'price': 0.06917684, // float price in quote currency + 'amount': 1.5, // amount of base currency + 'cost': 0.10376526, // total cost, `price * amount`, + 'fee': { // if provided by exchange or calculated by ccxt + 'cost': 0.0015, // float + 'currency': 'ETH', // usually base currency for buys, quote currency for sells + 'rate': 0.002, // the fee rate (if available) + }, + 'fees': [ // an array of fees if paid in multiple currencies + { // if provided by exchange or calculated by ccxt + 'cost': 0.0015, // float + 'currency': 'ETH', // usually base currency for buys, quote currency for sells + 'rate': 0.002, // the fee rate (if available) + }, + ] + }, + ... +] +``` + +Most exchanges return most of the above fields for each trade, though there are exchanges that don't return the type, the side, the trade id or the order id of the trade. Most of the time you are guaranteed to have the timestamp, the datetime, the symbol, the price and the amount of each trade. + +The second optional argument `since` reduces the array by timestamp, the third `limit` argument reduces by number (count) of returned items. + +If the user does not specify `since`, the `fetchTrades` method will return the default range of public trades from the exchange. The default set is exchange-specific, some exchanges will return trades starting from the date of listing a pair on the exchange, other exchanges will return a reduced set of trades (like, last 24 hours, last 100 trades, etc). If the user wants precise control over the timeframe, the user is responsible for specifying the `since` argument. + +Most of unified methods will return either a single object or a plain array (a list) of objects (trades). However, very few exchanges (if any at all) will return all trades at once. Most often their APIs `limit` output to a certain number of most recent objects. **YOU CANNOT GET ALL OBJECTS SINCE THE BEGINNING OF TIME TO THE PRESENT MOMENT IN JUST ONE CALL**. Practically, very few exchanges will tolerate or allow that. + +To fetch historical trades, the user will need to traverse the data in portions or "pages" of objects. Pagination often implies *"fetching portions of data one by one"* in a loop. + +In most cases users are **required to use at least some type of pagination** in order to get the expected results consistently. + +On the other hand, **some exchanges don't support pagination for public trades at all**. In general the exchanges will provide just the most recent trades. + +The `fetchTrades ()` / `fetch_trades()` method also accepts an optional `params` (assoc-key array/dict, empty by default) as its fourth argument. You can use it to pass extra params to method calls or to override a particular default value (where supported by the exchange). See the API docs for your exchange for more details. + +## Exchange Time + +The `fetchTime()` method (if available) returns the current integer timestamp in milliseconds from the exchange server. + +```javascript +fetchTime(params = {}) +``` + +## Exchange Status + +The exchange status describes the latest known information on the availability of the exchange API. This information is either hardcoded into the exchange class or fetched live directly from the exchange API. The `fetchStatus(params = {})` method can be used to get this information. The status returned by `fetchStatus` is one of: + +- Hardcoded into the exchange class, e.g. if the API has been broken or shutdown. +- Updated using the exchange ping or `fetchTime` endpoint to see if its alive +- Updated using the dedicated exchange API status endpoint. + +```javascript +fetchStatus(params = {}) +``` + +### Exchange Status Structure + +The `fetchStatus()` method will return a status structure like shown below: + +```javascript +{ + 'status': 'ok', // 'ok', 'shutdown', 'error', 'maintenance' + 'updated': undefined, // integer, last updated timestamp in milliseconds if updated via the API + 'eta': undefined, // when the maintenance or outage is expected to end + 'url': undefined, // a link to a GitHub issue or to an exchange post on the subject +} +``` + +The possible values in the `status` field are: + +- `'ok'` means the exchange API is fully operational +- `'shutdown`' means the exchange was closed, and the `updated` field should contain the datetime of the shutdown +- `'error'` means that either the exchange API is broken, or the implementation of the exchange in CCXT is broken +- `'maintenance'` means regular maintenance, and the `eta` field should contain the datetime when the exchange is expected to be operational again + +## Borrow Rates + +*margin only* + +When short trading or trading with leverage on a spot market, currency must be borrowed. Interest is accrued for the borrowed currency. + +Data on the borrow rate for a currency can be retrieved using + +- `fetchCrossBorrowRate ()` for a single currencies borrow rate +- `fetchCrossBorrowRates ()` for all currencies borrow rates +- `fetchIsolatedBorrowRate ()` for a trading pairs borrow rate +- `fetchIsolatedBorrowRates ()` for all trading pairs borrow rates +- `fetchBorrowRatesPerSymbol ()` for the borrow rates of currencies in individual markets + +```javascript +fetchCrossBorrowRate (code, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code, required (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"settle": "USDT"}`) + +Returns + +- A [borrow rate structure](#borrow-rate-structure) + +```javascript +fetchCrossBorrowRates (params = {}) +``` + +Parameters + +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"startTime": 1610248118000}`) + +Returns + +- A dictionary of [borrow rate structures](#borrow-rate-structure) with unified currency codes as keys + +```javascript +fetchIsolatedBorrowRate (symbol, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT market symbol, required (e.g. `"BTC/USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"settle": "USDT"}`) + +Returns + +- An [isolated borrow rate structure](#isolated-borrow-rate-structure) + +```javascript +fetchIsolatedBorrowRates (params = {}) +``` + +Parameters + +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"startTime": 1610248118000}`) + +Returns + +- A dictionary of [isolated borrow rate structures](#isolated-borrow-rate-structure) with unified market symbols as keys + +### Isolated Borrow Rate Structure + +```javascript +{ + symbol: 'BTC/USDT', // Unified market symbol + base: 'BTC', // Unified currency code of the base currency + baseRate: 0.00025, // A decimal value rate that interest is accrued at + quote: 'USDT', // Unified currency code of the quote currency + quoteRate: 0.00025, // A decimal value rate that interest is accrued at + period: 86400000, // The amount of time in milliseconds that is required to accrue the interest amount specified by rate + timestamp: 1646956800000, // Timestamp for when the currency had this rate + datetime: '2022-03-11T00:00:00.000Z', // Datetime for when the currency had this rate + info: [ ... ] +} +``` + +### Borrow Rate Structure + +```javascript +{ + currency: 'USDT', // Unified currency code + rate: 0.0006, // A ratio of the rate that interest is accrued at + period: 86400000, // The amount of time in milliseconds that is required to accrue the interest amount specified by rate + timestamp: 1646956800000, // Timestamp for when the currency had this rate + datetime: '2022-03-11T00:00:00.000Z', // Datetime for when the currency had this rate + info: [ ... ] +} +``` + +## Borrow Rate History + +*margin only* + +The `fetchBorrowRateHistory` method retrieves a history of a currencies borrow interest rate at specific time slots + +```javascript +fetchBorrowRateHistory (code, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **code** (String) *required* Unified CCXT currency code (e.g. `"USDT"`) +- **since** (Integer) Timestamp for the earliest borrow rate (e.g. `1645807945000`) +- **limit** (Integer) The maximum number of [borrow rate structures](#borrow-rate-structure) to retrieve (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [borrow rate structures](#borrow-rate-structure) + +## Leverage Tiers + +*contract only* + +- Leverage Tier methods are private on **binance** + +The `fetchLeverageTiers()` method can be used to obtain the maximum leverage for a market at varying position sizes. It can also be used to obtain the maintenance margin rate, and the max tradeable amount for a market when that information is not available from the market object + +While you can obtain the absolute maximum leverage for a market by accessing `market['limits']['leverage']['max']`, for many contract markets, the maximum leverage will depend on the size of your position. + +You can access those limits by using + +- `fetchMarketLeverageTiers()` (single symbol) +- `fetchLeverageTiers([symbol1, symbol2, ...])` (multiple symbols) +- `fetchLeverageTiers()` (all market symbols) + +```javascript +fetchMarketLeverageTiers(symbol, params = {}) +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"settle": "usdt"}`) + +Returns + +- a [leverage-tiers-structure](#leverage-tiers-structure) + +```javascript +fetchLeverageTiers(symbols = undefined, params = {}) +``` + +Parameters + +- **symbols** (\[String\]) Unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"settle": "usdt"}`) + +Returns + +- an array of [leverage-tiers-structures](#leverage-tiers-structure) + +### Leverage Tiers Structure + +```javascript +[ + { + "tier": 1, // tier index + "symbol": "BTC/USDT", // the market symbol that the leverage tier applies to + "currency": "USDT", // the currency that minNotional and maxNotional are in + "minNotional": 0, // the lowest amount of this tier // stake = 0.0 + "maxNotional": 10000, // the highest amount of this tier // max stake amount at 75x leverage = 133.33333333333334 + "maintenanceMarginRate": 0.0065, // maintenance margin rate + "maxLeverage": 75, // max available leverage for this market when the value of the trade is > minNotional and < maxNotional + "info": { ... } // Response from exchange + }, + { + "tier": 2, + "symbol": "BTC/USDT", + "currency": "USDT", + "minNotional": 10000, // min stake amount at 50x leverage = 200.0 + "maxNotional": 50000, // max stake amount at 50x leverage = 1000.0 + "maintenanceMarginRate": 0.01, + "maxLeverage": 50, + "info": { ... }, + }, + ... + { + "tier": 9, + "symbol": "BTC/USDT", + "currency": "USDT", + "minNotional": 20000000, + "maxNotional": 50000000, + "maintenanceMarginRate": 0.5, + "maxLeverage": 1, + "info": { ... }, + }, +] +``` + +In the example above: + +- stakes below 133.33 = a max leverage of 75 +- stakes from 200 + 1000 = a max leverage of 50 +- a stake amount of 150 = a max leverage of (10000 / 150) = 66.66 +- stakes between 133.33-200 = a max leverage of (10000 / stake) = 50.01 -> 74.99 + +**Note for Huobi users:** Huobi uses both leverage and amount to determine maintenance margin rates: https://www.huobi.com/support/en-us/detail/900000089903 + +## Funding Rate + +*contract only* + +Data on the current, most recent, and next funding rates can be obtained using the methods + +- `fetchFundingRates ()` for all market symbols +- `fetchFundingRates ([ symbol1, symbol2, ... ])` for multiple market symbols +- `fetchFundingRate (symbol)` for a single market symbol + +```javascript +fetchFundingRate (symbol, params = {}) +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- a [funding rate structure](#funding-rate-structure) + +```javascript +fetchFundingRates (symbols = undefined, params = {}) +``` + +Parameters + +- **symbols** (\[String\]) An optional array/list of unified CCXT symbols (e.g. `["BTC/USDT:USDT", "ETH/USDT:USDT"]`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [funding rate structures](#funding-rate-structure) indexed by market symbols + +## Funding Interval + +*contract only* + +Retrieve the current funding interval using the following methods: + +- `fetchFundingInterval (symbol)` for a single market symbol +- `fetchFundingIntervals ()` for all market symbols +- `fetchFundingIntervals ([ symbol1, symbol2, ... ])` for multiple market symbols + +```javascript +fetchFundingInterval (symbol, params = {}) +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- A [funding rate structure](#funding-rate-structure) + +```javascript +fetchFundingIntervals (symbols = undefined, params = {}) +``` + +Parameters + +- **symbols** (\[String\]) An optional array/list of unified CCXT symbols (e.g. `["BTC/USDT:USDT", "ETH/USDT:USDT"]`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [funding rate structures](#funding-rate-structure) + +### Funding Rate Structure + +```javascript +{ + info: { ... }, + symbol: 'BTC/USDT:USDT', + markPrice: 39294.43, + indexPrice: 39291.78, + interestRate: 0.0003, + estimatedSettlePrice: undefined, + timestamp: undefined, + datetime: undefined, + fundingRate: 0.000072, + fundingTimestamp: 1645833600000, + fundingDatetime: '2022-02-26T00:00:00.000Z', + nextFundingRate: -0.000018, // nextFundingRate is actually two funding rates from now + nextFundingTimestamp: undefined, + nextFundingDatetime: undefined, + previousFundingRate: undefined, + previousFundingTimestamp: undefined, + previousFundingDatetime: undefined, + interval: '8h', +} +``` + +## Funding Rate History + +*contract only* + +```javascript +fetchFundingRateHistory (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **since** (Integer) Timestamp for the earliest funding rate (e.g. `1645807945000`) +- **limit** (Integer) The maximum number of funding rates to retrieve (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [funding rate history structures](#funding-rate-history-structure) + +### Funding Rate History Structure + +```javascript +{ + info: { ... }, + symbol: "BTC/USDT:USDT", + fundingRate: -0.000068, + timestamp: 1642953600000, + datetime: "2022-01-23T16:00:00.000Z" +} +``` + +## Open Interest + +*contract only* + +Use the `fetchOpenInterest` method to get the current open interest for a symbol from the exchange. + +```javascript +fetchOpenInterest (symbol, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- A dictionary of [open interest structures](#open-interest-structure) + +### Open Interest History + +*contract only* + +Use the `fetchOpenInterestHistory` method to get a history of open interest for a symbol from the exchange. + +```javascript +fetchOpenInterestHistory (symbol, timeframe = '5m', since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **timeframe** (String) Check exchange.timeframes for available values +- **since** (Integer) Timestamp for the earliest open interest record (e.g. `1645807945000`) +- **limit** (Integer) The maximum number of [open interest structures](#open-interest-structures) to retrieve (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +**Note for OKX users:** instead of a unified symbol okx.fetchOpenInterestHistory expects a unified currency code in the **symbol** argument (e.g. `'BTC'`). + +Returns + +- An array of [open interest structures](#open-interest-structure) + +### Open Interest Structure + +```javascript +{ + symbol: 'BTC/USDT', + baseVolume: 80872.801, // deprecated + quoteVolume: 3508262107.38, // deprecated + openInterestAmount: 80872.801, + openInterestValue: 3508262107.38, + timestamp: 1649379000000, + datetime: '2022-04-08T00:50:00.000Z', + info: { + symbol: 'BTCUSDT', + sumOpenInterest: '80872.80100000', + sumOpenInterestValue: '3508262107.38000000', + timestamp: '1649379000000' + } +} +``` + +## Historical Volatility + +*option only* + +Use the `fetchVolatilityHistory` method to get the volatility history for the code of an options underlying asset from the exchange. + +```javascript +fetchVolatilityHistory (code, params = {}) +``` + +Parameters + +- **code** (String) *required* Unified CCXT currency code (e.g. `"BTC"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [volatility history structures](#volatility-structure) + +### Volatility Structure + +```javascript +{ + info: { + "period": 7, + "value": "0.23854072", + "time": "1690574400000" + } + timestamp: 1649379000000, + datetime: '2023-07-28T00:50:00.000Z', + volatility: 0.23854072, +} +``` + +## Underlying Assets + +*contract only* + +Use the `fetchUnderlyingAssets` method to get the market id's of underlying assets for a contract market type from the exchange. + +```javascript +fetchUnderlyingAssets (params = {}) +``` + +Parameters + +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"instType": "OPTION"}`) +- **params.type** (String) Unified marketType, the default is 'option' (e.g. `"option"`) + +Returns + +- An [underlying assets structure](#underlying-assets-structure) + +### Underlying Assets Structure + +```javascript +[ 'BTC_USDT', 'ETH_USDT', 'DOGE_USDT' ] +``` + +## Settlement History + +*contract only* + +Use the `fetchSettlementHistory` method to get the public settlement history for a contract market from the exchange. + +```javascript +fetchSettlementHistory (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT symbol (e.g. `"BTC/USDT:USDT-230728-25500-P"`) +- **since** (Integer) Timestamp for the earliest settlement (e.g. `1694073600000`) +- **limit** (Integer) The maximum number of settlements to retrieve (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [settlement history structures](#settlement-history-structure) + +### Settlement History Structure + +```javascript +{ + info: { ... }, + symbol: 'BTC/USDT:USDT-230728-25500-P', + price: 25761.35807869, + timestamp: 1694073600000, + datetime: '2023-09-07T08:00:00.000Z', +} +``` + +## Liquidations + +Use the `fetchLiquidations` method to get the public liquidations of a trading pair from the exchange. + +```javascript +fetchLiquidations (symbol, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT symbol (e.g. `"BTC/USDT:USDT-231006-25000-P"`) +- **since** (Integer) Timestamp for the earliest liquidation (e.g. `1694073600000`) +- **limit** (Integer) The maximum number of liquidations to retrieve (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"until": 1645807945000}`) + +Returns + +- An array of [liquidation structures](#liquidation-structure) + +### Liquidation Structure + +```javascript +[ + { + 'info': { ... }, // the original decoded JSON as is + 'symbol': 'BTC/USDT:USDT-231006-25000-P', // unified CCXT market symbol + 'contracts': 2, // the number of derivative contracts + 'contractSize': 0.001, // the contract size for the trading pair + 'price': 27038.64, // the average liquidation price in the quote currency + 'baseValue': 0.002, // value in the base currency (contracts * contractSize) + 'quoteValue': 54.07728, // value in the quote currency ((contracts * contractSize) * price) + 'timestamp': 1696996782210, // Unix timestamp in milliseconds + 'datetime': '2023-10-11 03:59:42.000', // ISO8601 datetime with milliseconds + }, + ... +] +``` + +## Greeks + +*option only* + +Use the `fetchGreeks` method to get the public greeks and implied volatility of an options trading pair from the exchange. Use `fetchAllGreeks` to get the greeks for all symbols or multiple symbols. +The greeks measure how factors like the underlying assets price, time to expiration, volatility, and interest rates, affect the price of an options contract. + +```javascript +fetchGreeks (symbol, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT symbol (e.g. `"BTC/USD:BTC-240927-40000-C"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"category": "options"}`) + +Returns + +- A [greeks structure](#greeks-structure) + +```javascript +fetchAllGreeks (symbols = undefined, params = {}) +``` + +Parameters + +- **symbols** (String) Unified CCXT symbol (e.g. `"BTC/USD:BTC-240927-40000-C"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"category": "options"}`) + +// for example +fetchAllGreeks () // all symbols +fetchAllGreeks ([ 'BTC/USD:BTC-240927-40000-C', 'ETH/USD:ETH-240927-4000-C' ]) // an array of specific symbols + +Returns + +- A list of [greeks structure](#greeks-structure) + +### Greeks Structure + +```javascript +{ + 'symbol': 'BTC/USD:BTC-240927-40000-C', // unified CCXT market symbol + 'timestamp': 1699593511632, // unix timestamp in milliseconds + 'datetime': '2023-11-10T05:18:31.632Z', // ISO8601 datetime with milliseconds + 'delta': 0.59833, // measures the rate of change in the options price per $1 change in the underlying assets price + 'gamma': 0.00002, // measures the rate of change in the delta per $1 change in the underlying assets price + 'theta': -13.4441, // measures the dollar amount that an options price will decline per day + 'vega': 142.30124, // measures the dollar amount that an options price changes with a 1% change in the implied volatility + 'rho': 131.82621, // measures the dollar amount that an options price changes with a 1% change in interest rates + 'vanna': 0.06671, // measures the amount that an options delta changes with a 1% change in implied volatility + 'volga': 925.95015, // measures the amount that an options vega changes with a 1% change in implied volatility + 'charm': 0.18433, // measures the amount that an options delta changes each day until expiration + 'bidSize': 2.2, // the options bid amount + 'askSize': 9, // the options ask amount + 'bidImpliedVolatility': 60.06, // the expected percentage price change of the underlying asset, over the remaining life of the option, calculated using the bid price + 'askImpliedVolatility': 61.85, // the expected percentage price change of the underlying asset, over the remaining life of the option, calculated using the ask price + 'markImpliedVolatility': 60.86, // the expected percentage price change of the underlying asset, over the remaining life of the option, calculated using the mark price + 'bidPrice': 0.214, // the bid price of the option + 'askPrice': 0.2205, // the ask price of the option + 'markPrice': 0.2169, // the mark price of the option + 'lastPrice': 0.215, // the last price of the option + 'underlyingPrice': 39165.86, // the current market price of the underlying asset + 'info': { ... }, // the original decoded JSON as is +} +``` + +## Option Chain + +*option only* + +Use the `fetchOption` method to get the public details of a single option contract from the exchange. + +```javascript +fetchOption (symbol, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USD:BTC-240927-40000-C"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"category": "options"}`) + +Returns + +- An [option chain structure](#option-chain-structure) + +Use the `fetchOptionChain` method to get the public option chain data of an underlying currency from the exchange. + +```javascript +fetchOptionChain (code, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code (e.g. `"BTC"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"category": "options"}`) + +Returns + +- A list of [option chain structures](#option-chain-structure) + +### Option Chain Structure + +```javascript +{ + 'info': { ... }, // the original decoded JSON as is + 'currency': 'BTC', // unified CCXT currency code + 'symbol': 'BTC/USD:BTC-240927-40000-C', // unified CCXT market symbol + 'timestamp': 1699593511632, // unix timestamp in milliseconds + 'datetime': '2023-11-10T05:18:31.632Z', // ISO8601 datetime with milliseconds + 'impliedVolatility': 60.06, // the expected percentage price change of the underlying asset, over the remaining life of the option + 'openInterest': 10, // the number of open options contracts that have not been settled + 'bidPrice': 0.214, // the bid price of the option + 'askPrice': 0.2205, // the ask price of the option + 'midPrice': 0.2205, // the price in between the bid and the ask + 'markPrice': 0.2169, // the mark price of the option + 'lastPrice': 0.215, // the last price of the option + 'underlyingPrice': 39165.86, // the current market price of the underlying asset + 'change': 15.43, // the 24 hour price change in a dollar amount + 'percentage': 11.86, // the 24 hour price change as a percentage + 'baseVolume': 100.86, // the volume in units of the base currency + 'quoteVolume': 23772.86, // the volume in units of the quote currency +} +``` + +## Long Short Ratio + +*contract only* + +Use the `fetchLongShortRatio` method to fetch the current long short ratio of a symbol and use the `fetchLongShortRatioHistory` to fetch the history of long short ratios for a symbol. + +- `fetchLongShortRatio (symbol, period)` for the current ratio of a single market symbol +- `fetchLongShortRatioHistory (symbol, period, since, limit)` for the history of ratios of a single market symbol + +```javascript +fetchLongShortRatio (symbol, period = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **period** (String) The period to calculate the ratio from (e.g. `"24h"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- a [long short ratio structure](#long-short-ratio-structure) + +```javascript +fetchLongShortRatioHistory (symbol = undefined, period = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **period** (String) The period to calculate the ratio from (e.g. `"24h"`) +- **since** (Integer) Timestamp for the earliest ratio (e.g. `1645807945000`) +- **limit** (Integer) The maximum number of ratios to retrieve (e.g. `10`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- an array of [long short ratio structures](#long-short-ratio-structure) + +### Long Short Ratio Structure + +```javascript +{ + info: { ... }, + symbol: 'BTC/USDT:USDT', + timestamp: 1645833600000, + datetime: '2022-02-26T00:00:00.000Z', + timeframe: '24h', + longShortRatio: 0.000072, +} +``` + +# Private API + +- [Authentication](#authentication) +- [Sign In](#sign-in) +- [API Keys Setup](#api-keys-setup) +- [Accounts](#accounts) +- [Account Balance](#account-balance) +- [Orders](#orders) +- [My Trades](#my-trades) +- [Ledger](#ledger) +- [Deposit](#deposit) +- [Withdrawal](#withdrawal) +- [Deposit Addresses](#deposit-addresses) +- [Transfers](#transfers) +- [Fees](#fees) +- [Borrow Interest](#borrow-interest) +- [Borrow And Repay Margin](#borrow-and-repay-margin) +- [Margin](#margin) +- [Margin Mode](#margin-mode) +- [Leverage](#leverage) +- [Positions](#positions) +- [Funding History](#funding-history) +- [Conversion](#conversion) + +In order to be able to access your user account, perform algorithmic trading by placing market and limit orders, query balances, deposit and withdraw funds and so on, you need to obtain your API keys for authentication from each exchange you want to trade with. They usually have it available on a separate tab or page within your user account settings. API keys are exchange-specific and cannnot be interchanged under any circumstances. + +The exchanges' private APIs will usually allow the following types of interaction: + +- the current state of the user's account balance can be obtained with the `fetchBalance()` method as described in the [Account Balance](#account-balance) section +- the user can place and cancel orders with `createOrder()`, `cancelOrder()`, as well as fetch current open orders and the past order history with methods like `fetchOrder`, `fetchOrders()`, `fetchOpenOrder()`, `fetchOpenOrders()`, `fetchCanceledOrders`, `fetchClosedOrder`, `fetchClosedOrders`, as described in the section on [Orders](#orders) +- the user can query the history of past trades executed with their account using `fetchMyTrades`, as described in the [My Trades](#my-trades) section, also see [How Orders Are Related To Trades](#how-orders-are-related-to-trades) +- the user can query their positions with `fetchPositions()` and `fetchPosition()` as described in the [Positions](#positions) section +- the user can fetch the history of their transactions (on-chain _transactions_ which are either _deposits_ to the exchange account or _withdrawals_ from the exchange account) with `fetchTransactions()`, or with `fetchDeposit()`, `fetchDeposits()` `fetchWithdrawal()`, and `fetchWithdrawals()` separately, depending on what is available from the exchange API +- if the exchange API provides a ledger endpoint, the user can fetch a history of all money movements that somehow affected the balance, with `fetchLedger` that will return all accounting ledger entries such as trades, deposits, withdrawals, internal transfers between accounts, rebates, bonuses, fees, staking profits and so on, as described in the [Ledger](#ledger) section. + +## Authentication + +Authentication with all exchanges is handled automatically if provided with proper API keys. The process of authentication usually goes through the following pattern: + +1. Generate new nonce. A nonce is an integer, often a Unix Timestamp in seconds or milliseconds (since epoch January 1, 1970). The nonce should be unique to a particular request and constantly increasing, so that no two requests share the same nonce. Each next request should have greater nonce than the previous request. **The default nonce is a 32-bit Unix Timestamp in seconds.** +2. Append public apiKey and nonce to other endpoint params, if any, then serialize the whole thing for signing. +3. Sign the serialized params using HMAC-SHA256/384/512 or MD5 with your secret key. +4. Append the signature in Hex or Base64 and nonce to HTTP headers or body. + +This process may differ from exchange to exchange. Some exchanges may want the signature in a different encoding, some of them vary in header and body param names and formats, but the general pattern is the same for all of them. + +**You should not share the same API keypair across multiple instances of an exchange running simultaneously, in separate scripts or in multiple threads. Using the same keypair from different instances simultaneously may cause all sorts of unexpected behaviour.** + +**DO NOT REUSE API KEYS WITH DIFFERENT SOFTWARE! The other software will screw your nonce too high. If you get [InvalidNonce](#invalid-nonce) errors – make sure to generate a fresh new keypair first and foremost.** + +The authentication is already handled for you, so you don't need to perform any of those steps manually unless you are implementing a new exchange class. The only thing you need for trading is the actual API key pair. + +### API Keys Setup + +#### Required Credentials + +The API credentials usually include the following: + +- `apiKey`. This is your public API Key and/or Token. This part is *non-secret*, it is included in your request header or body and sent over HTTPS in open text to identify your request. It is often a string in Hex or Base64 encoding or an UUID identifier. +- `secret`. This is your private key. Keep it secret, don't tell it to anybody. It is used to sign your requests locally before sending them to exchanges. The secret key does not get sent over the internet in the request-response process and should not be published or emailed. It is used together with the nonce to generate a cryptographically strong signature. That signature is sent with your public key to authenticate your identity. Each request has a unique nonce and therefore a unique cryptographic signature. +- `uid`. Some exchanges (not all of them) also generate a user id or *uid* for short. It can be a string or numeric literal. You should set it, if that is explicitly required by your exchange. See [their docs](#exchanges) for details. +- `password`. Some exchanges (not all of them) also require your password/phrase for trading. You should set this string, if that is explicitly required by your exchange. See [their docs](#exchanges) for details. + +In order to create API keys find the API tab or button in your user settings on the exchange website. Then create your keys and copy-paste them to your config file. Your config file permissions should be set appropriately, unreadable to anyone except the owner. + +**Remember to keep your apiKey and secret key safe from unauthorized use, do not send or tell it to anybody. A leak of the secret key or a breach in security can cost you a fund loss.** + +#### Credential Validation + +For checking if the user has supplied all the required credentials the `Exchange` base class has a method called `exchange.checkRequiredCredentials()` or `exchange.check_required_credentials()`. Calling that method will throw an `AuthenticationError`, if some of the credentials are missing or empty. The `Exchange` base class also has property `exchange.requiredCredentials` that allows a user to see which credentials are required for this or that exchange, as shown below: + +#### **Javascript** +```javascript +const ccxt = require ('ccxt') +const exchange = new ccxt.binance() +console.log (exchange.requiredCredentials) // prints required credentials +exchange.checkRequiredCredentials() // throw AuthenticationError +``` +#### **Python** +```python +import ccxt +exchange = ccxt.coinbasepro() +print(exchange.requiredCredentials) # prints required credentials +exchange.check_required_credentials() # raises AuthenticationError +``` +#### **PHP** +```php +include 'ccxt.php'; +$exchange = new \ccxt\bittrex (); +var_dump($exchange->requiredCredentials); // prints required credentials +$exchange->check_required_credentials(); // throws AuthenticationError +``` + + +#### Configuring API Keys + +To set up an exchange for trading just assign the API credentials to an existing exchange instance or pass them to exchange constructor upon instantiation, like so: + + +#### **Javascript** +```javascript +const ccxt = require ('ccxt') + +// any time +let kraken = new ccxt.kraken () +kraken.apiKey = 'YOUR_KRAKEN_API_KEY' +kraken.secret = 'YOUR_KRAKEN_SECRET_KEY' + +// upon instantiation +let okcoin = new ccxt.okcoin ({ + apiKey: 'YOUR_OKCOIN_API_KEY', + secret: 'YOUR_OKCOIN_SECRET_KEY', +}) + +// from variable id +const exchangeId = 'binance' + , exchangeClass = ccxt[exchangeId] + , exchange = new exchangeClass ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) +``` +#### **Python** +```python +import ccxt + +# any time +bitfinex = ccxt.bitfinex () +bitfinex.apiKey = 'YOUR_BFX_API_KEY' +bitfinex.secret = 'YOUR_BFX_SECRET' + +# upon instantiation +hitbtc = ccxt.hitbtc ({ + 'apiKey': 'YOUR_HITBTC_API_KEY', + 'secret': 'YOUR_HITBTC_SECRET_KEY', +}) + +# from variable id +exchange_id = 'binance' +exchange_class = getattr(ccxt, exchange_id) +exchange = exchange_class({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) +``` +#### **PHP** +```php +include 'ccxt.php' + +// any time +$hitbtc = new \ccxt\hitbtc (); +$hitbtc->apiKey = 'YOUR_HITBTC_API_KEY'; +$hitbtc->secret = 'YOUR_HITBTC_SECRET_KEY'; + +// upon instantiation +$zaif = new \ccxt\zaif (array ( + 'apiKey' => 'YOUR_ZAIF_API_KEY', + 'secret' => 'YOUR_ZAIF_SECRET_KEY' +)); + +// from variable id +$exchange_id = 'binance'; +$exchange_class = "\\ccxt\\$exchange_id"; +$exchange = new $exchange_class (array ( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', +)); +``` + + +Note that your private requests will fail with an exception or error if you don't set up your API credentials before you start trading. To avoid character escaping **always write your credentials in single quotes**, not double quotes (`'VERY_GOOD'`, `"VERY_BAD"`). + +#### API Key Permissions +When you get errors like `"Invalid API-key, IP, or permissions for action."` or `"API-key format invalid"`, then, most likely, the problem is not within ccxt, please avoid opening a new issue unless you ensure that: +1) You don't have typos, empty spaces, or quotes in your keys +2) Your current IP address (check [IPv4](https://api.ipify.org/) or [IPv6](https://api64.ipify.org/)) is added into API-KEY's whitelist (if you use proxy, consider that too) +3) You have selected the correct options in permissions list for that api-key +4) You are not accidentally mixing "testnet" api-keys or "testnet" mode in your script +5) You have checked already [reported issues](https://github.com/ccxt/ccxt/issues?q=is%3Aissue+%22Invalid+Api-Key+ID%22) about this error + + +#### Sign In + +Some exchanges required you to sign in prior to calling private methods, which can be done using the `signIn` method + + +#### **Javascript** +```javascript +signIn (params = {}) +``` + +Parameters + +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"2fa": "329293"}`) + +Returns + +- response from the exchange + +## Overriding The Nonce + +**The default nonce is defined by the underlying exchange. You can override it with a milliseconds-nonce if you want to make private requests more frequently than once per second! Most exchanges will throttle your requests if you hit their rate limits, read [API docs for your exchange](https://github.com/ccxt/ccxt/wiki/Exchanges) carefully!** + +In case you need to reset the nonce it is much easier to create another pair of keys for using with private APIs. Creating new keys and setting up a fresh unused keypair in your config is usually enough for that. + +In some cases you are unable to create new keys due to lack of permissions or whatever. If that happens you can still override the nonce. Base market class has the following methods for convenience: + +- `seconds ()`: returns a Unix Timestamp in seconds. +- `milliseconds ()`: same in milliseconds (ms = 1000 * s, thousandths of a second). +- `microseconds ()`: same in microseconds (μs = 1000 * ms, millionths of a second). + +There are exchanges that confuse milliseconds with microseconds in their API docs, let's all forgive them for that, folks. You can use methods listed above to override the nonce value. If you need to use the same keypair from multiple instances simultaneously use closures or a common function to avoid nonce conflicts. In Javascript you can override the nonce by providing a `nonce` parameter to the exchange constructor or by setting it explicitly on exchange object: + +```javascript +// JavaScript + +// 1: custom nonce redefined in constructor parameters +let nonce = 1 +let kraken1 = new ccxt.kraken ({ nonce: () => nonce++ }) + +// 2: nonce redefined explicitly +let kraken2 = new ccxt.kraken () +kraken2.nonce = function () { return nonce++ } // uses same nonce as kraken1 + +// 3: milliseconds nonce +let kraken3 = new ccxt.kraken ({ + nonce: function () { return this.milliseconds () }, +}) + +// 4: newer ES syntax +let kraken4 = new ccxt.kraken ({ + nonce () { return this.milliseconds () }, +}) +``` + +In Python and PHP you can do the same by subclassing and overriding nonce function of a particular exchange class: + +```python +# Python + +# 1: the shortest +coinbasepro = ccxt.coinbasepro({'nonce': ccxt.Exchange.milliseconds}) + +# 2: custom nonce +class MyKraken(ccxt.kraken): + n = 1 + def nonce(self): + return self.n += 1 + +# 3: milliseconds nonce +class MyBitfinex(ccxt.bitfinex): + def nonce(self): + return self.milliseconds() + +# 4: milliseconds nonce inline +hitbtc = ccxt.hitbtc({ + 'nonce': lambda: int(time.time() * 1000) +}) + +# 5: milliseconds nonce +acx = ccxt.acx({'nonce': lambda: ccxt.Exchange.milliseconds()}) +``` + +```php +// PHP + +// 1: custom nonce value +class Myokcoin extends \ccxt\okcoin { + public function __construct ($options = array ()) { + parent::__construct (array_merge (array ('i' => 1), $options)); + } + public function nonce () { + return $this->i++; + } +} + +// 2: milliseconds nonce +class MyZaif extends \ccxt\zaif { + public function __construct ($options = array ()) { + parent::__construct (array_merge (array ('i' => 1), $options)); + } + public function nonce () { + return $this->milliseconds (); + } +} +``` + +## Accounts + +You can get all the accounts associated with a profile by using the `fetchAccounts()` method + +```javascript +fetchAccounts (params = {}) +``` + +### Accounts Structure + +The `fetchAccounts()` method will return a structure like shown below: + +```javascript +[ + { + id: "s32kj302lasli3930", + type: "main", + name: "main", + code: "USDT", + info: { ... } + }, + { + id: "20f0sdlri34lf90", + name: "customAccount", + type: "margin", + code: "USDT", + info: { ... } + }, + { + id: "4oidfk40dadeg4328", + type: "spot", + name: "spotAccount32", + code: "BTC", + info: { ... } + }, + ... +] +``` + +Types of account is one of the [unified account types](####Account-Balance) or `subaccount` + +## Account Balance + +To query for balance and get the amount of funds available for trading or funds locked in orders, use the `fetchBalance` method: + +```javascript +fetchBalance (params = {}) +``` + +Parameters + +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"currency": "usdt"}`) + +Returns + +- A [balance structure](#balance-structure) + +### Balance Structure + +```javascript +{ + 'info': { ... }, // the original untouched non-parsed reply with details + 'timestamp': 1499280391811, // Unix Timestamp in milliseconds (seconds * 1000) + 'datetime': '2017-07-05T18:47:14.692Z', // ISO8601 datetime string with milliseconds + + //------------------------------------------------------------------------- + // indexed by availability of funds first, then by currency + + 'free': { // money, available for trading, by currency + 'BTC': 321.00, // floats... + 'USD': 123.00, + ... + }, + + 'used': { ... }, // money on hold, locked, frozen, or pending, by currency + + 'total': { ... }, // total (free + used), by currency + + 'debt': { ... }, // debt, by currency + + //------------------------------------------------------------------------- + // indexed by currency first, then by availability of funds + + 'BTC': { // string, three-letter currency code, uppercase + 'free': 321.00 // float, money available for trading + 'used': 234.00, // float, money on hold, locked, frozen or pending + 'total': 555.00, // float, total balance (free + used) + }, + + 'USD': { // ... + 'free': 123.00 // ... + 'used': 456.00, + 'total': 579.00, + }, + + ... +} +``` + +The `timestamp` and `datetime` values may be undefined or missing if the underlying exchange does not provide them. + +Some exchanges may not return full balance info. Many exchanges do not return balances for your empty or unused accounts. In that case some currencies may be missing in returned balance structure. + +#### **Javascript** +```javascript +(async () => { + console.log (await exchange.fetchBalance ()) +}) () +``` +#### **Python** +```python +print (exchange.fetch_balance ()) +``` +#### **PHP** +```php +var_dump ($exchange->fetch_balance ()); +``` + + +## Orders + +```diff +- this part of the unified API is currenty a work in progress +- there may be some issues and missing implementations here and there +- contributions, pull requests and feedback appreciated +``` + +### Querying Orders + +Most of the time you can query orders by an id or by a symbol, though not all exchanges offer a full and flexible set of endpoints for querying orders. Some exchanges might not have a method for fetching recently closed orders, the other can lack a method for getting an order by id, etc. The ccxt library will target those cases by making workarounds where possible. + +The list of methods for querying orders consists of the following: + +- `fetchCanceledOrders (symbol = undefined, since = undefined, limit = undefined, params = {})` +- `fetchClosedOrder (id, symbol = undefined, params = {})` +- `fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {})` +- `fetchOpenOrder (id, symbol = undefined, params = {})` +- `fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {})` +- `fetchOrder (id, symbol = undefined, params = {})` +- `fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {})` + +Note that the naming of those methods indicates if the method returns a single order or multiple orders (an array/list of orders). The `fetchOrder()` method requires a mandatory order id argument (a string). Some exchanges also require a symbol to fetch an order by id, where order ids can intersect with various trading pairs. Also, note that all other methods above return an array (a list) of orders. Most of them will require a symbol argument as well, however, some exchanges allow querying with a symbol unspecified (meaning *all symbols*). + +The library will throw a NotSupported exception if a user calls a method that is not available from the exchange or is not implemented in ccxt. + +To check if any of the above methods are available, look into the `.has` property of the exchange: + + +#### **Javascript** +```javascript +'use strict'; + +const ccxt = require ('ccxt') +const id = 'poloniex' +exchange = new ccxt[id] () +console.log (exchange.has) +``` +#### **Python** +```python +import ccxt +id = 'binance' +exchange = getattr(ccxt, id)() +print(exchange.has) +``` +#### **PHP** +```php +$exchange = new \ccxt\bitfinex(); +print_r ($exchange->has); // or var_dump +``` + + +A typical structure of the `.has` property usually contains the following flags corresponding to order API methods for querying orders: + +```javascript +exchange.has = { + + // ... other flags ... + + 'fetchOrder': true, // available from the exchange directly and implemented in ccxt + 'fetchOrders': false, // not available from the exchange or not implemented in ccxt + 'fetchOpenOrders': true, + 'fetchClosedOrders': 'emulated', // not available from the exchange, but emulated in ccxt + + // ... other flags ... + +} +``` + +The meanings of boolean `true` and `false` are obvious. A string value of `emulated` means that particular method is missing in the exchange API and ccxt will workaround that where possible on the client-side. + +#### Understanding The Orders API Design + +The exchanges' order management APIs differ by design. The user has to understand the purpose of each specific method and how they're combined together into a complete order API: + +- `fetchCanceledOrders()`- fetches a list of canceled orders +- `fetchClosedOrder()`- fetches a single closed order by order id +- `fetchClosedOrders()` – fetches a list of closed (or canceled) orders. +- `fetchMyTrades()` – though not a part of the orders' API, it is closely related, since it provides the history of settled trades. +- `fetchOpenOrder()`- fetches a single open order by order id +- `fetchOpenOrders()` – fetches a list of open orders. +- `fetchOrder()` – fetches a single order (open or closed) by order `id`. +- `fetchOrders()` – fetches a list of all orders (either open or closed/canceled). +- `createOrder()` – used for placing orders +- `createOrders()` – used for placing multiple orders within the same request +- `cancelOrder()` – used for canceling a single order +- `cancelOrders()` - used for canceling multiple orders +- `cancelAllOrders()` - used for canceling all orders +- `cancelAllOrdersAfter()` - used for canceling all orders after the given timeout + +The majority of the exchanges will have a way of fetching currently-open orders. Thus, the `exchange.has['fetchOpenOrders']`. If that method is not available, then most likely the `exchange.has['fetchOrders']` that will provide a list of all orders. The exchange will return a list of open orders either from `fetchOpenOrders()` or from `fetchOrders()`. One of the two methods is usually available from any exchange. + +Some exchanges will provide the order history, other exchanges will not. If the underlying exchange provides the order history, then the `exchange.has['fetchClosedOrders']` or the `exchange.has['fetchOrders']`. If the underlying exchange does not provide the order history, then `fetchClosedOrders()` and `fetchOrders()` are not available. In the latter case, the user is required to build a local cache of orders and track the open orders using `fetchOpenOrders()` and `fetchOrder()` for order statuses and for marking them as closed locally in the userland (when they're not open anymore). + +If the underlying exchange does not have methods for order history (`fetchClosedOrders()` and `fetchOrders()`), then it will provide `fetchOpenOrders` + the trade history with `fetchMyTrades` (see [How Orders Are Related To Trades](#how-orders-are-related-to-trades)). That set of information is in many cases enough for tracking in a live-trading robot. If there's no order history – you have to track your live orders and restore historical info from open orders and historical trades. + +In general, the underlying exchanges will usually provide one or more of the following types of historical data: + +- `fetchClosedOrders()` +- `fetchOrders()` +- `fetchMyTrades()` + +Any of the above three methods may be missing, but the exchanges APIs will usually provide at least one of the three methods. + +If the underlying exchange does not provide historical orders, the CCXT library will not emulate the missing functionality – it has to be added on the user side where necessary. + +**Please, note, that a certain method may be missing either because the exchange does not have a corresponding API endpoint, or because CCXT has not implemented it yet (the library is also a work in progress). In the latter case, the missing method will be added as soon as possible.** + +#### Querying Multiple Orders And Trades + +All methods returning lists of trades and lists of orders, accept the second `since` argument and the third `limit` argument: + +- `fetchTrades()` (public) +- `fetchMyTrades()` (private) +- `fetchOrders()` +- `fetchOpenOrders()` +- `fetchClosedOrders()` +- `fetchCanceledOrders()` + +The second argument `since` reduces the array by timestamp, the third `limit` argument reduces by number (count) of returned items. + +If the user does not specify `since`, the `fetchTrades()/fetchOrders()` methods will return the default set of results from the exchange. The default set is exchange-specific, some exchanges will return trades or recent orders starting from the date of listing a pair on the exchange, other exchanges will return a reduced set of trades or orders (like, last 24 hours, last 100 trades, first 100 orders, etc). If the user wants precise control over the timeframe, the user is responsible for specifying the `since` argument. + +**NOTE: not all exchanges provide means for filtering the lists of trades and orders by starting time, so, the support for `since ` and `limit` is exchange-specific. However, most exchanges do provide at least some alternative for "pagination" and "scrolling" which can be overrided with extra `params` argument.** + +Some exchanges do not have a method for fetching closed orders or all orders. They will offer just the `fetchOpenOrders()` endpoint, and sometimes also a `fetchOrder` endpoint as well. Those exchanges don't have any methods for fetching the order history. To maintain the order history for those exchanges the user has to store a dictionary or a database of orders in the userland and update the orders in the database after calling methods like `createOrder()`, `fetchOpenOrders()`, `cancelOrder()`, `cancelAllOrders()`. + +#### By Order Id + +To get the details of a particular order by its id, use the `fetchOrder()` / `fetch_order()` method. Some exchanges also require a symbol even when fetching a particular order by id. + +The signature of the fetchOrder/fetch_order method is as follows: + +```javascript +if (exchange.has['fetchOrder']) { + // you can use the params argument for custom overrides + let order = await exchange.fetchOrder (id, symbol = undefined, params = {}) +} +``` + +**Some exchanges don't have an endpoint for fetching an order by id, ccxt will emulate it where possible.** For now it may still be missing here and there, as this is a work in progress. + +You can pass custom overrided key-values in the additional params argument to supply a specific order type, or some other setting if needed. + +Below are examples of using the fetchOrder method to get order info from an authenticated exchange instance: + +#### **Javascript** +```javascript +(async function () { + const order = await exchange.fetchOrder (id) + console.log (order) +}) () +``` +#### **Python** +```python 3 (synchronous) +if exchange.has['fetchOrder']: + order = exchange.fetch_order(id) + print(order) + +# Python 3.7+ asyncio (asynchronous) +import asyncio +import ccxt.async_support as ccxt +if exchange.has['fetchOrder']: + order = asyncio.run(exchange.fetch_order(id)) + print(order) +``` +#### **PHP** +```php +if ($exchange->has['fetchOrder']) { + $order = $exchange->fetch_order($id); + var_dump($order); +} +``` + + +#### All Orders + +```javascript +if (exchange.has['fetchOrders']) + exchange.fetchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +**Some exchanges don't have an endpoint for fetching all orders, ccxt will emulate it where possible.** For now it may still be missing here and there, as this is a work in progress. + +#### Open Orders + +```javascript +if (exchange.has['fetchOpenOrders']) + exchange.fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +#### Closed Orders + +Do not confuse *closed orders* with *trades* aka *fills* ! An order can be closed (filled) with multiple opposing trades! So, a *closed order* is not the same as a *trade*. In general, the order does not have a `fee` at all, but each particular user trade does have `fee`, `cost` and other properties. However, many exchanges propagate those properties to the orders as well. + +**Some exchanges don't have an endpoint for fetching closed orders, ccxt will emulate it where possible.** For now it may still be missing here and there, as this is a work in progress. + +```javascript +if (exchange.has['fetchClosedOrders']) + exchange.fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +### Order Structure + +Most of methods returning orders within ccxt unified API will yield an order structure as described below: + +```javascript +{ + 'id': '12345-67890:09876/54321', // string + 'clientOrderId': 'abcdef-ghijklmnop-qrstuvwxyz', // a user-defined clientOrderId, if any + 'datetime': '2017-08-17 12:42:48.000', // ISO8601 datetime of 'timestamp' with milliseconds + 'timestamp': 1502962946216, // order placing/opening Unix timestamp in milliseconds + 'lastTradeTimestamp': 1502962956216, // Unix timestamp of the most recent trade on this order + 'status': 'open', // 'open', 'closed', 'canceled', 'expired', 'rejected' + 'symbol': 'ETH/BTC', // symbol + 'type': 'limit', // 'market', 'limit' + 'timeInForce': 'GTC', // 'GTC', 'IOC', 'FOK', 'PO' + 'side': 'buy', // 'buy', 'sell' + 'price': 0.06917684, // float price in quote currency (may be empty for market orders) + 'average': 0.06917684, // float average filling price + 'amount': 1.5, // ordered amount of base currency + 'filled': 1.1, // filled amount of base currency + 'remaining': 0.4, // remaining amount to fill + 'cost': 0.076094524, // 'filled' * 'price' (filling price used where available) + 'trades': [ ... ], // a list of order trades/executions + 'fee': { // fee info, if available + 'currency': 'BTC', // which currency the fee is (usually quote) + 'cost': 0.0009, // the fee amount in that currency + 'rate': 0.002, // the fee rate (if available) + }, + 'info': { ... }, // the original unparsed order structure as is +} +``` + +- The `status` of an order is usually either `'open'` (not filled or partially filled), `'closed'` (fully filled), or `'canceled'` (unfilled and canceled, or partially filled then canceled). +- Some exchanges allow the user to specify an expiration timestamp upon placing a new order. If the order is not filled by that time, its `status` becomes `'expired'`. +- Use the `filled` value to determine if the order is filled, partially filled or fully filled, and by how much. +- The work on `'fee'` info is still in progress, fee info may be missing partially or entirely, depending on the exchange capabilities. +- The `fee` currency may be different from both traded currencies (for example, an ETH/BTC order with fees in USD). +- The `lastTradeTimestamp` timestamp may have no value and may be `undefined/None/null` where not supported by the exchange or in case of an open order (an order that has not been filled nor partially filled yet). +- The `lastTradeTimestamp`, if any, designates the timestamp of the last trade, in case the order is filled fully or partially, otherwise `lastTradeTimestamp` is `undefined/None/null`. +- Order `status` prevails or has precedence over the `lastTradeTimestamp`. +- The `cost` of an order is: `{ filled * price }` +- The `cost` of an order means the total *quote* volume of the order (whereas the `amount` is the *base* volume). The value of `cost` should be as close to the actual most recent known order cost as possible. The `cost` field itself is there mostly for convenience and can be deduced from other fields. +- The `clientOrderId` field can be set upon placing orders by the user with [custom order params](#custom-order-params). Using the `clientOrderId` the user can later distinguish between own orders. This is only available for the exchanges that do support `clientOrderId` at this time. + +#### timeInForce + +The `timeInForce` field may be `undefined/None/null` if not specified by the exchange. The unification of `timeInForce` is a work in progress. + +Possible values for the`timeInForce` field: + +- `'GTC'` = _Good Till Cancel(ed)_, the order stays on the orderbook until it is matched or canceled. +- `'IOC'` = _Immediate Or Cancel_, the order has to be matched immediately and filled either partially or completely, the unfilled remainder is canceled (or the entire order is canceled). +- `'FOK'` = _Fill Or Kill_, the order has to get fully filled and closed immediately, otherwise the entire order is canceled. +- `'PO'` = _Post Only_, the order is either placed as a maker order, or it is canceled. This means the order must be placed on orderbook for at at least time in an unfilled state. The unification of `PO` as a `timeInForce` option is a work in progress with unified exchanges having `exchange.has['createPostOnlyOrder'] == True`. + +### Placing Orders + +There are different types of orders that a user can send to the exchange, regular orders eventually land in the orderbook of a corresponding symbol, others orders may be more advanced. Here is a list outlining various types of orders: + +- [Limit Orders](#limit-orders) – regular orders having an `amount` in base currency (how much you want to buy or sell) and a `price` in quote currency (for which price you want to buy or sell). +- [Market Orders](#market-orders) – regular orders having an `amount` in base currency (how much you want to buy or sell) + - [Market Buys](#market-buys) – some exchanges require market buy orders with an `amount` in quote currency (how much you want to spend for buying) +- [Trigger Orders](#conditional-orders) aka *conditional orders* – an advanced type of order used to wait for a certain condition on a market and then react automatically: when a `triggerPrice` is reached, the trigger order gets triggered and then a regular limit `price` or market price order is placed, that eventually results in entering a position or exiting a position +- [Stop Loss Orders](#stop-loss-orders) – almost the same as trigger orders, but used to close a position to stop further losses on that position: when the price reaches `triggerPrice` then the stop loss order is triggered that results in placing another regular limit or market order to close a position at a specific limit `price` or at market price (a position with a stop loss order attached to it). +- [Take Profit Orders](#take-profit-orders) – a counterpart to stop loss orders, this type of order is used to close a position to take existing profits on that position: when the price reaches `triggerPrice` then the take profit order is triggered that results in placing another regular limit or market order to close a position at a specific limit `price` or at market price (a position with a take profit order attached to it). +- [StopLoss And TakeProfit Orders Attached To A Position](#stoploss-and-takeprofit-orders-attached-to-a-position) – advanced orders, consisting of three orders of types listed above: a regular limit or market order placed to enter a position with stop loss and/or take profit orders that will be placed upon opening that position and will be used to close that position later (when a stop loss is reached, it will close the position and will cancel its take profit counterpart, and vice versa, when a take profit is reached, it will close the position and will cancel its stop loss counterpart, these two counterparts are also known as "OCO orders – one cancels the other), apart from the `amount` (and `price` for the limit order) to open a position it will also require a `triggerPrice` for a stop loss order (with a limit `price` if it's a stop loss limit order) and/or a `triggerPrice` for a take profit order (with a limit `price` if it's a take profit limit order). +- [Trailing Orders](#trailing-orders) – an order that is automatically adjusted relative to an open position, `trailingAmount` can be set to trail a specified quote amount behind the open position or `trailingPercent` can be set to trail a specified percent behind the open position, when the market price of the position is equal to the trailing order this results in entering a new position or exiting a position depending on if the trailing order has the `reduceOnly` parameter set to true or not. + +Placing an order always requires a `symbol` that the user has to specify (which market you want to trade). + +To place an order use the `createOrder` method. You can use the `id` from the returned unified [order structure](#order-structure) to query the status and the state of the order later. If you need to place multiple orders simultaneously, you can check the availability of the `createOrders` method. + +```javascript +createOrder (symbol, type, side, amount, price = undefined, params = {}) +``` + +```javascript +createOrders (orders, params = {}) // orders is a list in which each element contains a symbol, type, side, amount, price and params +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT market symbol + - Make sure the symbol in question exists with the target exchange and is available for trading. +- **side** *required* a string literal for the direction of your order. + **Unified sides:** + - `buy` give quote currency and receive base currency; for example, buying `BTC/USD` means that you will receive bitcoins for your dollars. + - `sell` give base currency and receive quote currency; for example, buying `BTC/USD` means that you will receive dollars for your bitcoins. +- **type** a string literal type of order + **Unified types:** + - [market](market-orders) not allowed by some exchanges, see [their docs](#exchanges) for details + - [limit](limit-orders) + - see #custom-order-params and #other-order-types for non-unified types +- **amount**, how much of currency you want to trade usually, but not always, in units of the base currency of the trading pair symbol (the units for some exchanges are dependent on the side of the order: see their API docs for details.) +- **price** the price at which the order is to be fullfilled at in units of the quote currency (ignored in market orders) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"settle": "usdt"}`) + +Returns + +- A successful order call returns a [order structure](#order-structure) + +**Notes on createOrder** + +- Some exchanges will allow to trade with limit orders only. + +Some fields from the returned order structure may be `undefined / None / null` if that information is not returned from the exchange API's response. The user is guaranteed that the `createOrder` method will return a unified [order structure](#order-structure) that will contain at least the order `id` and the `info` (a raw response from the exchange "as is"): + +```javascript +{ + 'id': 'string', // order id + 'info': { ... }, // decoded original JSON response from the exchange as is +} +``` + +##### Common pitfalls + +- There is a common error that happens when creating orders for contract markets: + +``` +"must be greater than minimum amount precision of 1" +``` + +This error happens when the exchange is expecting a natural number of contracts (1,2,3, etc) in the `amount` argument of `createOrder`. The [market structure](#market-structure) has a key called `contractSize`. Each contract is worth a certain amount of the base asset that is determined by the `contractSize`. The number of contracts multiplied by the `contractSize` is equal to the base amount. `Base amount = (contracts * contractSize)` so to derive the number of contracts you should enter in the `amount` argument you can solve for contracts: `contracts = (Base amount / contractSize)`. + +Here is an example of finding the `contractSize`: +```python +await exchange.loadMarkets() +symbol = 'BTC/USDT:USDT' +market = exchange.market(symbol) +print(market['contractSize']) + +# Let's say you want to convert 0.5 BTC to the number of contracts: +number_contracts = round((0.5 * 1) / market['contractSize']) +``` + +#### Limit Orders + +Limit orders placed on the order book of the exchange for a price specified by the trader. They are fullfilled(closed) when there are no orders in the same market at a better price, and another trader creates a [market order](market-orders) or an opposite order for a price that matches or exceeds the price of the limit order. + +Limit orders may not be fully filled. This happens when the filling order is for a smaller amount than the amount specified by the limit order. + +```javascript +// camelCaseNotation +exchange.createLimitSellOrder (symbol, amount, price, params) +exchange.createLimitBuyOrder (symbol, amount, price, params) + +// underscore_notation +exchange.create_limit_sell_order (symbol, amount, price, params) +exchange.create_limit_buy_order (symbol, amount, price, params) + +// using general createLimitOrder and side = 'buy' or 'sell' +exchange.createLimitOrder (symbol, side, amount, price, params) +exchange.create_limit_order (symbol, side, amount, price, params) + +// using general createOrder, type = 'limit' and side = 'buy' or 'sell' +exchange.createOrder (symbol, 'limit', side, amount, price, params) +exchange.create_order (symbol, 'limit', side, amount, price, params) +``` + +#### Market Orders + +*also known as* + +- market price orders +- spot price orders +- instant orders + +Market orders are executed immediately by fulfilling one of more already existing orders from the ask side of the exchanges order book. The orders that your market order fulfills are chosen from th top of the order book stack, meaning your market order is fulfilled at the best price available. When placing a market order you don't need to specify the price of the order, and if the price is specified, it will be ignored. + +You are not guaranteed that the order will be executed for the price you observe prior to placing your order. There are multiple reasons for this, including: + +- **price slippage** a slight change of the price for the traded market while your order is being executed. Reasons for price slippage include, but are not limited to + + - networking roundtrip latency + - high loads on the exchange + - price volatility + +- **unequivocal order sizes** if a market order is for an amount that is larger than the size of the top order on the order book, then after the top order is filled, the market order will proceed to fill the next order in the order book, which means the market order is filled at multiple prices + +```javascript +// camelCaseNotation +exchange.createMarketSellOrder (symbol, amount, params) +exchange.createMarketBuyOrder (symbol, amount, params) + +// underscore_notation +exchange.create_market_sell_order (symbol, amount, params) +exchange.create_market_buy_order (symbol, amount, params) + +// using general createMarketOrder and side = 'buy' or 'sell' +exchange.createMarketOrder (symbol, side, amount, params) +exchange.create_market_order (symbol, side, amount, params) + +// using general createOrder, type = 'market' and side = 'buy' or 'sell' +exchange.createOrder (symbol, 'market', side, amount, ...) +exchange.create_order (symbol, 'market', side, amount, ...) +``` + +**Note, that some exchanges will not accept market orders (they allow limit orders only).** In order to detect programmatically if the exchange in question does support market orders or not, you can use the `.has['createMarketOrder']` exchange property: + +#### **Javascript** +```javascript +if (exchange.has['createMarketOrder']) { + ... +} +``` +#### **Python** +```python +if exchange.has['createMarketOrder']: + ... +``` +#### **PHP** +```php +if ($exchange->has['createMarketOrder']) { + ... +} +``` + + +#### Market Buys + +In general, when placing a `market buy` or `market sell` order the user has to specify just the amount of the base currency to buy or sell. However, with some exchanges market buy orders implement a different approach to calculating the value of the order. + +Suppose you're trading BTC/USD and the current market price for BTC is over 9000 USD. For a market buy or market sell you could specify an `amount` of 2 BTC and that would result in _plus or minus_ 18000 USD (more or less ;)) on your account, depending on the side of the order. + +**With market buys some exchanges require the total cost of the order in the quote currency!** The logic behind it is simple, instead of taking the amount of base currency to buy or sell some exchanges operate with _"how much quote currency you want to spend on buying in total"_. + +To place a market buy order with those exchanges you would not specify an amount of 2 BTC, instead you should somehow specify the total cost of the order, that is, 18000 USD in this example. The exchanges that treat `market buy` orders in this way have an exchange-specific option `createMarketBuyOrderRequiresPrice` that allows specifying the total cost of a `market buy` order in two ways. + +The first is the default and if you specify the `price` along with the `amount` the total cost of the order would be calculated inside the lib from those two values with a simple multiplication (`cost = amount * price`). The resulting `cost` would be the amount in USD quote currency that will be spent on this particular market buy order. + +```javascript +// this example is oversimplified and doesn't show all the code that is +// required to handle the errors and exchange metadata properly +// it shows just the concept of placing a market buy order + +const exchange = new ccxt.cex ({ + 'apiKey': YOUR_API_KEY, + 'secret': 'YOUR_SECRET', + // 'options': { + // 'createMarketBuyOrderRequiresPrice': true, // default + // }, +}) + +;(async () => { + + // when `createMarketBuyOrderRequiresPrice` is true, we can pass the price + // so that the total cost of the order would be calculated inside the library + // by multiplying the amount over price (amount * price) + + const symbol = 'BTC/USD' + const amount = 2 // BTC + const price = 9000 // USD + // cost = amount * price = 2 * 9000 = 18000 (USD) + + // note that we don't use createMarketBuyOrder here, instead we use createOrder + // createMarketBuyOrder will omit the price and will not work when + // exchange.options['createMarketBuyOrderRequiresPrice'] = true + const order = await exchange.createOrder (symbol, 'market', 'buy', amount, price) + + console.log (order) +}) () +``` + +The second alternative is useful in cases when the user wants to calculate and specify the resulting total cost of the order himself. That can be done by setting the `createMarketBuyOrderRequiresPrice` option to `false` to switch it off: + +```javascript +const exchange = new ccxt.cex ({ + 'apiKey': YOUR_API_KEY, + 'secret': 'YOUR_SECRET', + 'options': { + 'createMarketBuyOrderRequiresPrice': false, // switch off + }, +}) + +// or, to switch it off later, after the exchange instantiation, you can do +exchange.options['createMarketBuyOrderRequiresPrice'] = false + +;(async () => { + + // when `createMarketBuyOrderRequiresPrice` is true, we can pass the price + // so that the total cost of the order would be calculated inside the library + // by multiplying the amount over price (amount * price) + + const symbol = 'BTC/USD' + const amount = 2 // BTC + const price = 9000 // USD + cost = amount * price // ← instead of the amount cost goes ↓ here + const order = await exchange.createMarketBuyOrder (symbol, cost) + console.log (order) +}) () +``` + +More about it: + +- https://github.com/ccxt/ccxt/issues/564#issuecomment-347458566 +- https://github.com/ccxt/ccxt/issues/4914#issuecomment-478199357 +- https://github.com/ccxt/ccxt/issues/4799#issuecomment-470966769 +- https://github.com/ccxt/ccxt/issues/5197#issuecomment-496270785 + +#### Emulating Market Orders With Limit Orders + +It is also possible to emulate a `market` order with a `limit` order. + +**WARNING this method can be risky due to high volatility, use it at your own risk and only use it when you know really well what you're doing!** + +Most of the time a `market sell` can be emulated with a `limit sell` at a very low price – the exchange will automatically make it a taker order for market price (the price that is currently in your best interest from the ones that are available in the order book). When the exchange detects that you're selling for a very low price it will automatically offer you the best buyer price available from the order book. That is effectively the same as placing a market sell order. Thus market orders can be emulated with limit orders (where missing). + +The opposite is also true – a `market buy` can be emulated with a `limit buy` for a very high price. Most exchanges will again close your order for best available price, that is, the market price. + +However, you should never rely on that entirely, **ALWAYS test it with a small amount first!** You can try that in their web interface first to verify the logic. You can sell the minimal amount at a specified limit price (an affordable amount to lose, just in case) and then check the actual filling price in trade history. + +#### Limit Orders + +Limit price orders are also known as *limit orders*. Some exchanges accept limit orders only. Limit orders require a price (rate per unit) to be submitted with the order. The exchange will close limit orders if and only if market price reaches the desired level. + +```javascript +// camelCaseStyle +exchange.createLimitBuyOrder (symbol, amount, price[, params]) +exchange.createLimitSellOrder (symbol, amount, price[, params]) + +// underscore_style +exchange.create_limit_buy_order (symbol, amount, price[, params]) +exchange.create_limit_sell_order (symbol, amount, price[, params]) +``` + + + +#### Conditional Orders + +Coming from traditional trading, the term "Stop order" has been a bit ambigious, so instead of it, in CCXT we use term "Trigger" order. When symbol's price reaches your "trigger"("stop") price, the order is activated as `market` or `limit` order, depending which one you had chosen. + +We have different classification of trigger orders: +1) standalone [Trigger order](#trigger-order) to buy/sell coin (open/close position) +2) standalone [Stop Loss](#stop-loss-orders) or [Take Profit](#take-profit-orders) designed to close open positions. +3) a Stop Loss or Take Profit order attached to a primary order ([Conditional Trigger Order](#stopLoss-and-takeProfit-orders-attached-to-a-position)). + + +##### Trigger order + +Traditional "stop" order (which you might see across exchanges' websites) is now called "trigger" order across CCXT library. Implemented by adding a `triggerPrice` parameter. They are independent basic trigger orders that can open or close a position. + +* To ensure exchange supports this functionality, check `exchange.features` or use helper method `exchange.featureValue('BTC/USDT', 'createOrder', 'triggerPrice')`. +* Typically, it is activated when price of the underlying asset/contract crosses the `triggerPrice` from **any direction**. However, some exchanges' API require to set `triggerDirection` too, which triggers order depending whether price is above or below `triggerPrice`. For example, if you want to trigger limit order (buy 0.1 `ETH` at limit price `1500`) once pair price crosses `1700`: + + +#### **Javascript** +```javascript +const params = { + 'triggerPrice': 1700, +} +const order = await exchange.createOrder ('ETH/USDT', 'market', 'buy', 0.1, 1500, params) +``` +#### **Python** +```python +params = { + 'triggerPrice': 1700, +} +order = exchange.create_order('ETH/USDT', 'market', 'buy', 0.1, 1500, params) +``` +#### **PHP** +```php +$params = { + 'triggerPrice': 1700, +} +$order = $exchange->create_order ('ETH/USDT', 'market', 'buy', 0.1, 1500, $params) +``` + + +Typically, exchange automatically determines `triggerPrice`'s direction (whether it is "above" or "below" current price), however, some exchanges require that you provide `triggerDirection` with either `ascending` or `descending` values: + +``` +params = { + 'triggerPrice': 1700, + 'triggerDirection': 'ascending', // order will be triggered when price goes upward and touches 1700 +} +``` + +Note, you can also add `reduceOnly: true` param to the trigger order (with a possible `triggerDirection: 'ascending/descending'` param), so it would act as "stop-loss" or "take-profit" order. However, for some exchanges we support "stop-loss" and "take-profit" trigger order types, which automatically involve `reduceOnly` and `triggerDirection` handling (see them below). + +##### Stop Loss Orders + +The same as Trigger Orders, but the direction matters. Implemented by specifying a `stopLossPrice` parameter (for the stop loss triggerPrice), and also automatically implemented `triggerDirection` on behalf of user, so instead of regular Trigger Order, you can use this as an alternative. + +* To ensure exchange supports this functionality, check `exchange.features` or use helper method `exchange.featureValue('BTC/USDT', 'createOrder', 'stopLossPrice')`. + +Suppose you entered a long position (you bought) at 1000 and want to protect yourself from losses from a possible price drop below 700. You would place a stop loss order with triggerPrice at 700. For that stop loss order either you would specify a limit price or it will be executed at market price. + +``` + | price | amount +----|---------------- + | 1500 | 200 + | 1400 | 300 + a | 1300 | 100 + s | 1200 | 200 + k | 1100 | 300 + | 1000 | 100 <--- you bought to enter a long position here at 1000 + | 900 | 100 +----|---------------- last price is 900 + | 800 | 100 + | 700 | 200 <------- you place a stop loss order here at 700 <----------------------+ + b | 600 | 100 when your stopLossPrice is reached from above | + i | 500 | 300 it will close your position at market price below 700 ----------------+ + d | 400 | 200 <- or it will be executed at your limit price lower that stopLossPrice -+ + | 300 | 100 + | 200 | 100 +``` + +Suppose you entered a short position (you sold) at 700 and want to protect yourself from losses from a possible price pump above 1300. You would place a stop loss order with triggerPrice at 1300. For that stop loss order either you would specify a limit price or it will be executed at market price. + +``` + | price | amount +----|---------------- + | 1500 | 200 + | 1400 | 300 <------------------------------------------------------------------------+ + a | 1300 | 100 <------ you place a stop loss order here at 1300 <---------------------+ | + s | 1200 | 200 when your stopLossPrice is reached from below | | + k | 1100 | 300 it will close your position at market price above 1300 --------------+ | + | 1000 | 100 or it will be executed at your limit price higher than stopLossPrice -+ + | 900 | 100 +----|---------------- last price is 900 (you sold at 700) + | 800 | 100 + | 700 | 200 <--- you sold to enter a short position here at 700 + b | 600 | 100 + i | 500 | 300 + d | 400 | 200 + | 300 | 100 + | 200 | 100 +``` + +Stop Loss orders are activated when the price of the underlying asset/contract: + +* drops below the `stopLossPrice` from above, for sell orders. (eg: to close a long position, and avoid further losses) +* rises above the `stopLossPrice` from below, for buy orders (eg: to close a short position, and avoid further losses) + + +#### **Javascript** +```javascript +// for a stop loss order +const params = { + 'stopLossPrice': 55.45, // your stop loss price +} + +const order = await exchange.createOrder (symbol, type, side, amount, price, params) +``` +#### **Python** +```python +# for a stop loss order +params = { + 'stopLossPrice': 55.45, # your stop loss price +} + +order = exchange.create_order (symbol, type, side, amount, price, params) +``` +#### **PHP** +```php +// for a stop loss order +$params = { + 'stopLossPrice': 55.45, // your stop loss price +} + +$order = $exchange->create_order ($symbol, $type, $side, $amount, $price, $params); +``` + + +##### Take Profit Orders + +The same as Stop Loss Orders, but the direction matters. Implemented by specifying a `takeProfitPrice` parameter (for the take profit triggerPrice). + +Suppose you entered a long position (you bought) at 1000 and want to get your profits from a possible price pump above 1300. You would place a take profit order with triggerPrice at 1300. For that take profit order either you would specify a limit price or it will be executed at market price. + +``` + | price | amount +----|---------------- + | 1500 | 200 + | 1400 | 300 <------------------------------------------------------------------------------+ + a | 1300 | 100 <--- it will close your position at market price above 1300 | + s | 1200 | 200 when your takeProfitPrice is reached from below | + k | 1100 | 300 or it will be executed at your limit price higher than your takeProfitPrice -+ + | 1000 | 100 <- you bought to enter a long position here at 1000 + | 900 | 100 +----|---------------- last price is 900 + | 800 | 100 + | 700 | 200 + b | 600 | 100 + i | 500 | 300 + d | 400 | 200 + | 300 | 100 + | 200 | 100 +``` + +Suppose you entered a short position (you sold) at 700 and want to get your profits from a possible price drop below 600. You would place a take profit order with triggerPrice at 600. For that take profit order either you would specify a limit price or it will be executed at market price. + +``` + | price | amount +----|---------------- + | 1500 | 200 + | 1400 | 300 + a | 1300 | 100 + s | 1200 | 200 + k | 1100 | 300 + | 1000 | 100 + | 900 | 100 +----|---------------- last price is 900 (you sold at 700) + | 800 | 100 + | 700 | 200 <--- you sold to enter a short position here at 700 + b | 600 | 100 <------ you place a take profit order here at 600 + i | 500 | 300 when your takeProfitPrice is reached from above + d | 400 | 200 it will be close your position at market price below 600 + | 300 | 100 <- or it will be executed at your limit price lower than your takeProfitPrice + | 200 | 100 +``` + +Take Profit orders are activated when the price of the underlying: + +* rises above the `takeProfitPrice` from below, for sell orders (eg: to close a long position, at a profit) +* drops below the `takeProfitPrice` from above, for buy orders (eg: to close a short position, at a profit) + + +#### **Javascript** +```javascript +// for a take profit order +const params = { + 'takeProfitPrice': 120.45, // your take profit price +} + +const order = await exchange.createOrder (symbol, type, side, amount, price, params) +``` +#### **Python** +```python +# for a take profit order +params = { + 'takeProfitPrice': 120.45, # your take profit price +} + +order = exchange.create_order (symbol, type, side, amount, price, params) +``` +#### **PHP** +```php +// for a take profit order +$params = { + 'takeProfitPrice': 120.45, // your take profit price +} + +$order = $exchange->create_order ($symbol, $type, $side, $amount, $price, $params); +``` + + +#### StopLoss And TakeProfit Orders Attached To A Position + +**Take Profit** / **Stop Loss** Orders which are tied to a position-opening primary order. Implemented by supplying a dictionary parameters for `stopLoss` and `takeProfit` describing each respectively. + +* By default stopLoss and takeProfit order amounts will be the same as primary order but in the opposite direction. +* Attached trigger orders are conditional on the primary order being executed. +* Not supported by all exchanges. To check whether stop-loss is supported, use such approach: +``` +exchange.featureValue('BTC/USDT', 'createOrder', 'stopLoss') // if stopLoss supported +exchange.featureValue('BTC/USDT', 'createOrder', 'stopLoss', 'price') // if limit price is supported for stoploss +``` + + +#### **Javascript** +```javascript +const params = { + 'stopLoss': { + 'triggerPrice': 12.34, // at what price it will trigger + 'price': 12.00, // if exchange supports, 'price' param would be limit price (for market orders, don't include this param) + }, + 'takeProfit': { + // similar params here + } +} +const order = await exchange.createOrder ('SOL/USDT', 'limit', 'buy', 0.5, 13, params) +``` +#### **Python** +```python +params = { + 'stopLoss': { + 'triggerPrice': 12.34, # at what price it will trigger + 'price': 12.00, # if exchange supports, 'price' param would be limit price (for market orders, don't include this param) + }, + 'takeProfit': { + # similar params here + } +} +order = exchange.create_order ('SOL/USDT', 'limit', 'buy', 0.5, 13, params) +``` +#### **PHP** +```php +$params = [ + 'stopLoss': [ + 'triggerPrice'=> 12.34, // at what price it will trigger + 'price'=> 12.00, // if exchange supports, 'price' param would be limit price (for market orders, don't include this param) + ], + 'takeProfit'=> [ + // similar params here + ] +] +$order = $exchange->create_order ('SOL/USDT', 'limit', 'buy', 0.5, 13, $params); +``` + + +For exchanges, where it is not possible to use attached SL &TP, after submitting an entry order, you can immediatelly submit another order (even though position might not be open yet) with `triggerPrice` and `reduceOnly: true` params, so it can still act as a stoploss order for your upcoming position (note, this approach might not work for some exchanges). + +#### Trailing Orders + +**Trailing** Orders trail behind an open position. Implemented by supplying float parameters for `trailingPercent` or `trailingAmount`. + +* A trailing order continually adjusts the order price at a fixed percent or fixed quote amount away from the current market price. +* A trailing order trails behind a position as it moves in one direction, but not in the opposite direction. +* If the position value rises, the trailing order changes, but if the position value drops the trailing order stays the same until the order is executed. +* A trailing order can be placed independently after opening a position. +* Implemented by filling in either the `trailingPercent` or `trailingAmount` parameter depending on the exchange. +* The price argument can be used as the `trailingTriggerPrice`, and the type argument can be used to differentiate between limit and market trailing orders if needed. + +*Not supported by all exchanges.* + +*Note: This is still under unification and is a work in progress* + + +#### **Javascript** +```javascript +symbol = 'BTC/USDT:USDT'; +type = 'market'; +side = 'sell'; +amount = 1.0; +price = undefined; +const params = { + 'trailingPercent': 1.0, // percentage away from the current market price 1.0 is equal to 1% + // 'trailingAmount': 100.0, // quote amount away from the current market price + // 'trailingTriggerPrice': 44500.0, // the price to trigger activating a trailing stop order + // 'reduceOnly': true, // set to true if you want to close a position, set to false if you want to open a new position +} +const order = await exchange.createOrder (symbol, type, side, amount, price, params) +``` +#### **Python** +```python +symbol = 'BTC/USDT:USDT' +type = 'market' +side = 'sell' +amount = 1.0 +price = None +params = { + 'trailingPercent': 1.0, # percentage away from the current market price 1.0 is equal to 1% + # 'trailingAmount': 100.0, # quote amount away from the current market price + # 'trailingTriggerPrice': 44500.0, # the price to trigger activating a trailing stop order + # 'reduceOnly': True, # set to True if you want to close a position, set to False if you want to open a new position +} +order = exchange.create_order (symbol, type, side, amount, price, params) +``` +#### **PHP** +```php +$symbol = 'BTC/USDT:USDT'; +$type = 'market'; +$side = 'sell'; +$amount = 1.0; +$price = null; +$params = { + 'trailingPercent': 1.0, // percentage away from the current market price 1.0 is equal to 1% + // 'trailingAmount': 100.0, // quote amount away from the current market price + // 'trailingTriggerPrice': 44500.0, // the price to trigger activating a trailing stop order + // 'reduceOnly': true, // set to true if you want to close a position, set to false if you want to open a new position +} +$order = $exchange->create_order ($symbol, $type, $side, $amount, $price, $params); +``` + + +#### Custom Order Params + +Some exchanges allow you to specify optional parameters for your order. You can pass your optional parameters and override your query with an associative array using the `params` argument to your unified API call. All custom params are exchange-specific, of course, and aren't interchangeable, do not expect those custom params for one exchange to work with another exchange. + + +#### **Javascript** +```javascript +// use a custom order type +bitfinex.createLimitSellOrder ('BTC/USD', 1, 10, { 'type': 'trailing-stop' }) +``` +#### **Python** +```python +# add a custom order flag +kraken.create_market_buy_order('BTC/USD', 1, {'trading_agreement': 'agree'}) +``` +#### **PHP** +```php +// add custom user id to your order +$hitbtc->create_order ('BTC/USD', 'limit', 'buy', 1, 3000, array ('clientOrderId' => '123')); +``` + + +##### User-defined `clientOrderId` + +```text +- this part of the unified API is currenty a work in progress +- there may be some issues and missing implementations here and there +- contributions, pull requests and feedback appreciated +``` + +The user can specify a custom `clientOrderId` field can be set upon placing orders with the `params`. Using the `clientOrderId` one can later distinguish between own orders. This is only available for the exchanges that do support `clientOrderId` at this time. For the exchanges that don't support it will either throw an error upon supplying the `clientOrderId` or will ignore it setting the `clientOrderId` to `undefined/None/null`. + + +#### **Javascript** +```javascript +exchange.createOrder (symbol, type, side, amount, price, { + 'clientOrderId': 'Hello', +}) +``` +#### **Python** +```python +exchange.create_order(symbol, type, side, amount, price, { + 'clientOrderId': 'World', +}) +``` +#### **PHP** +```php +$exchange->create_order($symbol, $type, $side, $amount, $price, array( + 'clientOrderId' => 'Foobar', +)) +``` + + +##### Hedge mode for order + +If exchange supports [feature](#features) for `hedged` orders, user can pass `params['hedged'] = true` in `createOrder` to open a `hedged` position instead of default `one-way` mode order. However, if exchange supports `.has['setPositionMode']` then those exchanges might not support `hedged` param directly through `createOrder`, instead on such exchange you need to change the account-mode at first using [setPositionMode()](#set-position-mode) and then run `createOrder` (without `hedged` param) and it will place hedged order by default. + + + +### Editing Orders + +To edit an order, you can use the `editOrder` method + +```javascript +editOrder (id, symbol, type, side, amount, price = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Order id (e.g. `1645807945000`) +- **symbol** (String) *required* Unified CCXT market symbol +- **side** (String) *required* the direction of your order. + **Unified sides:** + - `buy` give quote currency and receive base currency; for example, buying `BTC/USD` means that you will receive bitcoins for your dollars. + - `sell` give base currency and receive quote currency; for example, buying `BTC/USD` means that you will receive dollars for your bitcoins. +- **type** (String) *required* type of order + **Unified types:** + - [`market`](market-orders) not allowed by some exchanges, see [their docs](#exchanges) for details + - [`limit`](limit-orders) + - see #custom-order-params and #other-order-types for non-unified types +- **amount** (Number) *required* how much of currency you want to trade usually, but not always, in units of the base currency of the trading pair symbol (the units for some exchanges are dependent on the side of the order: see their API docs for details.) +- **price** (Float) the price at which the order is to be fullfilled at in units of the quote currency (ignored in market orders) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"settle": "usdt"}`) + +Returns + +- An [order structure](#order-structure) + +### Canceling Orders + +To cancel an existing order use + +- `cancelOrder ()` for a single order +- `cancelOrders ()` for multiple orders +- `cancelAllOrders ()` for all open orders +- `cancelAllOrdersAfter ()` for all open orders after the given timeout + +```javascript +cancelOrder (id, symbol = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Order id (e.g. `1645807945000`) +- **symbol** (String) Unified CCXT market symbol **required** on some exchanges (e.g. `"BTC/USDT"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"settle": "usdt"}`) + +Returns + +- An [order structure](#order-structure) + +```javascript +cancelOrders (ids, symbol = undefined, params = {}) +``` + +Parameters + +- **ids** (\[String\]) *required* Order ids (e.g. `1645807945000`) +- **symbol** (String) Unified CCXT market symbol **required** on some exchanges (e.g. `"BTC/USDT"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"settle": "usdt"}`) + +Returns + +- An array of [order structures](#order-structure) + +```javascript +async cancelAllOrders (symbol = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT market symbol **required** on some exchanges (e.g. `"BTC/USDT"`) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. `{"settle": "usdt"}`) + +Returns + +- An array of [order structures](#order-structure) + +```javascript +async cancelAllOrdersAfter (timeout, params = {}) +``` + +Parameters + +- **timeout** (number) countdown time in milliseconds **required** on some exchanges, 0 represents cancel the timer (e.g. ``10``\ ) +- **params** (Dictionary) Extra parameters specific to the exchange API endpoint (e.g. ``{"type": "spot"}``\ ) + +Returns + +- An object + +#### Exceptions Upon Canceling Orders + +The `cancelOrder()` is usually used on open orders only. However, it may happen that your order gets executed (filled and closed) +before your cancel-request comes in, so a cancel-request might hit an already-closed order. + +A cancel-request might also throw a `OperationFailed` indicating that the order might or might not have been canceled successfully and whether you need to retry or not. Consecutive calls to `cancelOrder()` may hit an already canceled order as well. + +As such, `cancelOrder()` can throw an `OrderNotFound` exception in these cases: +- canceling an already-closed order +- canceling an already-canceled order + +## My Trades + +```text +- this part of the unified API is currenty a work in progress +- there may be some issues and missing implementations here and there +- contributions, pull requests and feedback appreciated +``` + +### How Orders Are Related To Trades + +A trade is also often called `a fill`. Each trade is a result of order execution. Note, that orders and trades have a one-to-many relationship: an execution of one order may result in several trades. However, when one order matches another opposing order, the pair of two matching orders yields one trade. Thus, when an order matches multiple opposing orders, this yields multiple trades, one trade per each pair of matched orders. + +To put it shortly, an order can contain *one or more* trades. Or, in other words, an order can be *filled* with one or more trades. + +For example, an orderbook can have the following orders (whatever trading symbol or pair it is): + +```text + | price | amount +----|---------------- + a | 1.200 | 200 + s | 1.100 | 300 + k | 0.900 | 100 +----|---------------- + b | 0.800 | 100 + i | 0.700 | 200 + d | 0.500 | 100 +``` + +All specific numbers above aren't real, this is just to illustrate the way orders and trades are related in general. + +A seller decides to place a sell limit order on the ask side for a price of 0.700 and an amount of 150. + +```text + | price | amount +----|---------------- ↓ + a | 1.200 | 200 ↓ + s | 1.100 | 300 ↓ + k | 0.900 | 100 ↓ +----|---------------- ↓ + b | 0.800 | 100 ↓ sell 150 for 0.700 + i | 0.700 | 200 -------------------- + d | 0.500 | 100 +``` + +As the price and amount of the incoming sell (ask) order cover more than one bid order (orders `b` and `i`), the following sequence of events usually happens within an exchange engine very quickly, but not immediately: + +1. Order `b` is matched against the incoming sell because their prices intersect. Their volumes *"mutually annihilate"* each other, so, the bidder gets 100 for a price of 0.800. The seller (asker) will have their sell order partially filled by bid volume 100 for a price of 0.800. Note that for the filled part of the order the seller gets a better price than he asked for initially. He asked for 0.7 at least but got 0.8 instead which is even better for the seller. Most conventional exchanges fill orders for the best price available. + +2. A trade is generated for the order `b` against the incoming sell order. That trade *"fills"* the entire order `b` and most of the sell order. One trade is generated per each pair of matched orders, whether the amount was filled completely or partially. In this example the seller amount (100) fills order `b` completely (closes the order `b`) and also fills the selling order partially (leaves it open in the orderbook). + +3. Order `b` now has a status of `closed` and a filled volume of 100. It contains one trade against the selling order. The selling order has an `open` status and a filled volume of 100. It contains one trade against order `b`. Thus each order has just one fill-trade so far. + +4. The incoming sell order has a filled amount of 100 and has yet to fill the remaining amount of 50 from its initial amount of 150 in total. + +The intermediate state of the orderbook is now (order `b` is `closed` and is not in the orderbook anymore): + +```text + | price | amount +----|---------------- ↓ + a | 1.200 | 200 ↓ + s | 1.100 | 300 ↓ + k | 0.900 | 100 ↓ +----|---------------- ↓ sell remaining 50 for 0.700 + i | 0.700 | 200 ----------------------------- + d | 0.500 | 100 +``` + +5. Order `i` is matched against the remaining part of incoming sell, because their prices intersect. The amount of buying order `i` which is 200 completely annihilates the remaining sell amount of 50. The order `i` is filled partially by 50, but the rest of its volume, namely the remaining amount of 150 will stay in the orderbook. The selling order, however, is fulfilled completely by this second match. + +6. A trade is generated for the order `i` against the incoming sell order. That trade partially fills order `i`. And completes the filling of the sell order. Again, this is just one trade for a pair of matched orders. + +7. Order `i` now has a status of `open`, a filled amount of 50, and a remaining amount of 150. It contains one filling trade against the selling order. The selling order has a `closed` status now and it has completely filled its total initial amount of 150. However, it contains two trades, the first against order `b` and the second against order `i`. Thus each order can have one or more filling trades, depending on how their volumes were matched by the exchange engine. + +After the above sequence takes place, the updated orderbook will look like this. + +```text + | price | amount +----|---------------- + a | 1.200 | 200 + s | 1.100 | 300 + k | 0.900 | 100 +----|---------------- + i | 0.700 | 150 + d | 0.500 | 100 +``` + +Notice that the order `b` has disappeared, the selling order also isn't there. All closed and fully-filled orders disappear from the orderbook. The order `i` which was filled partially and still has a remaining volume and an `open` status, is still there. + +### Personal Trades + +Most of unified methods will return either a single object or a plain array (a list) of objects (trades). However, very few exchanges (if any at all) will return all trades at once. Most often their APIs `limit` output to a certain number of most recent objects. **YOU CANNOT GET ALL OBJECTS SINCE THE BEGINNING OF TIME TO THE PRESENT MOMENT IN JUST ONE CALL**. Practically, very few exchanges will tolerate or allow that. + +As with all other unified methods for fetching historical data, the `fetchMyTrades` method accepts a `since` argument for [date-based pagination](#date-based-pagination). Just like with all other unified methods throughout the CCXT library, the `since` argument for `fetchMyTrades` must be an **integer timestamp in milliseconds**. + +To fetch historical trades, the user will need to traverse the data in portions or "pages" of objects. Pagination often implies *"fetching portions of data one by one"* in a loop. + +In many cases a `symbol` argument is required by the exchanges' APIs, therefore you have to loop over all symbols to get all your trades. If the `symbol` is missing and the exchange requires it then CCXT will throw an `ArgumentsRequired` exception to signal the requirement to the user. And then the `symbol` has to be specified. One of the approaches is to filter the relevant symbols from the list of all symbols by looking at non-zero balances as well as transactions (withdrawals and deposits). Also, the exchanges will have a limit on how far back in time you can go. + +In most cases users are **required to use at least some type of [pagination](#pagination)** in order to get the expected results consistently. + + +#### **Javascript** +```javascript +// fetchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) + +if (exchange.has['fetchMyTrades']) { + const trades = await exchange.fetchMyTrades (symbol, since, limit, params) +} +``` +#### **Python** +```python +# fetch_my_trades(symbol=None, since=None, limit=None, params={}) + +if exchange.has['fetchMyTrades']: + exchange.fetch_my_trades(symbol=None, since=None, limit=None, params={}) +``` +#### **PHP** +```php +// fetch_my_trades($symbol = null, $since = null, $limit = null, $params = array()) + +if ($exchange->has['fetchMyTrades']) { + $trades = $exchange->fetch_my_trades($symbol, $since, $limit, $params); +} +``` + + +Returns ordered array `[]` of trades (most recent trade last). + +#### Trade Structure + +Trades denote the exchange of one currency for another, unlike [transactions](#transaction-structure), which denote a transfer of a given coin. + +```javascript +{ + 'info': { ... }, // the original decoded JSON as is + 'id': '12345-67890:09876/54321', // string trade id + 'timestamp': 1502962946216, // Unix timestamp in milliseconds + 'datetime': '2017-08-17 12:42:48.000', // ISO8601 datetime with milliseconds + 'symbol': 'ETH/BTC', // symbol + 'order': '12345-67890:09876/54321', // string order id or undefined/None/null + 'type': 'limit', // order type, 'market', 'limit' or undefined/None/null + 'side': 'buy', // direction of the trade, 'buy' or 'sell' + 'takerOrMaker': 'taker', // string, 'taker' or 'maker' + 'price': 0.06917684, // float price in quote currency + 'amount': 1.5, // amount of base currency + 'cost': 0.10376526, // total cost, `price * amount`, + 'fee': { // provided by exchange or calculated by ccxt + 'cost': 0.0015, // float + 'currency': 'ETH', // usually base currency for buys, quote currency for sells + 'rate': 0.002, // the fee rate (if available) + }, + 'fees': [ // an array of fees if paid in multiple currencies + { // if provided by exchange or calculated by ccxt + 'cost': 0.0015, // float + 'currency': 'ETH', // usually base currency for buys, quote currency for sells + 'rate': 0.002, // the fee rate (if available) + }, + ], +} +``` + +- The work on `'fee'` and `'fees'` info is still in progress, fee info may be missing partially or entirely, depending on the exchange capabilities. +- The `fee` currency may be different from both traded currencies (for example, an ETH/BTC order with fees in USD). +- The `cost` of the trade means `amount * price`. It is the total *quote* volume of the trade (whereas `amount` is the *base* volume). The cost field itself is there mostly for convenience and can be deduced from other fields. +- The `cost` of the trade is a _"gross"_ value. That is the value pre-fee, and the fee has to be applied afterwards. + +### Trades By Order Id + +#### **Javascript** +```javascript +// fetchOrderTrades (id, symbol = undefined, since = undefined, limit = undefined, params = {}) + +if (exchange.has['fetchOrderTrades']) { + const trades = await exchange.fetchOrderTrades (orderId, symbol, since, limit, params) +} +``` +#### **Python** +```python +# fetch_order_trades(id, symbol=None, since=None, limit=None, params={}) + +if exchange.has['fetchOrderTrades']: + exchange.fetch_order_trades(order_id, symbol=None, since=None, limit=None, params={}) +``` +#### **PHP** +```php +// fetch_order_trades ($id, $symbol = null, $since = null, $limit = null, $params = array()) + +if ($exchange->has['fetchOrderTrades']) { + $trades = $exchange->fetch_order_trades($order_id, $symbol, $since, $limit, $params); +} +``` + + +## Ledger + +The ledger is simply the history of changes, actions done by the user or operations that altered the user's balance in any way, that is, the history of movements of all funds from/to all accounts of the user which includes + +- deposits and withdrawals (funding) +- amounts incoming and outcoming in result of a trade or an order +- trading fees +- transfers between accounts +- rebates, cashbacks and other types of events that are subject to accounting. + +Data on ledger entries can be retrieved using + +- `fetchLedgerEntry ()` for a ledger entry +- `fetchLedger ( code )` for multiple ledger entries of the same currency +- `fetchLedger ()` for all ledger entries + +```javascript +fetchLedgerEntry (id, code = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Ledger entry id +- **code** (String) Unified CCXT currency code, required (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"type": "deposit"}`) + +Returns + +- A [ledger entry structure](#ledger-entry-structure) + +```javascript +async fetchLedger (code = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code; *required* if fetching all ledger entries for all assets at once is not supported (e.g. `"USDT"`) +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve withdrawals for (e.g. `1646940314000`) +- **limit** (Integer) The number of [ledger entry structures](#ledger-entry-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [ledger entry structures](#ledger-entry-structure) + +### Ledger Entry Structure + +```javascript +{ + 'id': 'hqfl-f125f9l2c9', // string id of the ledger entry, e.g. an order id + 'direction': 'out', // or 'in' + 'account': '06d4ab58-dfcd-468a', // string id of the account if any + 'referenceId': 'bf7a-d4441fb3fd31', // string id of the trade, transaction, etc... + 'referenceAccount': '3146-4286-bb71', // string id of the opposite account (if any) + 'type': 'trade', // string, reference type, see below + 'currency': 'BTC', // string, unified currency code, 'ETH', 'USDT'... + 'amount': 123.45, // absolute number, float (does not include the fee) + 'timestamp': 1544582941735, // milliseconds since epoch time in UTC + 'datetime': "2018-12-12T02:49:01.735Z", // string of timestamp, ISO8601 + 'before': 0, // amount of currency on balance before + 'after': 0, // amount of currency on balance after + 'status': 'ok', // 'ok, 'pending', 'canceled' + 'fee': { // object or undefined + 'cost': 54.321, // absolute number on top of the amount + 'currency': 'ETH', // string, unified currency code, 'ETH', 'USDT'... + }, + 'info': { ... }, // raw ledger entry as is from the exchange +} +``` + +#### Notes On Ledger Entry Structure + +The type of the ledger entry is the type of the operation associated with it. If the amount comes due to a sell order, then it is associated with a corresponding trade type ledger entry, and the referenceId will contain associated trade id (if the exchange in question provides it). If the amount comes out due to a withdrawal, then is associated with a corresponding transaction. + +- `trade` +- `transaction` +- `fee` +- `rebate` +- `cashback` +- `referral` +- `transfer` +- `airdrop` +- `whatever` +- ... + +The `referenceId` field holds the id of the corresponding event that was registered by adding a new item to the ledger. + +The `status` field is there to support for exchanges that include pending and canceled changes in the ledger. The ledger naturally represents the actual changes that have taken place, therefore the status is `'ok'` in most cases. + +The ledger entry type can be associated with a regular trade or a funding transaction (deposit or withdrawal) or an internal `transfer` between two accounts of the same user. If the ledger entry is associated with an internal transfer, the `account` field will contain the id of the account that is being altered with the ledger entry in question. The `referenceAccount` field will contain the id of the opposite account the funds are transferred to/from, depending on the `direction` (`'in'` or `'out'`). + +## Deposit + +In order to deposit cryptocurrency funds to an exchange you must get an address from the exchange for the currency you want to deposit using `fetchDepositAddress`. You can then call the `withdraw` method with the specified currency and address. + +To deposit fiat currency on an exchange you can use the `deposit` method with data retrieved from the `fetchDepositMethodId` method. +*this deposit feature is currently supported on coinbase only, feel free to report any issues you find* + +- `deposit ()` + +```javascript +deposit (id, code = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Deposit id +- **code** (String) Fiat currency code, required (e.g. `"USD"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"account": "fiat"}`) + +Returns + +- A [transaction structure](#transaction-structure) + +- `fetchDepositMethodId ()` + +```javascript +fetchDepositMethodId (id, params = {}) +``` + +Parameters + +- **id** (String) *required* Deposit id +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"account": "fiat"}`) + +Returns + +- A [deposit id structure](#deposit-id-structure) + +- `fetchDepositMethodIds ()` + +```javascript +fetchDepositMethodIds (params = {}) +``` + +Parameters + +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"account": "fiat"}`) + +Returns + +- An array of [deposit id structures](#deposit-id-structure) + +### Deposit Id Structure + +The deposit id structure returned from `fetchDepositMethodId`, `fetchDepositMethodIds` look like this: + +```javascript +{ + 'info': {}, // raw unparsed data as returned from the exchange + 'id': '75ab52ff-f25t', // the deposit id + 'currency': 'USD', // fiat currency + 'verified': true, // whether funding through this id is verified or not + 'tag': 'from credit card', // tag / memo / name of funding source +} +``` + +Data on deposits made to an account can be retrieved using + +- `fetchDeposit ()` for a single deposit +- `fetchDeposits ( code )` for multiple deposits of the same currency +- `fetchDeposits ()` for all deposits to an account + +```javascript +fetchDeposit (id, code = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Deposit id +- **code** (String) Unified CCXT currency code, required (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"network": "TRX"}`) + +Returns + +- A [transaction structure](#transaction-structure) + +```javascript +fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code (e.g. `"USDT"`) +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve deposits for (e.g. `1646940314000`) +- **limit** (Integer) The number of [transaction structures](#transaction-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [transaction structures](#transaction-structure) + +## Withdrawal + +The `withdraw` method can be used to withdraw funds from an account + +Some exchanges require a manual approval of each withdrawal by means of 2FA (2-factor authentication). In order to approve your withdrawal you usually have to either click their secret link in your email inbox or enter a Google Authenticator code or an Authy code on their website to verify that withdrawal transaction was requested intentionally. + +In some cases you can also use the withdrawal id to check withdrawal status later (whether it succeeded or not) and to submit 2FA confirmation codes, where this is supported by the exchange. See [their docs](#exchanges) for details. + +#### **Javascript** +```javascript +withdraw (code, amount, address, tag = undefined, params = {}) +``` +#### **Python** +```python +withdraw(code, amount, address, tag=None, params={}) +``` +#### **PHP** +```php +withdraw ($code, $amount, $address, $tag = null, $params = array ()) +``` + + +Parameters + +- **code** (String) *required* Unified CCXT currency code (e.g. `"USDT"`) +- **amount** (Float) *required* The amount of currency to withdraw (e.g. `20`) +- **address** (String) *required* The recipient address of the withdrawal (e.g. `"TEY6qjnKDyyq5jDc3DJizWLCdUySrpQ4yp"`) +- **tag** (String) Required for some networks (e.g. `"52055"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"network": "TRX"}`) + +Returns + +- A [transaction structure](#transaction-structure) + +--- + +Data on withdrawals made to an account can be retrieved using + +- `fetchWithdrawal ()` for a single withdrawal +- `fetchWithdrawals ( code )` for multiple withdrawals of the same currency +- `fetchWithdrawals ()` for all withdrawals from an account + +```javascript +fetchWithdrawal (id, code = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Withdrawal id +- **code** (String) Unified CCXT currency code (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"network": "TRX"}`) + +```javascript +fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code (e.g. `"USDT"`) +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve withdrawals for (e.g. `1646940314000`) +- **limit** (Integer) The number of [transaction structures](#transaction-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [transaction structures](#transaction-structure) + +### Deposit And Withdrawal Networks + +It is also possible to pass the parameters as the fourth argument with or without a specified tag + +#### **Javascript** +```javascript +withdraw (code, amount, address, { tag, network: 'ETH' }) +``` +#### **Python** +```python +withdraw(code, amount, address, { 'tag': tag, 'network': 'ETH' }) +``` +#### **PHP** +```php +withdraw ($code, $amount, $address, array( 'tag' => tag, 'network' -> 'ETH' )); +``` + + +The following aliases of `network` allow for withdrawing crypto on multiple chains + +| Currency | Network | +|:---:|:---:| +| ETH | ERC20 | +| TRX | TRC20 | +| BSC | BEP20 | +| BNB | BEP2 | +| HT | HECO | +| OMNI | OMNI | + +You may set the value of `exchange.withdraw ('USDT', 100, 'TVJ1fwyJ1a8JbtUxZ8Km95sDFN9jhLxJ2D', { 'network': 'TRX' })` in order to withdraw USDT on the TRON chain, or 'BSC' to withdraw USDT on Binance Smart Chain. In the table above BSC and BEP20 are equivalent aliases, so it doesn't matter which one you use as they both will achieve the same effect. + +### Transaction Structure + +Transactions denote a transfer of a given coin, unlike [trades](#trade-structure), which denote the exchange of one currency for another. + +- *deposit structure* +- *withdrawal structure* + +```javascript +{ + 'info': { ... }, // the JSON response from the exchange as is + 'id': '123456', // exchange-specific transaction id, string + 'txid': '0x68bfb29821c50ca35ef3762f887fd3211e4405aba1a94e448a4f218b850358f0', + 'timestamp': 1534081184515, // timestamp in milliseconds + 'datetime': '2018-08-12T13:39:44.515Z', // ISO8601 string of the timestamp + 'addressFrom': '0x38b1F8644ED1Dbd5DcAedb3610301Bf5fa640D6f', // sender + 'address': '0x02b0a9b7b4cDe774af0f8e47cb4f1c2ccdEa0806', // "from" or "to" + 'addressTo': '0x304C68D441EF7EB0E2c056E836E8293BD28F8129', // receiver + 'tagFrom', '0xabcdef', // "tag" or "memo" or "payment_id" associated with the sender + 'tag': '0xabcdef' // "tag" or "memo" or "payment_id" associated with the address + 'tagTo': '0xhijgklmn', // "tag" or "memo" or "payment_id" associated with the receiver + 'type': 'deposit', // 'withdrawal' or 'transfer', string + 'amount': 1.2345, // float (does not include the fee) + 'currency': 'ETH', // a common unified currency code, string + 'status': 'pending', // 'ok', 'failed', 'canceled', string + 'updated': undefined, // UTC timestamp of most recent status change in ms + 'comment': 'a comment or message defined by the user if any', + 'fee': { // the entire fee structure may be undefined + 'currency': 'ETH', // a unified fee currency code + 'cost': 0.1234, // float + 'rate': undefined, // approximately, fee['cost'] / amount, float + }, +} +``` + +#### Notes On Transaction Structure + +- `addressFrom` or `addressTo` may be `undefined/None/null`, if the exchange in question does not specify all sides of the transaction +- The semantics of the `address` field is exchange-specific. In some cases it can contain the address of the sender, in other cases it may contain the address of the receiver. The actual value depends on the exchange. +- The `updated` field is the UTC timestamp in milliseconds of the most recent change of status of that funding operation, be it `withdrawal` or `deposit`. It is necessary if you want to track your changes in time, beyond a static snapshot. For example, if the exchange in question reports `created_at` and `confirmed_at` for a transaction, then the `updated` field will take the value of `Math.max (created_at, confirmed_at)`, that is, the timestamp of the most recent change of the status. +- The `updated` field may be `undefined/None/null` in certain exchange-specific cases. +- The `fee` substructure may be missing, if not supplied within the reply coming from the exchange. +- The `comment` field may be `undefined/None/null`, otherwise it will contain a message or note defined by the user upon creating the transaction. +- Be careful when handling the `tag` and the `address`. The `tag` is **NOT an arbitrary user-defined string** of your choice! You cannot send user messages and comments in the `tag`. The purpose of the `tag` field is to address your wallet properly, so it must be correct. You should only use the `tag` received from the exchange you're working with, otherwise your transaction might never arrive to its destination. +- The `type` field may be `deposit/withdrawal` or, in some cases (when the exchange's endpoint returns both internal transfers and blockchain transactions, e.g. `ccxt.coinlist`), could be `transfer`. + +### fetchDeposits Examples + +#### **Javascript** +```javascript +// fetchDeposits (code = undefined, since = undefined, limit = undefined, params = {}) + +if (exchange.has['fetchDeposits']) { + const deposits = await exchange.fetchDeposits (code, since, limit, params) +} else { + throw new Error (exchange.id + ' does not have the fetchDeposits method') +} +``` +#### **Python** +```python +# fetch_deposits(code = None, since = None, limit = None, params = {}) + +if exchange.has['fetchDeposits']: + deposits = exchange.fetch_deposits(code, since, limit, params) +else: + raise Exception (exchange.id + ' does not have the fetch_deposits method') +``` +#### **PHP** +```php +// fetch_deposits ($code = null, $since = null, $limit = null, $params = {}) + +if ($exchange->has['fetchDeposits']) { + $deposits = $exchange->fetch_deposits ($code, $since, $limit, $params); +} else { + throw new Exception ($exchange->id . ' does not have the fetch_deposits method'); +} +``` + + +### fetchWithdrawals Examples + + +#### **Javascript** +```javascript +// fetchWithdrawals (code = undefined, since = undefined, limit = undefined, params = {}) + +if (exchange.has['fetchWithdrawals']) { + const withdrawals = await exchange.fetchWithdrawals (code, since, limit, params) +} else { + throw new Error (exchange.id + ' does not have the fetchWithdrawals method') +} +``` +#### **Python** +```python +# fetch_withdrawals(code = None, since = None, limit = None, params = {}) + +if exchange.has['fetchWithdrawals']: + withdrawals = exchange.fetch_withdrawals(code, since, limit, params) +else: + raise Exception (exchange.id + ' does not have the fetch_withdrawals method') +``` +#### **PHP** +```php +// fetch_withdrawals ($code = null, $since = null, $limit = null, $params = {}) + +if ($exchange->has['fetchWithdrawals']) { + $withdrawals = $exchange->fetch_withdrawals ($code, $since, $limit, $params); +} else { + throw new Exception ($exchange->id . ' does not have the fetch_withdrawals method'); +} +``` + + +### fetchTransactions Examples + + +#### **Javascript** +```javascript +// fetchTransactions (code = undefined, since = undefined, limit = undefined, params = {}) + +if (exchange.has['fetchTransactions']) { + const transactions = await exchange.fetchTransactions (code, since, limit, params) +} else { + throw new Error (exchange.id + ' does not have the fetchTransactions method') +} +``` +#### **Python** +```python +# fetch_transactions(code = None, since = None, limit = None, params = {}) + +if exchange.has['fetchTransactions']: + transactions = exchange.fetch_transactions(code, since, limit, params) +else: + raise Exception (exchange.id + ' does not have the fetch_transactions method') +``` +#### **PHP** +```php +// fetch_transactions ($code = null, $since = null, $limit = null, $params = {}) + +if ($exchange->has['fetchTransactions']) { + $transactions = $exchange->fetch_transactions ($code, $since, $limit, $params); +} else { + throw new Exception ($exchange->id . ' does not have the fetch_transactions method'); +} +``` + + +## Deposit Addresses + +The address for depositing can be either an already existing address that was created previously with the exchange or it can be created upon request. In order to see which of the two methods are supported, check the `exchange.has['fetchDepositAddress']` and `exchange.has['createDepositAddress']` properties. + +```javascript +fetchDepositAddress (code, params = {}) +createDepositAddress (code, params = {}) +``` + +Parameters + +- **code** (String) *required* Unified CCXT currency code (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- an [address structure](#address-structure) + +--- + +Some exchanges may also have a method for fetching multiple deposit addresses at once or all of them at once. + +```javascript +fetchDepositAddresses (codes = undefined, params = {}) +``` + +Parameters + +- **code** (\[String\]) Array of unified CCXT currency codes. May or may not be required depending on the exchange (e.g. `["USDT", "BTC"]`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- an array of [address structures](#address-structure) + +```javascript +fetchDepositAddressesByNetwork (code, params = {}) +``` + +Parameters + +- **code** (String) *required* Unified CCXT currency code (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- an array of [address structures](#address-structure) + +### Address Structure + +The address structures returned from `fetchDepositAddress`, `fetchDepositAddresses`, `fetchDepositAddressesByNetwork` and `createDepositAddress` look like this: + +```javascript +{ + 'info': response, // raw unparsed data as returned from the exchange + 'currency': 'USDC', // currency code + 'network': 'ERC20', // a deposit/withdraw networks, ERC20, TRC20, BSC20 (see below) + 'address': '0x', // blockchain address in terms of the requested currency and network + 'tag': undefined, // tag / memo / paymentId for particular currencies (XRP, XMR, ...) +} +``` + +With certain currencies, like AEON, BTS, GXS, NXT, SBD, STEEM, STR, XEM, XLM, XMR, XRP, an additional argument `tag` is usually required by exchanges. Other currencies will have the `tag` set to `undefined / None / null`. The tag is a memo or a message or a payment id that is attached to a withdrawal transaction. The tag is mandatory for those currencies and it identifies the recipient user account. + +Be careful when specifying the `tag` and the `address`. The `tag` is **NOT an arbitrary user-defined string** of your choice! You cannot send user messages and comments in the `tag`. The purpose of the `tag` field is to address your wallet properly, so it must be correct. You should only use the `tag` received from the exchange you're working with, otherwise your transaction might never arrive to its destination. + +**The `network` field is relatively new, it may be `undefined / None / null` or missing entirely in certain cases (with some exchanges), but will be added everywhere eventually. It is still in the process of unification.** + +## Transfers + +The `transfer` method makes internal transfers of funds between accounts on the same exchange. This can include subaccounts or accounts of different types (`spot`, `margin`, `future`, ...). If an exchange is separated on CCXT into a spot and futures class (e.g. `binanceusdm`, `kucoinfutures`, ...), then the method `transferIn` may be available to transfer funds into the futures account, and the method `transferOut` may be available to transfer funds out of the futures account + +```javascript +transfer (code, amount, fromAccount, toAccount, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code (e.g. `"USDT"`) +- **amount** (Float) The amount of currency to transfer (e.g. `10.5`) +- **fromAccount** (String) The account to transfer funds from. +- **toAccount** (String) The account to transfer funds to. +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) +- **params.symbol** (String) Market symbol when transfering to or from a margin account (e.g. `'BTC/USDT'`) + +### Account Types + +`fromAccount` and `toAccount` can accept the exchange account id or one of the following unified values: + +- `funding` *for some exchanges `funding` and `spot` are the same account* +- `main` *for some exchanges that allow for subaccounts* +- `spot` +- `margin` +- `future` +- `swap` +- `lending` + +You can retrieve all the account types by selecting the keys from `exchange.options['accountsByType'] + +Some exchanges allow transfers to email addresses, phone numbers or to other users by user id. + +Returns + +- A [transfer structure](#transfer-structure) + +```javascript +transferIn (code, amount, params = {}) +transferOut (code, amount, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code (e.g. `"USDT"`) +- **amount** (Float) The amount of currency to transfer (e.g. `10.5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- A [transfer structure](#transfer-structure) + +```javascript +fetchTransfers (code = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **code** (String) Unified CCXT currency code (e.g. `"USDT"`) +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve transfers for (e.g. `1646940314000`) +- **limit** (Integer) The number of [transfer structures](#transfer-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [transfer structures](#transfer-structure) + +```javascript +fetchTransfer (id, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **id** (String) tranfer id (e.g. `"12345"`) +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve transfers for (e.g. `1646940314000`) +- **limit** (Integer) The number of [transfer structures](#transfer-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- A [transfer structure](#transfer-structure) + +### Transfer Structure + +```javascript +{ + info: { ... }, + id: "93920432048", + timestamp: 1646764072000, + datetime: "2022-03-08T18:27:52.000Z", + currency: "USDT", + amount: 11.31, + fromAccount: "spot", + toAccount: "future", + status: "ok" +} +``` +## Fees + +**This section of the Unified CCXT API is under development.** + +Fees are often grouped into two categories: + +- Trading fees. Trading fee is the amount payable to the exchange, usually a percentage of volume traded (filled). +- Transaction fees. The amount payable to the exchange upon depositing and withdrawing as well as the underlying crypto transaction fees (tx fees). + +Because the fee structure can depend on the actual volume of currencies traded by the user, the fees can be account-specific. Methods to work with account-specific fees: + +```javascript +fetchTradingFee (symbol, params = {}) +fetchTradingFees (params = {}) +fetchDepositWithdrawFees (codes = undefined, params = {}) +fetchDepositWithdrawFee (code, params = {}) +``` + + +The fee methods will return a unified fee structure, which is often present with orders and trades as well. The fee structure is a common format for representing the fee info throughout the library. Fee structures are usually indexed by market or currency. + +Because this is still a work in progress, some or all of methods and info described in this section may be missing with this or that exchange. + +**DO NOT use the `.fees` property of the exchange instance as most often it contains the predefined/hardcoded info. Actual fees should only be accessed from markets and currencies.** + +**NOTE: Previously we used fetchTransactionFee(s) to fetch the transaction fees, which are now DEPRECATED and these functions have been replace by fetchDepositWithdrawFee(s)** + +You call `fetchTradingFee` / `fetchTradingFees` to fetch the trading fees, `fetchDepositWithdrawFee` / `fetchDepositWithdrawFees` to fetch the deposit & withdraw fees. + +### Fee Structure + +Orders, private trades, transactions and ledger entries may define the following info in their `fee` field: + +```javascript +{ + 'currency': 'BTC', // the unified fee currency code + 'rate': percentage, // the fee rate, 0.05% = 0.0005, 1% = 0.01, ... + 'cost': feePaid, // the fee cost (amount * fee rate) +} +``` + +### Fee Schedule + +```javascript +fetchTradingFees (params = {}) +``` + +```javascript +{ + 'withdraw': { + 'BTC': 0.00001, + 'ETH': 0.001, + 'LTC': 0.0003, + }, + 'deposit': { + 'BTC': 0, + }, + 'info': { ... }, +} +``` + +```javascript +fetchDepositWithdrawFees (codes, params = {}) +``` + +```javascript +{ + 'BTC': { + 'withdraw': { 'fee': 0.0005, 'percentage': false }, + 'deposit': { 'fee': undefined, 'percentage': undefined }, + 'networks': { + 'BTC': { + 'deposit': { 'fee': undefined, 'percentage': undefined }, + 'withdraw': { 'fee': 0.0005, 'percentage': false } + } + }, + 'info': { ... }, + }, + ... +} +``` + +### Trading Fees + +Trading fees are properties of markets. Most often trading fees are loaded into the markets by the `fetchMarkets` call. Sometimes, however, the exchanges serve fees from different endpoints. + +The `calculateFee` method can be used to precalculate trading fees that will be paid (use `calculateFeeWithRate` if you have a custom trading fee / tier, like VIP-X, instead of the default user fee) . **WARNING! This method is experimental, unstable and may produce incorrect results in certain cases.** You should only use it with caution. Actual fees may be different from the values returned from `calculateFee`, this is just for precalculation. Do not rely on precalculated values, because market conditions change frequently. It is difficult to know in advance whether your order will be a market taker or maker. + +```javascript + calculateFee (symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) + calculateFeeWithRate (symbol, type, side, amount, price, takerOrMaker = 'taker', customRate, params = {}) +``` + +The `calculateFee` method will return a unified fee structure with precalculated fees for an order with specified params. + +Accessing trading fee rates should be done via [`fetchTradingFees`](#fee-schedule) which is the recommended approach. If that method is not supported by exchange, then via the `.markets` property, like so: + +```javascript +exchange.markets['ETH/BTC']['taker'] // taker fee rate for ETH/BTC +exchange.markets['BTC/USD']['maker'] // maker fee rate for BTC/USD +``` + +The markets stored under the `.markets` property may contain additional fee related information: + +```javascript +{ + 'taker': 0.002, // taker fee rate, 0.002 = 0.2% + 'maker': 0.0016, // maker fee rate, 0.0016 = 0.16% + 'percentage': true, // whether the taker and maker fee rate is a multiplier or a fixed flat amount + 'tierBased': false, // whether the fee depends on your trading tier (your trading volume) + + 'tiers': { + 'taker': [ + [0, 0.0026], // tupple (trade volume in USD, taker fee) ordered by increasing volume + [50000, 0.0024], + ... + ], + 'maker': [ + [0, 0.0016], // tupple (trade volume in USD, maker fee) ordered by increasing volume + [50000, 0.0014], + ... + ], + }, +} +``` + +**WARNING! fee related information is experimental, unstable and may only be partial available or not at all.** + +Maker fees are paid when you provide liquidity to the exchange i.e. you *market-make* an order and someone else fills it. Maker fees are usually lower than taker fees. Similarly, taker fees are paid when you *take* liquidity from the exchange and fill someone else's order. + +Fees can be negative, this is very common amongst derivative exchanges. A negative fee means the exchange will pay a rebate (reward) to the user for the trading. + +Also, some exchanges might not specify fees as percentage of volume, check the `percentage` field of the market to be sure. + +#### Trading Fee Schedule + +Some exchanges have an endpoint for fetching the trading fee schedule, this is mapped to the unified methods `fetchTradingFees`, and `fetchTradingFee` + +```javascript +fetchTradingFee (symbol, params = {}) +``` + +Parameters + +- **symbol** (String) *required* Unified market symbol (e.g. `"BTC/USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"currency": "quote"}`) + +Returns + +- A [trading fee structure](#trading-fee-structure) + +```javascript +fetchTradingFees (params = {}) +``` + +Parameters + +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"currency": "quote"}`) + +Returns + +- An array of [trading fee structures](#trading-fee-structure) + +#### Trading Fee Structure + +```javascript +{ + 'ETH/BTC': { + 'maker': 0.001, + 'taker': 0.002, + 'info': { ... }, + 'symbol': 'ETH/BTC', + }, + 'LTC/BTC': { + 'maker': 0.001, + 'taker': 0.002, + 'info': { ... }, + 'symbol': 'LTC/BTC', + }, +} +``` + +### Transaction Fees + +Transaction fees are properties of currencies (account balance). + +Accessing transaction fee rates should be done via the `.currencies` property. This aspect is not unified yet and is subject to change. + +```javascript +exchange.currencies['ETH']['fee'] // tx/withdrawal fee rate for ETH +exchange.currencies['BTC']['fee'] // tx/withdrawal fee rate for BTC +``` + +#### Transaction Fee Schedule + +Some exchanges have an endpoint for fetching the transaction fee schedule, this is mapped to the unified methods + +- `fetchTransactionFee ()` for a single transaction fee schedule +- `fetchTransactionFees ()` for all transaction fee schedules + +```javascript +fetchTransactionFee (code, params = {}) +``` + +Parameters + +- **code** (String) *required* Unified CCXT currency code, required (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"type": "deposit"}`) +- **params.network** (String) Specify unified CCXT network (e.g. `{"network": "TRC20"}`) + +Returns + +- A [transaction fee structure](#transaction-fee-structure) + +```javascript +fetchTransactionFees (codes = undefined, params = {}) +``` + +Parameters + +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"type": "deposit"}`) + +Returns + +- An array of [transaction fee structures](#transaction-fee-structure) + +#### Transaction Fee Structure + +```javascript +{ + 'withdraw': { + 'BTC': 0.00001, + 'ETH': 0.001, + 'LTC': 0.0003, + }, + 'deposit': { + 'BTC': 0, + }, + 'info': { ... }, +} +``` + +## Borrow Interest + +* margin only + +To trade with leverage in spot or margin markets, currency must be borrowed as a loan. This borrowed currency must be payed back with interest. To obtain the amount of interest that has accrued you can use the `fetchBorrowInterest` method + +```javascript +fetchBorrowInterest (code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **code** (String) The unified currency code for the currency of the interest (e.g. `"USDT"`) +- **symbol** (String) The market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned (e.g. `"BTC/USDT:USDT"`) +- **since** (Integer) Timestamp (ms) of the earliest time to receive interest records for (e.g. `1646940314000`) +- **limit** (Integer) The number of [borrow interest structures](#borrow-interest-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [borrow interest structures](#borrow-interest-structure) + +### Borrow Interest Structure + +```javascript +{ + info: { ... } // Unparsed exchange response + symbol: 'BTC/USDT', // The market that the interest was accrued in + currency: 'USDT', // The currency of the interest + interest: 0.00004842, // The amount of interest that was charged + interestRate: 0.0002, // The borrow interest rate + amountBorrowed: 5.81, // The amount of currency that was borrowed + marginMode: 'cross', // The margin mode of the borrowed amount + timestamp: 1648699200000, // The timestamp that the interest was charged + datetime: '2022-03-31T04:00:00.000Z', // The datetime that the interest was charged +} +``` + +## Borrow And Repay Margin + +*margin only* + +To borrow and repay currency as a margin loan use `borrowCrossMargin`, `borrowIsolatedMargin`, `repayCrossMargin` and `repayIsolatedMargin`. + +```javascript +borrowCrossMargin (code, amount, params = {}) +repayCrossMargin (code, amount, params = {}) +``` +Parameters + +- **code** (String) *required* The unified currency code for the currency to be borrowed or repaid (e.g. `"USDT"`) +- **amount** (Float) *required* The amount of margin to borrow or repay (e.g. `20.92`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"rate": 0.002}`) + +Returns + +- A [margin loan structure](#margin-loan-structure) + +```javascript +borrowIsolatedMargin (symbol, code, amount, params = {}) +repayIsolatedMargin (symbol, code, amount, params = {}) +``` +Parameters + +- **symbol** (String) *required* The unified CCXT market symbol of an isolated margin market (e.g. `"BTC/USDT"`) +- **code** (String) *required* The unified currency code for the currency to be borrowed or repaid (e.g. `"USDT"`) +- **amount** (Float) *required* The amount of margin to borrow or repay (e.g. `20.92`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"rate": 0.002}`) + +Returns + +- A [margin loan structure](#margin-loan-structure) + +### Margin Loan Structure + +```javascript +{ + id: '1234323', // integer, the transaction id + currency: 'USDT', // string, the currency that is borrowed or repaid + amount: 5.81, // float, the amount of currency that was borrowed or repaid + symbol: 'BTC/USDT:USDT', // string, unified market symbol + timestamp: 1648699200000, // integer, the timestamp of when the transaction was made + datetime: '2022-03-31T04:00:00.000Z', // string, the datetime of when the transaction was made + info: { ... } // Unparsed exchange response +} +``` + +## Margin + +*margin and contract only* + +Note: through the manual we use term "collateral" which means current margin balance, but do not confuse it with "initial margin" or "maintenance margin": +- `collateral (current margin balance) = initial margin + realized & unrealized profit`. + +For example, when you had opened an isolated position with **50$** initial margin and the position has unrealized profit of **-15$**, then your position's **collateral** will be **35$**. However, if we take that Maintenance Margin requirement (to keep the position open) by exchange hints **$25** for that position, then your collateral should not drop below it, otherwise the position will be liquidated. + +To increase, reduce or set your margin balance (collateral) in an open leveraged position, use `addMargin`, `reduceMargin` and `setMargin` respectively. This is kind of like adjusting the amount of leverage you're using with a position that's already open. + +Some scenarios to use these methods include +- if the trade is going against you, you can add margin to, reducing the risk of liquidation +- if your trade is going well you can reduce your position's margin balance and take profits + +```javascript +addMargin (symbol, amount, params = {}) +reduceMargin (symbol, amount, params = {}) +setMargin (symbol, amount, params = {}) +``` + + +Parameters + +- **symbol** (String) *required* Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **amount** (String) *required* Amount of margin to add or reduce (e.g. `20`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"leverage": 5}`) + +Returns + +- a [margin structure](#margin-structure) + +You can fetch the history of margin adjustments made using the methods above or automatically by the exchange using the following method + +```javascript +fetchMarginAdjustmentHistory (symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **type** (String) "add" or "reduce" +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve margin adjustments for for (e.g. `1646940314000`) +- **limit** (Integer) The number of [margin structures](#margin-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"auto": true}`) + +Returns + +- a [margin structure](#margin-structure) + +### Margin Structure + +```javascript +{ + info: { ... }, + type: 'add', // 'add', 'reduce', 'set' + amount: 1, // amount added, reduced, or set + total: 2, // total margin or undefined if not specified by the exchange + code: 'USDT', + symbol: 'XRP/USDT:USDT', + status: 'ok' +} +``` + +## Set Margin Mode + +*margin and contract only* + +Updates the type of margin used to be either + +- `cross` One account is used to share collateral between markets. Margin is taken from total account balance to avoid liquidation when needed. +- `isolated` Each market, keeps collateral in a separate account + +```javascript +setMarginMode (marginMode, symbol = undefined, params = {}) +``` + +Parameters + +- **marginMode** (String) *required* the type of margin used + **Unified margin types:** + - `"cross"` + - `"isolated"` +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) *required* on most exchanges. Is not required when the margin mode is not specific to a market +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"leverage": 5}`) + +Returns + +- response from the exchange + +### Exchanges Without setMarginMode + +Common reasons for why an exchange might have + +```javascript +exchange.has['setMarginMode'] == false +``` + +include + +- the exchange does not offer leveraged trading +- the exchange only offers one of `cross` or `isolated` margin modes, but does not offer both +- margin mode must be set using an exchange specific parameter within `params` when using `createOrder` + +### Notes On Suppressed Errors For setMarginMode + +Some exchange apis return an error response when a request is sent to set the margin mode to the mode that it is already set to (e.g. Sending a request to set the margin mode to `cross` for the market `BTC/USDT:USDT` when the account already has `BTC/USDT:USDT` set to use cross margin). CCXT doesn't see this as an error because the end result is what the user wanted, so the error is suppressed and the error result is returned as an object. + +e.g. + +```javascript +{ code: -4046, msg: 'No need to change margin type.' } +``` + +### Notes On The marginMode Parameter + +Some methods allow the usage of a `marginMode` parameter that can be set to either `cross` or `isolated`. This can be useful for specifying the `marginMode` directly within the methods params, for use with spot margin or contract markets. To specify a spot margin market, you need to use a unified spot symbol or set the market type to spot, while setting the marginMode parameter to `cross` or `isolated`. + +Create a Spot Margin Order: + +*Use a unified spot symbol, while setting the marginMode parameter.* + + +#### **Javascript** +```javascript +const params = { + 'marginMode': 'isolated', // or 'cross' +} +const order = await exchange.createOrder ('ETH/USDT', 'market', 'buy', 0.1, 1500, params) +``` +#### **Python** +```python +params = { + 'marginMode': 'isolated', # or 'cross' +} +order = exchange.create_order ('ETH/USDT', 'market', 'buy', 0.1, 1500, params) +``` +#### **PHP** +```php +$params = { + 'marginMode': 'isolated', // or 'cross' +} +$order = $exchange->create_order ('ETH/USDT', 'market', 'buy', 0.1, 1500, $params); +``` + + +## Fetch Margin Mode + +*margin and contract only* + +The `fetchMarginMode()` method can be used to obtain the set margin mode for a market. The `fetchMarginModes()` method can be used to obtain the set margin mode for multiple markets at once. + +You can access the set margin mode by using: + +- `fetchMarginMode()` (single symbol) +- `fetchMarginModes([symbol1, symbol2, ...])` (multiple symbols) +- `fetchMarginModes()` (all market symbols) + +```javascript +fetchMarginMode(symbol, params = {}) +``` + +Parameters + +- **symbol** (String) *required* A unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"subType": "linear"}`) + +Returns + +- a [margin-mode-structure](#margin-mode-structure) + +```javascript +fetchMarginModes(symbols = undefined, params = {}) +``` + +Parameters + +- **symbols** (\[String\]) A list of unified CCXT symbols (e.g. `[ "BTC/USDT:USDT" ]`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"subType": "linear"}`) + +Returns + +- an array of [margin-mode-structures](#margin-mode-structure) + +### Margin Mode Structure + +```javascript +{ + "info": { ... } // response from the exchange + "symbol": "BTC/USDT:USDT", // unified market symbol + "marginMode": "cross", // the margin mode either cross or isolated +} +``` + +## Set Leverage + +*margin and contract only* + +```javascript +setLeverage (leverage, symbol = undefined, params = {}) +``` + +Parameters + +- **leverage** (Integer) *required* The desired leverage +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) *required* on most exchanges. Is not required when leverage is not specific to a market (e.g. If leverage is set for the account and not per market) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"marginMode": "cross"}`) + +Returns + +- response from the exchange + +## Leverage + +*margin and contract only* + +The `fetchLeverage()` method can be used to obtain the set leverage for a market. The `fetchLeverages()` method can be used to obtain the set leverage for multiple markets at once. + +You can access the set leverage by using: + +- `fetchLeverage()` (single symbol) +- `fetchLeverages([symbol1, symbol2, ...])` (multiple symbols) +- `fetchLeverages()` (all market symbols) + +```javascript +fetchLeverage(symbol, params = {}) +``` + +Parameters + +- **symbol** (String) *required* A unified CCXT symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"marginMode": "cross"}`) + +Returns + +- a [leverage-structure](#leverage-structure) + +```javascript +fetchLeverages(symbols = undefined, params = {}) +``` + +Parameters + +- **symbols** (\[String\]) A list of unified CCXT symbols (e.g. `[ "BTC/USDT:USDT" ]`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"marginMode": "cross"}`) + +Returns + +- an array of [leverage-structures](#leverage-structure) + +### Leverage Structure + +```javascript +{ + "info": { ... } // response from the exchange + "symbol": "BTC/USDT:USDT", // unified market symbol + "marginMode": "cross", // the margin mode either cross or isolated + "longLeverage": 100, // the set leverage for a long position + "shortLeverage": 75, // the set leverage for a short position +} +``` + +## Contract Trading + +This can include futures with a set expiry date, perpetual swaps with funding payments, and inverse futures or swaps. +Information about the positions can be served from different endpoints depending on the exchange. +In the case that there are multiple endpoints serving different types of derivatives CCXT will default to just loading the "linear" (as oppose to the "inverse") contracts or the "swap" (as opposed to the "future") contracts. + +### Positions + +*contract only* + +To get information about positions currently held in contract markets, use + +- fetchPosition () // for a single market +- fetchPositions () // for all positions +- fetchAccountPositions () // TODO +- fetchPositionHistory () // for single historical position +- fetchPositionsHistory () // for historical positions + +```javascript +fetchPosition (symbol, params = {}) // for a single market +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- A [position structure](#position-structure) + +```javascript +fetchPositions (symbols = undefined, params = {}) +fetchAccountPositions (symbols = undefined, params = {}) +``` + +Parameters + +- **symbols** (\[String\]) Unified CCXT market symbols, do not set to retrieve all positions (e.g. `["BTC/USDT:USDT"]`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [position structures](#position-structure) + +```javascript +fetchPositionHistory (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (\[String\]) Unified CCXT market symbols, do not set to retrieve all positions (e.g. `["BTC/USDT:USDT"]`) +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve positions for (e.g. `1646940314000`) +- **limit** (Integer) The number of [position structures](#position-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [position structures](#position-structure) + +#### Position Structure + +```javascript +{ + 'info': { ... }, // json response returned from the exchange as is + 'id': '1234323', // string, position id to reference the position, similar to an order id + 'symbol': 'BTC/USD', // uppercase string literal of a pair of currencies + 'timestamp': 1607723554607, // integer unix time since 1st Jan 1970 in milliseconds + 'datetime': '2020-12-11T21:52:34.607Z', // ISO8601 representation of the unix time above + 'isolated': true, // boolean, whether or not the position is isolated, as opposed to cross where margin is added automatically + 'hedged': false, // boolean, whether or not the position is hedged, i.e. if trading in the opposite direction will close this position or make a new one + 'side': 'long', // string, long or short + 'contracts': 5, // float, number of contracts bought, aka the amount or size of the position + 'contractSize': 100, // float, the size of one contract in quote units + 'entryPrice': 20000, // float, the average entry price of the position + 'markPrice': 20050, // float, a price that is used for funding calculations + 'notional': 100000, // float, the value of the position in the settlement currency + 'leverage': 100, // float, the leverage of the position, related to how many contracts you can buy with a given amount of collateral + 'collateral': 5300, // float, the maximum amount of collateral that can be lost, affected by pnl + 'initialMargin': 5000, // float, the amount of collateral that is locked up in this position + 'maintenanceMargin': 1000, // float, the mininum amount of collateral needed to avoid being liquidated + 'initialMarginPercentage': 0.05, // float, the initialMargin as a percentage of the notional + 'maintenanceMarginPercentage': 0.01, // float, the maintenanceMargin as a percentage of the notional + 'unrealizedPnl': 300, // float, the difference between the market price and the entry price times the number of contracts, can be negative + 'liquidationPrice': 19850, // float, the price at which collateral becomes less than maintenanceMargin + 'marginMode': 'cross', // string, can be cross or isolated + 'percentage': 3.32, // float, represents unrealizedPnl / initialMargin * 100 +} +``` +Positions allow you to borrow money from an exchange to go long or short on an market. Some exchanges require you to pay a funding fee to keep the position open. + +When you go long on a position you are betting that the price will be higher in the future and that the price will never be less than the `liquidationPrice`. + +As the price of the underlying index changes so does the unrealisedPnl and as a consequence the amount of collateral you have left in the position (since you can only close it at market price or worse). At some price you will have zero collateral left, this is called the "bust" or "zero" price. Beyond this point, if the price goes in the opposite direction far enough, the collateral of the position will drop below the `maintenanceMargin`. The maintenanceMargin acts as a safety buffer between your position and negative collateral, a scenario where the exchange incurs losses on your behalf. To protect itself the exchange will swiftly liquidate your position if and when this happens. Even if the price returns back above the liquidationPrice you will not get your money back since the exchange sold all the `contracts` you bought at market. In other words the maintenanceMargin is a hidden fee to borrow money. + +It is recommended to use the `maintenanceMargin` and `initialMargin` instead of the `maintenanceMarginPercentage` and `initialMarginPercentage` since these tend to be more accurate. The maintenanceMargin might be calculated from other factors outside of the maintenanceMarginPercentage including the funding rate and taker fees, for example on [kucoin](https://futures.kucoin.com/contract/detail). + +An inverse contract will allow you to go long or short on BTC/USD by putting up BTC as collateral. Our API for inverse contracts is the same as for linear contracts. The amounts in an inverse contracts are quoted as if they were traded USD/BTC, however the price is still quoted terms of BTC/USD. The formula for the profit and loss of a inverse contract is `(1/markPrice - 1/price) * contracts`. The profit and loss and collateral will now be quoted in BTC, and the number of contracts are quoted in USD. + +#### Closing Positions + +*contract only* + +To quickly close open positions with a market order, use + +- closePosition (symbol) // for a single market +- closeAllPositions (symbol) // for all positions + +```typescript +closePosition (symbol: string, side: OrderSide = undefined, params = {}): Promise +``` + +Parameters + +- **symbol** (String) *required* Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **side** *optional* a string literal for the direction of your order. Some exchanges require it. + **Unified sides:** + - `buy` give quote currency and receive base currency; for example, buying `BTC/USD` means that you will receive bitcoins for your dollars. + - `sell` give base currency and receive quote currency; for example, buying `BTC/USD` means that you will receive dollars for your bitcoins. +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An [order structure](#order-structure) + +```typescript +closeAllPositions (params = {}): Promise +``` + +Parameters +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- A list of [order structures](#order-structure) + + +## Set Position Mode + +*margin and contract only* + +Method used for setting position mode: + +- `true` - sets to **hedged** mode +- `false` - sets to **one-way** mode + +```javascript +set_position_mode (false, symbol = undefined, params = {}) +``` + +Parameters + +- **hedged** (String) *required* hedged-mode value: + - `true` + - `false` +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint + +Returns + +- response from the exchange + + +#### Liquidation Price + +It is the price at which the `initialMargin + unrealized = collateral = maintenanceMargin`. The price has gone in the opposite direction of your position to the point where the is only maintenanceMargin collateral left and if it goes any further the position will have negative collateral. + +```javascript +// if long +(liquidationPrice - price) * contracts = maintenanceMargin + +// if short +(price - liquidationPrice) * contracts = maintenanceMargin +// if inverse long +(1/liquidationPrice - 1/price) * contracts = maintenanceMargin + +// if inverse short +(1/price - 1/liquidationPrice) * contracts = maintenanceMargin +``` + +### Funding History + +*contract only* + +Perpetual swap (also known as perpetual future) contracts maintain a market price that mirrors the price of the asset they are based on because funding fees are exchanged between traders who hold positions in perpetual swap markets. + +If the contract is being traded at a price that is higher than the price of the asset they represent, then traders in long positions pay a funding fee to traders in short positions at specific times of day, which encourages more traders to enter short positions prior to these times. + +If the contract is being traded at a price that is lower than the price of the asset they represent, then traders in short positions pay a funding fee to traders in long positions at specific times of day, which encourages more traders to enter long positions prior to these times. + +These fees are usually exchanged between traders with no commission going to the exchange + +The `fetchFundingHistory` method can be used to retrieve an accounts history of funding fees paid or received + +```javascript +fetchFundingHistory (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **symbol** (String) Unified CCXT market symbol (e.g. `"BTC/USDT:USDT"`) +- **since** (Integer) Timestamp (ms) of the earliest time to retrieve funding history for (e.g. `1646940314000`) +- **limit** (Integer) The number of [funding history structures](#funding-history-structure) to retrieve (e.g. `5`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"endTime": 1645807945000}`) + +Returns + +- An array of [funding history structures](#funding-history-structure) + +#### Funding History Structure + +```javascript +{ + info: { ... }, + symbol: "XRP/USDT:USDT", + code: "USDT", + timestamp: 1646954920000, + datetime: "2022-03-08T16:00:00.000Z", + id: "1520286109858180", + amount: -0.027722 +} +``` + + +### Conversion + +The `fetchConvertQuote` method can be used to retrieve a quote that can be used for a conversion trade. +The quote usually needs to be used within a certain timeframe specified by the exchange for the convert trade to execute successfully. + +```javascript +fetchConvertQuote (fromCode, toCode, amount = undefined, params = {}) +``` + +Parameters + +- **fromCode** (String) *required* The unified currency code for the currency to convert from (e.g. `"USDT"`) +- **toCode** (String) *required* The unified currency code for the currency to be converted into (e.g. `"USDC"`) +- **amount** (Float) Amount to convert in units of the from currency (e.g. `20.0`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"toAmount": 2.9722}`) + +Returns + +- A [conversion structure](#conversion-structure) + +The `createConvertTrade` method can be used to create a conversion trade order using the id retrieved from fetchConvertQuote. +The quote usually needs to be used within a certain timeframe specified by the exchange for the convert trade to execute successfully. + +```javascript +createConvertTrade (id, fromCode, toCode, amount = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Conversion quote id (e.g. `1645807945000`) +- **fromCode** (String) *required* The unified currency code for the currency to convert from (e.g. `"USDT"`) +- **toCode** (String) *required* The unified currency code for the currency to be converted into (e.g. `"USDC"`) +- **amount** (Float) Amount to convert in units of the from currency (e.g. `20.0`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"toAmount": 2.9722}`) + +Returns + +- A [conversion structure](#conversion-structure) + +The `fetchConvertTrade` method can be used to fetch a specific conversion trade using the trades id. + +```javascript +fetchConvertTrade (id, code = undefined, params = {}) +``` + +Parameters + +- **id** (String) *required* Conversion trade id (e.g. `"80794187SDHJ25"`) +- **code** (String) The unified currency code of the conversion trade (e.g. `"USDT"`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"toAmount": 2.9722}`) + +Returns + +- A [conversion structure](#conversion-structure) + +The `fetchConvertTradeHistory` method can be used to fetch the conversion history for a specified currency code. + +```javascript +fetchConvertTradeHistory (code = undefined, since = undefined, limit = undefined, params = {}) +``` + +Parameters + +- **code** (String) The unified currency code to fetch conversion trade history for (e.g. `"USDT"`) +- **since** (Integer) Timestamp of the earliest conversion (e.g. `1645807945000`) +- **limit** (Integer) The maximum number of conversion structures to retrieve (e.g. `10`) +- **params** (Dictionary) Parameters specific to the exchange API endpoint (e.g. `{"toAmount": 2.9722}`) + +Returns + +- An array of [conversion structures](#conversion-structure) + +#### Conversion Structure + +```javascript +{ + info: { ... }, + timestamp: 1646954920000, + datetime: "2022-03-08T16:00:00.000Z", + id: "1520286109858180", + fromCurrency: "USDT", + fromAmount: 3.0, + toCurrency: "USDC", + toAmount: 2.9722, + price: 0.97, + fee: 0.0 +} +``` + + +## Proxy + +In some specific cases you may want a proxy, when: +- Exchange is not available in your location +- Your IP is forbidden by exchange +- You experience random restriction by exchange, like [DDoS protection by Cloudflare](#ddos-protection-by-cloudflare-incapsula) + +However, beware that each added intermediary might add some latency to requests. + +**Note for Go users:** After setting any proxy property, you must call `UpdateProxySettings()` to apply the changes: +```go +exchange := ccxt.NewBinance(nil) +exchange.ProxyUrl = "http://your-proxy-url:8080" +exchange.UpdateProxySettings() // Required in Go to apply proxy settings +``` +However be aware that each added intermediary might add some latency to requests. + +### Supported proxy types +CCXT supports the following proxy types (note, each of them also have [callback support](#using-proxy-callbacks)): + +#### proxyUrl + +This property prepends an url to API requests. It might be useful for simple redirection or [bypassing CORS browser restriction](#cors-access-control-allow-origin). +``` +ex = ccxt.binance(); +ex.proxyUrl = 'YOUR_PROXY_URL'; +``` +while 'YOUR_PROXY_URL' could be like (use the slash accordingly): +- `https://cors-anywhere.herokuapp.com/` +- `http://127.0.0.1:8080/` +- `http://your-website.com/sample-script.php?url=` +- etc + +So requests will be made to i.e. `https://cors-anywhere.herokuapp.com/https://exchange.xyz/api/endpoint`. ( You can also have a small proxy script running on your device/webserver to use it in `.proxyUrl` - "sample-local-proxy-server" in [examples folder](https://github.com/ccxt/ccxt/tree/master/examples)). To customize the target url, you can also override `urlEncoderForProxyUrl` method of instance. + +This approach works **only for REST** requests, but not for websocket connections. ((_How to test if your proxy works_))[#test-if-your-proxy-works] + +#### httpProxy and httpsProxy +To set a real http(s) proxy for your scripts, you need to have an access to a remote [http or https proxy](https://stackoverflow.com/q/10440690/2377343), so calls will be made directly to the target exchange, tunneled through your proxy server: +``` +ex.httpProxy = 'http://1.2.3.4:8080/'; +// or +ex.httpsProxy = 'http://1.2.3.4:8080/'; +``` +This approach only affects **non-websocket** requests of ccxt. To route CCXT's WebSockets connections through proxy, you need to specifically set `wsProxy` (or `wssProxy`) property, in addition to the `httpProxy` (or `httpsProxy`), so your script should be like: +``` +ex.httpProxy = 'http://1.2.3.4:8080/'; +ex.wsProxy = 'http://1.2.3.4:8080/'; +``` +So, both connections (HTTP & WS) would go through proxies. +((_How to test if your proxy works_))[#test-if-your-proxy-works] + + +#### socksProxy +You can also use [socks proxy](https://www.google.com/search?q=what+is+socks+proxy) with the following format: +``` +// from protocols: socks, socks5, socks5h +ex.socksProxy = 'socks5://1.2.3.4:8080/'; +ex.wsSocksProxy = 'socks://1.2.3.4:8080/'; +``` +((_How to test if your proxy works_))[#test-if-your-proxy-works] + +#### Test if your proxy works +After setting any of the above listed proxy properties in your ccxt snippet, you can test whether it works by pinging some IP echoing websites - check a "proxy-usage" file in [examples](https://github.com/ccxt/ccxt/blob/master/examples/). + +#### using proxy callbacks +**Instead of setting a property, you can also use callbacks `proxyUrlCallback, http(s)ProxyCallback, socksProxyCallback`: +``` +myEx.proxyUrlCallback = function (url, method, headers, body) { ... return 'http://1.2.3.4/'; } +``` + +### extra proxy related details + +#### userAgent + +If you need for special cases, you can override `userAgent` property like: +``` +exchange.userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)...' +``` + +#### custom proxy agents + +Depending your programming language, you can set custom proxy agents. + - For JS, see [this example]( +https://github.com/ccxt/ccxt/blob/master/examples/js/custom-proxy-agent-for-js.js) + - For Python, see the following examples: [proxies-for-synchronous-python]( +https://github.com/ccxt/ccxt/blob/master/examples/py/proxies-for-synchronous-python.py), [proxy-asyncio-aiohttp-python-3]( +https://github.com/ccxt/ccxt/blob/master/examples/py/proxy-asyncio-aiohttp-python-3.py), [proxy-asyncio-aiohttp-socks]( +https://github.com/ccxt/ccxt/blob/master/examples/py/proxy-asyncio-aiohttp-socks.py), [proxy-sync-python-requests-2-and-3]( +https://github.com/ccxt/ccxt/blob/master/examples/py/proxy-sync-python-requests-2-and-3.py) + +#### CORS (Access-Control-Allow-Origin) + +CORS (known as [Cross-Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)) affects mostly browsers and is the cause of the well-know warning `No 'Access-Control-Allow-Origin' header is present on the requested resource`. It happens when a script (running in a browser) makes a request to a 3rd party domain (by default such requests are blocked, unless the target domain explicitly allows it). +So, in such cases you will need to communicate with a "CORS" proxy, which would redirect requests (as opposed to direct browser-side request) to the target exchange. To set a CORS proxy, you can run [sample-local-proxy-server-with-cors](https://github.com/ccxt/ccxt/blob/master/examples/) example file and in ccxt set the [`.proxyUrl`](#proxyUrl) property to route requests through cors/proxy server. + +## String Math + +Some users might want to control how CCXT handles arithmetic operations. Even though it uses numeric types by default, users can switch to fixed-point math using string types. This can be done by: + + +#### **Javascript** +```javascript +const ex = new ccxt.coinbase (); +ex.number = String ; // String | Number +``` +#### **Python** +```python +ex = ccxt.coinbase() +ex.number = str # str | float +``` +#### **PHP** +```php +$ex = new ccxt\\coinbase(); +$ex->number = 'strval'; // 'strval' | 'floatval' +``` +#### **C#** +```csharp +var ex = new ccxt.coinbase(); +ex.number = typeof(String); // typeof(String) | typeof(float) +``` + + + + +# Error Handling + +- [Retry Mechanism](#retry-mechanism) +- [Exception Hierarchy](#exception-hierarchy) +- [ExchangeError](#exchangeerror) +- [OperationFailed](#operationfailed) +- [DDoSProtection](#ddosprotection) +- [RateLimitExceeded](#ratelimitexceeded) +- [RequestTimeout](#requesttimeout) +- [RequestTimeout](#requesttimeout) +- [ExchangeNotAvailable](#exchangenotavailable) +- [InvalidNonce](#invalidnonce) + +The error handling with CCXT is done with the exception mechanism that is natively available with all languages. + +To handle the errors you should add a `try` block around the call to a unified method and catch the exceptions like you would normally do with your language: + +#### **Javascript** +```javascript +// try to call a unified method +try { + const response = await exchange.fetchTicker ('ETH/BTC') + console.log (response) +} catch (e) { + // if the exception is thrown, it is "caught" and can be handled here + // the handling reaction depends on the type of the exception + // and on the purpose or business logic of your application + if (e instanceof ccxt.NetworkError) { + console.log (exchange.id, 'fetchTicker failed due to a network error:', e.message) + // retry or whatever + } else if (e instanceof ccxt.ExchangeError) { + console.log (exchange.id, 'fetchTicker failed due to exchange error:', e.message) + // retry or whatever + } else { + console.log (exchange.id, 'fetchTicker failed with:', e.message) + // retry or whatever + } +} +``` +#### **Python** +```python +# try to call a unified method +try: + response = await exchange.fetch_order_book('ETH/BTC') + print(response) +except ccxt.NetworkError as e: + print(exchange.id, 'fetch_order_book failed due to a network error:', str(e)) + # retry or whatever +except ccxt.ExchangeError as e: + print(exchange.id, 'fetch_order_book failed due to exchange error:', str(e)) + # retry or whatever +except Exception as e: + print(exchange.id, 'fetch_order_book failed with:', str(e)) + # retry or whatever +``` +#### **PHP** +```php +// try to call a unified method +try { + $response = $exchange->fetch_trades('ETH/BTC'); + print_r($response); +} catch (\ccxt\NetworkError $e) { + echo $exchange->id . ' fetch_trades failed due to a network error: ' . $e->getMessage () . "\n"; + // retry or whatever +} catch (\ccxt\ExchangeError $e) { + echo $exchange->id . ' fetch_trades failed due to exchange error: ' . $e->getMessage () . "\n"; + // retry or whatever +} catch (Exception $e) { + echo $exchange->id . ' fetch_trades failed with: ' . $e->getMessage () . "\n"; + // retry or whatever +} +``` + + +## Retry Mechanism +When dealing with HTTP requests, it's important to understand that requests might fail for various reasons. Common causes of these failures include the server being unavailable, network instability, or temporary server issues. To handle such scenarios gracefully, CCXT provide an option to automatically retry failed requests. You can set the value of `maxRetriesOnFailure` and `maxRetriesOnFailureDelay` to configure the number of retries and the delay between retries, example: + +```Python +exchange.options['maxRetriesOnFailure'] = 3 # if we get an error like the ones mentioned above we will retry up to three times per request +exchange.options['maxRetriesOnFailureDelay'] = 1000 # we will wait 1000ms (1s) between retries +``` + +It's important to highlight that only server/network-related issues will be part of the retry mechanism; if the user gets an error due to `InsufficientFunds` or `InvalidOrder,` the request will not be repeated. + +## Exception Hierarchy + +All exceptions are derived from the base BaseError exception, which, in its turn, is defined in the ccxt library like so: + + +#### **Javascript** +```javascript +class BaseError extends Error { + constructor () { + super () + // a workaround to make `instanceof BaseError` work in ES5 + this.constructor = BaseError + this.__proto__ = BaseError.prototype + } +} +``` +#### **Python** +```python +class BaseError (Exception): + pass +``` +#### **PHP** +```php +class BaseError extends \Exception {} +``` + + +The exception inheritance hierarchy lives in this file: https://github.com/ccxt/ccxt/blob/master/ts/src/base/errorHierarchy.ts , and visually can be outlined like shown below: + +```text ++ BaseError +| ++---+ ExchangeError +| | +| +---+ OperationRejected +| | +| +---+ BadRequest +| | | +| | +---+ BadSymbol +| | +| +---+ AuthenticationError +| | | +| | +---+ PermissionDenied +| | | +| | +---+ AccountSuspended +| | +| +---+ ArgumentsRequired +| | +| +---+ BadResponse +| | | +| | +---+ NullResponse +| | +| +---+ InsufficientFunds +| | +| +---+ InvalidAddress +| | | +| | +---+ AddressPending +| | +| +---+ InvalidOrder +| | | +| | +---+ OrderNotFound +| | | +| | +---+ OrderNotCached +| | | +| | +---+ CancelPending +| | | +| | +---+ OrderImmediatelyFillable +| | | +| | +---+ OrderNotFillable +| | | +| | +---+ DuplicateOrderId +| | +| +---+ NotSupported +| +| ++---+ OperationFailed (recoverable) + | + +---+ NetworkError (recoverable) + | + +---+ InvalidNonce + | + +---+ RequestTimeout + | + +---+ ExchangeNotAvailable + | | + | +---+ OnMaintenance + | + +---+ RateLimitExceeded + | + +---+ DDoSProtection +``` + +The `BaseError` class is a generic root error class for all sorts of errors, including accessibility and request/response mismatch. If you don't need to catch any specific subclass of exceptions, you can just use `BaseError`, where all exception types are being caught. + +From `BaseError` derives two different families of errors: `OperationFailed` and `ExchangeError` (they also have their specific sub-types, as explained below). + +### OperationFailed + + +An `OperationFailed` might happen when user sends **correctly constructed & valid request** to exchange, but a non-deterministic problem occurred: +- maintenance ongoing +- internet/network connectivitiy issues +- DDoS protections +- "Server busy, try again"... + +Such exceptions are temporary and re-trying the request again might be enough. However, if the error still happens, then it may indicate some persistent problem with the exchange or with your connection. + +`OperationFailed` has the following sub-types: `RequestTimeout`,`DDoSProtection` (includes sub-type `RateLimitExceeded`), `ExchangeNotAvailable`, `InvalidNonce`. + + +#### DDoSProtection + +This exception is thrown in cases when cloud/hosting services (Cloudflare, Incapsula or etc..) limits requests from user/region/location or when the exchange API restricts user because of making abnormal requests. This exception also contains specific sub-type exception `RateLimitExceeded`, which directly means that user makes much frequent requests than tolerated by exchange API engine. + +#### RequestTimeout + +This exception is raised when the connection with the exchange fails or data is not fully received in a specified amount of time. This is controlled by the exchange's `.timeout` property. When a `RequestTimeout` is raised, the user doesn't know the outcome of a request (whether it was accepted by the exchange server or not). + +Thus it's advised to handle this type of exception in the following manner: + +- for fetching requests it is safe to retry the call +- for a request to `cancelOrder()` a user is required to retry the same call the second time. A subsequent retry to `cancelOrder()` will return one of the following possible results: + - a request is completed successfully, meaning the order has been properly canceled now + - an `OrderNotFound` exception is raised, which means the order was either already canceled on the first attempt or has been executed (filled and closed) in the meantime between the two attempts. +- if a request to `createOrder()` fails with a `RequestTimeout` the user should: + - call `fetchOrders()`, `fetchOpenOrders()`, `fetchClosedOrders()` to check if the request to place the order has succeeded and the order is now open + - if the order is not `'open'` the user should `fetchBalance()` to check if the balance has changed since the order was created on the first run and then was filled and closed by the time of the second check. + +#### ExchangeNotAvailable + +This type of exception is thrown when the underlying exchange is unreachable. The ccxt library also throws this error if it detects any of the following keywords in response: + + - `offline` + - `unavailable` + - `busy` + - `retry` + - `wait` + - `maintain` + - `maintenance` + - `maintenancing` + +#### InvalidNonce + +Raised when your nonce is less than the previous nonce used with your keypair, as described in the [Authentication](#authentication) section. This type of exception is thrown in these cases (in order of precedence for checking): + + - You are not rate-limiting your requests or sending too many of them too often. + - Your API keys are not fresh and new (have been used with some different software or script already, just always create a new keypair when you add this or that exchange). + - The same keypair is shared across multiple instances of the exchange class (for example, in a multithreaded environment or in separate processes). + - Your system clock is out of synch. System time should be synched with UTC in a non-DST timezone at a rate of once every ten minutes or even more frequently because of the clock drifting. **Enabling time synch in Windows is usually not enough!** You have to set it up with the OS Registry (Google *"time synch frequency"* for your OS). + + +### ExchangeError + +In contrast to `OperationFailed`, the `ExchangeError` is mostly happening when the request is impossible to succeed (because of factors listed below), so even if you retry the same request hundreds of times, they will still fail, because the request is being made incorrectly. + +Possible reasons for this exception: + + - endpoint is switched off by the exchange + - symbol not found on the exchange + - required parameter is missing + - the format of parameters is incorrect + - some problem happening on user-side that needs to be fixed + +`ExchangeError` has the following sub-type exceptions: + + - `NotSupported`: when the endpoint/operation is not offered or supported by the exchange API. + - `BadRequest`: user sends an **incorrectly** constructed request/parameter/action that is invalid/unallowed (i.e.: "invalid number", "forbidden symbol", "size beyond min/max limits", "incorrect precision", etc). Retrying would not help in this case, the request needs to be fixed/adjusted first. + - `OperationRejected` - user sends a **correctly** constructed request (that should be accepted by the exchange in a typical case), but some deterministic factor prevents your request to succeed. For example, your current account status might not allow it (i.e. "please close existing positions before changing the leverage", "too many pending orders", "your account in wrong position/margin mode") or at the give moment symbol is not tradable (i.e. "MarketClosed") or some explained factors, where you need to take a specific action (i.e. change some setting at first, or wait till specific moment). So, once again: [**OperationFailed**](#operationfailed) can be blindly re-tried and should success, while `OperationRejected` is a failure that depends on specific exact factors that need to be considered, before request can be retried. + - `AuthenticationError`: when an exchange requires one of the API credentials that you've missed to specify, or when there's a mistake in the keypair or an outdated nonce. Most of the time you need `apiKey` and `secret`, sometimes you also need `uid` and/or `password` if exchange API requires it. + - `PermissionDenied`: when there's no access for specified action or insufficient permissions on the specified `apiKey`. + - `InsufficientFunds`: when you don't have enough currency on your account balance to place an order. + - `InvalidAddress`: when encountering a bad funding address or a funding address shorter than `.minFundingAddressLength` (10 characters by default) in a call to `fetchDepositAddress`, `createDepositAddress` or `withdraw`. + - `InvalidOrder`: the base class for all exceptions related to the unified order API. + - `OrderNotFound`: when you are trying to fetch or cancel a non-existent order. + +# Troubleshooting + +In case you experience any difficulty connecting to a particular exchange, do the following in order of precedence: + +- Make sure that you have the most recent version of ccxt. + Never trust your package installer (whether it is `npm`, `pip` or `composer`), instead always check your **actual (real) runtime version number** by running this code in your environment: + ```javascript + console.log (ccxt.version) // JavaScript + ``` + ```python + print('CCXT version:', ccxt.__version__) # Python + ``` + ```php + echo "CCXT v." . \ccxt\Exchange::VERSION . "\n"; // PHP + ``` +- Check the [Issues](https://github.com/ccxt/ccxt/issues) or [Announcements](#announcements) for recent updates. +- Make sure you have not turned off [rate-limiter with `enableRateLimit: false`](#rate-limit) (If anyone has custom rate-limit solution built, ensure it does not misbehave). +- If you use ccxt's proxy functionality, ensure it does not misbehave. +- Turn `verbose = true` to get more detail about it! + ``` + exchange = ccxt.binance() + exchange.load_markets() + exchange.verbose = True # for less noise, you can set that after `load_markets`, but if the error happens during `load_markets` then place this line before it + # ... your codes here ... + ``` + Your [code to reproduce the issue + verbose output is required](https://github.com/ccxt/ccxt/wiki/FAQ#what-is-required-to-get-help) in order to get help. +- Python people can turn on DEBUG logging level with a standard pythonic logger, by adding these two lines to the beginning of their code: + ```python + import logging + logging.basicConfig(level=logging.DEBUG) + ``` +- Use verbose mode to make sure that the used API credentials correspond to the keys you intend to use. Make sure there's no confusion of keypairs. +- **Try a fresh new keypair if possible.** +- Read the answers to Frequently Asked Questions: https://github.com/ccxt/ccxt/wiki/FAQ +- Check the permissions on the keypair with the exchange website! +- Check your nonce. If you used your API keys with other software, you most likely should [override your nonce function](#overriding-the-nonce) to match your previous nonce value. A nonce usually can be easily reset by generating a new unused keypair. If you are getting nonce errors with an existing key, try with a new API key that hasn't been used yet. +- Check your request rate if you are getting nonce errors. Your private requests should not follow one another quickly. You should not send them one after another in a split second or in short time. The exchange will most likely ban you if you don't make a delay before sending each new request. In other words, you should not hit their rate limit by sending unlimited private requests too frequently. Add a delay to your subsequent requests or enable the built-in rate-limiter, like shown in the long-poller [examples](https://github.com/ccxt/ccxt/tree/master/examples), also [here](#order-book--market-depth). +- Read the [docs for your exchange](https://github.com/ccxt/ccxt/wiki/Exchanges) and compare your verbose output to the docs. +- Check your connectivity with the exchange by accessing it with your browser. +- Check your connection with the exchange through a [proxy](#proxy). +- Try accesing the exchange from a different computer or a remote server, to see if this is a local or global issue with the exchange. +- Check if there were any news from the exchange recently regarding downtime for maintenance. Some exchanges go offline for updates regularly (like once a week). +- Make sure that your system time in sync with the rest of the world's clocks since otherwise you may get invalid nonce errors. + +**Further Notes:** + +- Use the `verbose = true` option or instantiate your troublesome exchange with `new ccxt.exchange ({ 'verbose': true })` to see the HTTP requests and responses in details. The verbose output will also be of use for us to debug it if you submit an issue on GitHub. +- Use DEBUG logging in Python! +- Some exchanges are not available in certain countries, using a [proxy](#proxy) might be the solution in such cases. +- If you are getting authentication errors or *'invalid keys'* errors, those are most likely due to a nonce issue. +- Some exchanges do not state it clearly if they fail to authenticate your request. In those circumstances they might respond with an exotic error code, like HTTP 502 Bad Gateway Error or something that's even less related to the actual cause of the error. + diff --git a/docs/ccxt/wiki/README.md b/docs/ccxt/wiki/README.md new file mode 100644 index 0000000..1e12bf5 --- /dev/null +++ b/docs/ccxt/wiki/README.md @@ -0,0 +1,97 @@ +Welcome to the ccxt wiki! + +> We recommend to visit our full documentation at https://docs.ccxt.com + +## General Information + +- [Supported Exchanges](https://github.com/ccxt/ccxt/wiki/Exchange-Markets) +- [Exchanges By Country](https://github.com/ccxt/ccxt/wiki/Exchange-Markets-By-Country) + +## How To Install + +- [Install](https://github.com/ccxt/ccxt/wiki/Install) + - [Node.js](https://github.com/ccxt/ccxt/wiki/Install#nodejs) + - [Python](https://github.com/ccxt/ccxt/wiki/Install#python) + - [PHP](https://github.com/ccxt/ccxt/wiki/Install#php) + - [Web Browsers](https://github.com/ccxt/ccxt/wiki/Install#web-browsers) + - [Docker](https://github.com/ccxt/ccxt/wiki/Install#docker) + - [Proxy](https://github.com/ccxt/ccxt/wiki/Install#proxy) + - [CORS (Access-Control-Allow-Origin)](https://github.com/ccxt/ccxt/wiki/Install#cors-access-control-allow-origin) + +## How To Use + +- [User Manual](https://github.com/ccxt/ccxt/wiki/Manual) + - [Architecture Overview](https://github.com/ccxt/ccxt/wiki/Manual#overview) + - [Instantiation](https://github.com/ccxt/ccxt/wiki/Manual#instantiation) + - [Exchange Structure](https://github.com/ccxt/ccxt/wiki/Manual#exchange-structure) + - [Exchange Properties](https://github.com/ccxt/ccxt/wiki/Manual#exchange-properties) + - [Rate Limit](https://github.com/ccxt/ccxt/wiki/Manual#rate-limit) + - [Markets](https://github.com/ccxt/ccxt/wiki/Manual#markets) + - [Symbols And Market Ids](https://github.com/ccxt-dev/ccxt/wiki/Manual#symbols-and-market-ids) + - [API Methods / Endpoints](https://github.com/ccxt/ccxt/wiki/Manual#api-methods--endpoints) + - [Implicit API Methods](https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods) + - [Public/Private API](https://github.com/ccxt/ccxt/wiki/Manual#publicprivate-api) + - [Synchronous vs Asynchronous Calls](https://github.com/ccxt/ccxt/wiki/Manual#synchronous-vs-asynchronous-calls) + - [Unified API](https://github.com/ccxt/ccxt/wiki/Manual#unified-api) + - [Overriding Params](https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params) + - [Pagination](https://github.com/ccxt/ccxt/wiki/Manual#pagination) + - [Automatic Pagination](https://github.com/ccxt/ccxt/wiki/Manual#automatic-pagination) + - [Public API](https://github.com/ccxt/ccxt/wiki/Manual#public-api) + - [Order Book](https://github.com/ccxt/ccxt/wiki/Manual#order-book) + - [Market Depth](https://github.com/ccxt/ccxt/wiki/Manual#market-depth) + - [Price Tickers](https://github.com/ccxt/ccxt/wiki/Manual#price-tickers) + - [OHLCV Candlestick Charts](https://github.com/ccxt/ccxt/wiki/Manual#ohlcv-candlestick-charts) + - [Public Trades](https://github.com/ccxt/ccxt/wiki/Manual#trades-executions-transactions) + - [Private API](https://github.com/ccxt/ccxt/wiki/Manual#private-api) + - [Authentication](https://github.com/ccxt/ccxt/wiki/Manual#authentication) + - [API Keys Setup](https://github.com/ccxt/ccxt/wiki/Manual#api-keys-setup) + - [Querying Account Balance](https://github.com/ccxt/ccxt/wiki/Manual#account-balance) + - [Orders](https://github.com/ccxt/ccxt/wiki/Manual#orders) + - [Querying Orders](https://github.com/ccxt/ccxt/wiki/Manual#querying-orders) + - [By Order Id](https://github.com/ccxt-dev/ccxt/wiki/Manual#by-order-id) + - [All Orders](https://github.com/ccxt-dev/ccxt/wiki/Manual#all-orders) + - [Open Orders](https://github.com/ccxt-dev/ccxt/wiki/Manual#open-orders) + - [Closed Orders](https://github.com/ccxt-dev/ccxt/wiki/Manual#closed-orders) + - [Order Structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + - [Placing Orders](https://github.com/ccxt/ccxt/wiki/Manual#placing-orders) + - [Market Orders](https://github.com/ccxt/ccxt/wiki/Manual#market-orders) + - [Limit Orders](https://github.com/ccxt/ccxt/wiki/Manual#limit-orders) + - [Custom Params](https://github.com/ccxt/ccxt/wiki/Manual#custom-order-params) + - [Canceling Orders](https://github.com/ccxt/ccxt/wiki/Manual#canceling-orders) + - [Personal Trades](https://github.com/ccxt-dev/ccxt/wiki/Manual#personal-trades) + - [Funding Your Account](https://github.com/ccxt/ccxt/wiki/Manual#ledger) + - [Deposit](https://github.com/ccxt/ccxt/wiki/Manual#deposit) + - [Withdraw](https://github.com/ccxt/ccxt/wiki/Manual#withdraw) + - [Transactions](https://github.com/ccxt/ccxt/wiki/Manual#transactions) + - [Deposit](https://github.com/ccxt/ccxt/wiki/Manual#deposit) + - [Withdrawal](https://github.com/ccxt/ccxt/wiki/Manual#withdrawal) + - [All Transactions](https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure) + - [Fees](https://github.com/ccxt/ccxt/wiki/Manual#fees) + - [Trading Fees](https://github.com/ccxt/ccxt/wiki/Manual#trading-fees) + - [Transaction Fees](https://github.com/ccxt/ccxt/wiki/Manual#transaction-fees) + +## WebSocket Support + +- [CCXT Pro](https://github.com/ccxt/ccxt/wiki/ccxt.pro) + +## Troubleshooting + +- [Frequently Asked Questions](https://github.com/ccxt/ccxt/wiki/FAQ) +- [Overriding The Nonce](https://github.com/ccxt/ccxt/wiki/Manual#overriding-the-nonce) +- [Error Handling](https://github.com/ccxt/ccxt/wiki/Manual#error-handling) +- [Troubleshooting](https://github.com/ccxt/ccxt/wiki/Manual#troubleshooting) +- [How To Submit An Issue](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue) +- [CCXT CLI: Command-Line Interface](https://github.com/ccxt/ccxt/wiki/CLI) + +## Examples + +- [Usage Examples](https://docs.ccxt.com/#/Examples) + +## New Exchanges + +- [Certification](https://github.com/ccxt/ccxt/wiki/Certification) +- [Requirements](https://github.com/ccxt/ccxt/wiki/Requirements) + +## API Reference + +- [API Reference](https://docs.ccxt.com/#/spec) diff --git a/docs/ccxt/wiki/Requirements.md b/docs/ccxt/wiki/Requirements.md new file mode 100644 index 0000000..bd28c9a --- /dev/null +++ b/docs/ccxt/wiki/Requirements.md @@ -0,0 +1,47 @@ +# CCXT Integration Requirements + +The exchange is required to implement the following list of methods and structures in order to get integrated with CCXT. + +## Public API + +#### Exchange Information, Fee Schedule and Trading Rules + +- [`fetchMarkets`](https://github.com/ccxt/ccxt/wiki/Manual#loading-markets) – a list of trading pairs and their statuses + [market structure](https://github.com/ccxt/ccxt/wiki/Manual#market-structure) +- [`fetchCurrencies`](https://github.com/ccxt/ccxt/wiki/Manual#loading-markets) – a list of tokens or assets and their statuses + [currency structure](https://github.com/ccxt/ccxt/wiki/Manual#currency-structure) +- `fetchTradingLimits` – min/max order volume, price, cost, precision, etc... +- `fetchTradingFees` – trading fees, either public or personal +- `fetchFundingLimits` – a list of withdrawal limits + +#### Market Data + +- [`fetchTicker`](https://github.com/ccxt/ccxt/wiki/Manual#price-tickers) – 24h volumes and stats + [ticker structure](https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure) +- [`fetchOrderBook`](https://github.com/ccxt/ccxt/wiki/Manual#order-book) – L2/L3 + [orderbook structure](https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure) +- [`fetchTrades`](https://github.com/ccxt/ccxt/wiki/Manual#trades-executions-transactions) – a list of recent public trades + [trade structure](https://github.com/ccxt/ccxt/wiki/Manual#trade-structure) +- [`fetchOHLCV`](https://github.com/ccxt/ccxt/wiki/Manual#ohlcv-candlestick-charts) – a list of candles or kline data for traded volumes in different timeframes 1m, 15m, 1h, 1d, ... + [OHLCV structure](https://github.com/ccxt/ccxt/wiki/Manual#ohlcv-structure) + +## Private API + +#### Trading + +- [`fetchBalance`](https://github.com/ccxt/ccxt/wiki/Manual#querying-account-balance) – for all types of accounts + [balance structure](https://github.com/ccxt/ccxt/wiki/Manual#balance-structure) +- `fetchAccounts` – required if the exchange has multiple accounts or sub-accounts +- [`createOrder`](https://github.com/ccxt/ccxt/wiki/Manual#placing-orders) – *limit/market* orders + [order structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) +- [`cancelOrder`](https://github.com/ccxt/ccxt/wiki/Manual#canceling-orders) +- `editOrder` – change the price and/or amount of an open order + +#### Trading History + +- [`fetchOrder`](https://github.com/ccxt/ccxt/wiki/Manual#querying-orders) – one order by order id + [order structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) +- [`fetchOpenOrders`](https://github.com/ccxt/ccxt/wiki/Manual#querying-orders) – a list of all open orders +- [`fetchOrders`](https://github.com/ccxt/ccxt/wiki/Manual#querying-orders) – a list of all orders +- [`fetchMyTrades`](https://github.com/ccxt/ccxt/wiki/Manual#personal-trades) – the personal history of filled trades for the account + [trade structure](https://github.com/ccxt/ccxt/wiki/Manual#trade-structure) + +#### Funding + +- [`fetchDepositAddress`](https://github.com/ccxt/ccxt/wiki/Manual#funding-your-account) – deposit address(es) + [address structure](https://github.com/ccxt/ccxt/wiki/Manual#address-structure) +- [`fetchDeposits`](https://github.com/ccxt/ccxt/wiki/Manual#transactions) +- [`fetchWithdrawals`](https://github.com/ccxt/ccxt/wiki/Manual#transactions) +- [`fetchTransactions`](https://github.com/ccxt/ccxt/wiki/Manual#transactions) + [transaction structure](https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure) +- [`fetchLedger`](https://github.com/ccxt/ccxt/wiki/Manual#ledger) – transactions, transfers, referrals, cashbacks + [ledger entry structure](https://github.com/ccxt/ccxt/wiki/Manual#ledger-entry-structure) +- [`withdraw`](https://github.com/ccxt/ccxt/wiki/Manual#withdraw) +- `transfer` – required if exchange has multiple accounts or sub-accounts diff --git a/docs/ccxt/wiki/Stats.md b/docs/ccxt/wiki/Stats.md new file mode 100644 index 0000000..ab23bee --- /dev/null +++ b/docs/ccxt/wiki/Stats.md @@ -0,0 +1,62 @@ +# CCXT Statistics + +## JavaScript / npm + +![npm Weekly Downloads](https://img.shields.io/npm/dw/ccxt.svg) +![npm Monthly Downloads](https://img.shields.io/npm/dm/ccxt.svg) +![npm Yearly Downloads](https://img.shields.io/npm/dy/ccxt.svg) + + + + + +## Python / PyPI + +![PyPI Daily Downloads](https://img.shields.io/pypi/dd/ccxt.svg) +![PyPI Weekly Downloads](https://img.shields.io/pypi/dw/ccxt.svg) +![PyPI Monthly Downloads](https://img.shields.io/pypi/dm/ccxt.svg) + + + +## PHP / Packagist + +![Packagist Daily Downloads](https://img.shields.io/packagist/dd/ccxt/ccxt.svg) +![Packagist Monthly Downloads](https://img.shields.io/packagist/dm/ccxt/ccxt.svg) +![Packagist Total Downloads](https://img.shields.io/packagist/dt/ccxt/ccxt.svg) + +## GitHub + +![GitHub forks](https://img.shields.io/github/forks/ccxt/ccxt.svg?style=social) +![GitHub stars](https://img.shields.io/github/stars/ccxt/ccxt.svg?style=social) +![GitHub watchers](https://img.shields.io/github/watchers/ccxt/ccxt.svg?style=social) + +![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/ccxt/ccxt.svg) +![GitHub repo size in bytes](https://img.shields.io/github/repo-size/ccxt/ccxt.svg) + + + +![GitHub language count](https://img.shields.io/github/languages/count/ccxt/ccxt.svg) +![GitHub contributors](https://img.shields.io/github/contributors/ccxt/ccxt.svg) + + + +## Opencollective + +![open collective backers and sponsors](https://img.shields.io/opencollective/all/ccxt.svg) +![open collective backers](https://img.shields.io/opencollective/backers/ccxt.svg) +![open collective backers by tier](https://img.shields.io/opencollective/tier/ccxt/3023.svg) +![open collective supporters by tier](https://img.shields.io/opencollective/tier/ccxt/3024.svg) +![open collective sponsors by tier](https://img.shields.io/opencollective/tier/ccxt/3040.svg) diff --git a/docs/ccxt/wiki/_coverpage.md b/docs/ccxt/wiki/_coverpage.md new file mode 100644 index 0000000..ede6784 --- /dev/null +++ b/docs/ccxt/wiki/_coverpage.md @@ -0,0 +1,14 @@ +![logo](https://user-images.githubusercontent.com/1294454/112665445-2008ec80-8e6c-11eb-9647-623a347ddade.png) + +# CCXT + +> CryptoCurrency eXchange Trading Library. + +- support for many cryptocurrency exchanges +- fully implemented public and private APIs +- optional normalized data for cross-exchange analytics and arbitrage +- an out of the box unified API that is extremely easy to integrate +- works in Node 15+, Python 3, PHP 8.1+, and web browsers + +[GitHub](https://github.com/ccxt/ccxt/) +[Get Started](#Overview) diff --git a/docs/ccxt/wiki/_sidebar.md b/docs/ccxt/wiki/_sidebar.md new file mode 100644 index 0000000..95e444b --- /dev/null +++ b/docs/ccxt/wiki/_sidebar.md @@ -0,0 +1,109 @@ + +- [Install](Install.md) +- [Examples](Examples.md) +- [Manual](Manual.md) +- [CCXT Pro](ccxt.pro.manual.md) +- [Contributing](CONTRIBUTING.md) +- [Supported Exchanges](Exchange-Markets.md) +- [Exchanges By Country](Exchange-Markets-By-Country.md) +- [API Spec By Method](baseSpec.md) +- [FAQ](FAQ.md) +- [Changelog](CHANGELOG.md) +- [Awesome](Awesome.md) +- API Spec by Exchange + - [alpaca](exchanges/alpaca.md) + - [apex](exchanges/apex.md) + - [ascendex](exchanges/ascendex.md) + - [backpack](exchanges/backpack.md) + - [bigone](exchanges/bigone.md) + - [binance](exchanges/binance.md) + - [bingx](exchanges/bingx.md) + - [bit2c](exchanges/bit2c.md) + - [bitbank](exchanges/bitbank.md) + - [bitbns](exchanges/bitbns.md) + - [bitfinex](exchanges/bitfinex.md) + - [bitflyer](exchanges/bitflyer.md) + - [bitget](exchanges/bitget.md) + - [bithumb](exchanges/bithumb.md) + - [bitmart](exchanges/bitmart.md) + - [bitmex](exchanges/bitmex.md) + - [bitopro](exchanges/bitopro.md) + - [bitrue](exchanges/bitrue.md) + - [bitso](exchanges/bitso.md) + - [bitstamp](exchanges/bitstamp.md) + - [bitteam](exchanges/bitteam.md) + - [bittrade](exchanges/bittrade.md) + - [bitvavo](exchanges/bitvavo.md) + - [blockchaincom](exchanges/blockchaincom.md) + - [blofin](exchanges/blofin.md) + - [btcalpha](exchanges/btcalpha.md) + - [btcbox](exchanges/btcbox.md) + - [btcmarkets](exchanges/btcmarkets.md) + - [btcturk](exchanges/btcturk.md) + - [bybit](exchanges/bybit.md) + - [cex](exchanges/cex.md) + - [coinbase](exchanges/coinbase.md) + - [coinbaseexchange](exchanges/coinbaseexchange.md) + - [coinbaseinternational](exchanges/coinbaseinternational.md) + - [coincatch](exchanges/coincatch.md) + - [coincheck](exchanges/coincheck.md) + - [coinex](exchanges/coinex.md) + - [coinmate](exchanges/coinmate.md) + - [coinmetro](exchanges/coinmetro.md) + - [coinone](exchanges/coinone.md) + - [coinsph](exchanges/coinsph.md) + - [coinspot](exchanges/coinspot.md) + - [cryptocom](exchanges/cryptocom.md) + - [cryptomus](exchanges/cryptomus.md) + - [defx](exchanges/defx.md) + - [delta](exchanges/delta.md) + - [deribit](exchanges/deribit.md) + - [derive](exchanges/derive.md) + - [digifinex](exchanges/digifinex.md) + - [exmo](exchanges/exmo.md) + - [foxbit](exchanges/foxbit.md) + - [gate](exchanges/gate.md) + - [gemini](exchanges/gemini.md) + - [hashkey](exchanges/hashkey.md) + - [hibachi](exchanges/hibachi.md) + - [hitbtc](exchanges/hitbtc.md) + - [hollaex](exchanges/hollaex.md) + - [htx](exchanges/htx.md) + - [hyperliquid](exchanges/hyperliquid.md) + - [independentreserve](exchanges/independentreserve.md) + - [indodax](exchanges/indodax.md) + - [kraken()](exchanges/kraken().md) + - [krakenfutures](exchanges/krakenfutures.md) + - [kucoin](exchanges/kucoin.md) + - [kucoinfutures](exchanges/kucoinfutures.md) + - [latoken](exchanges/latoken.md) + - [lbank](exchanges/lbank.md) + - [luno](exchanges/luno.md) + - [mercado](exchanges/mercado.md) + - [mexc](exchanges/mexc.md) + - [modetrade](exchanges/modetrade.md) + - [ndax](exchanges/ndax.md) + - [novadax](exchanges/novadax.md) + - [oceanex](exchanges/oceanex.md) + - [okcoin](exchanges/okcoin.md) + - [okx](exchanges/okx.md) + - [onetrading](exchanges/onetrading.md) + - [oxfun](exchanges/oxfun.md) + - [p2b](exchanges/p2b.md) + - [paradex()](exchanges/paradex().md) + - [paymium](exchanges/paymium.md) + - [phemex](exchanges/phemex.md) + - [poloniex](exchanges/poloniex.md) + - [probit](exchanges/probit.md) + - [timex](exchanges/timex.md) + - [tokocrypto](exchanges/tokocrypto.md) + - [toobit](exchanges/toobit.md) + - [upbit](exchanges/upbit.md) + - [wavesexchange](exchanges/wavesexchange.md) + - [whitebit](exchanges/whitebit.md) + - [woo](exchanges/woo.md) + - [woofipro](exchanges/woofipro.md) + - [xt](exchanges/xt.md) + - [yobit](exchanges/yobit.md) + - [zaif](exchanges/zaif.md) + - [zonda](exchanges/zonda.md) diff --git a/docs/ccxt/wiki/basePartials/body.hbs b/docs/ccxt/wiki/basePartials/body.hbs new file mode 100644 index 0000000..fa0c6dd --- /dev/null +++ b/docs/ccxt/wiki/basePartials/body.hbs @@ -0,0 +1,29 @@ +{{>deprecated~}} +{{>description~}} +{{>scope~}} +{{>summary~}} +{{>augments~}} +{{>implements~}} +{{>mixes~}} +{{>default~}} +{{>chainable~}} +{{>overrides~}} +{{>returns~}} +{{>category~}} +{{>throws~}} +{{>fires~}} +{{>this~}} +{{>access~}} +{{>readOnly~}} +{{>requires~}} +{{>customTags~}} +{{>see~}} +{{>since~}} +{{>version~}} +{{>authors~}} +{{>license~}} +{{>copyright~}} +{{>todo~}} +{{>params~}} +{{>properties~}} +{{>examples~}} diff --git a/docs/ccxt/wiki/basePartials/deprecated.hbs b/docs/ccxt/wiki/basePartials/deprecated.hbs new file mode 100644 index 0000000..8deb529 --- /dev/null +++ b/docs/ccxt/wiki/basePartials/deprecated.hbs @@ -0,0 +1,3 @@ +{{#if deprecated}}`DEPRECATED` + +{{/if~}} diff --git a/docs/ccxt/wiki/basePartials/docs.hbs b/docs/ccxt/wiki/basePartials/docs.hbs new file mode 100644 index 0000000..652e822 --- /dev/null +++ b/docs/ccxt/wiki/basePartials/docs.hbs @@ -0,0 +1,4 @@ +{{>header~}} +{{>body}} +##### Supported exchanges +{{>member-index-list~}} diff --git a/docs/ccxt/wiki/basePartials/header.hbs b/docs/ccxt/wiki/basePartials/header.hbs new file mode 100644 index 0000000..6283947 --- /dev/null +++ b/docs/ccxt/wiki/basePartials/header.hbs @@ -0,0 +1,9 @@ + + + +{{#if exchange}} +{{>heading-indent}}[{{exchange}}](#{{getFragment this}}) +{{else}} +{{>heading-indent}}{{name}} +{{/if~}} + diff --git a/docs/ccxt/wiki/basePartials/member-index-list.hbs b/docs/ccxt/wiki/basePartials/member-index-list.hbs new file mode 100644 index 0000000..d73d99f --- /dev/null +++ b/docs/ccxt/wiki/basePartials/member-index-list.hbs @@ -0,0 +1,6 @@ +{{#if (isFunction this)}} +* [{{exchange}}](/exchanges/{{exchange}}.md#{{getFragment this}}) +{{/if}} +{{#indexChildren ~}} +{{>member-index-list~}} +{{/indexChildren}} diff --git a/docs/ccxt/wiki/basePartials/members.hbs b/docs/ccxt/wiki/basePartials/members.hbs new file mode 100644 index 0000000..c18d9f7 --- /dev/null +++ b/docs/ccxt/wiki/basePartials/members.hbs @@ -0,0 +1,9 @@ +{{#children inherited=undefined ~}} +{{>header~}} +{{>body}} + +```javascript +{{exchange}}.{{name}} ({{methodSig this}}) +``` + +{{/children~}} diff --git a/docs/ccxt/wiki/basePartials/params-table.hbs b/docs/ccxt/wiki/basePartials/params-table.hbs new file mode 100644 index 0000000..839fdb6 --- /dev/null +++ b/docs/ccxt/wiki/basePartials/params-table.hbs @@ -0,0 +1,12 @@ +{{#if params}} + +{{tableHead params "name|Param" "type|Type" "optional|Required" "description|Description" ~}} + +{{#tableRow params "name" "type" "optional" "description" ~}} +| {{#if @col1}}{{name}} | {{/if~}} +{{#if @col2}}{{>linked-type-list types=(cleanNames type.names) delimiter=", " }} | {{/if~}} +{{#if @col3}}{{#unless optional}}Yes{{else}}No{{/unless}} | {{/if~}} +{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}} +{{/tableRow}} + +{{/if}} diff --git a/docs/ccxt/wiki/basePartials/returns.hbs b/docs/ccxt/wiki/basePartials/returns.hbs new file mode 100644 index 0000000..a068ddd --- /dev/null +++ b/docs/ccxt/wiki/basePartials/returns.hbs @@ -0,0 +1,12 @@ +{{#if returns}} +{{#if returns.[0].description~}} +**Returns**: {{#each returns~}} + {{#if type~}} + {{#if type.names}}{{>linked-type-list types=(cleanNames type.names) delimiter=" \| " ~}}{{/if}} + {{~#if description}} - {{{inlineLinks description}}}{{/if~}} + {{else~}} + {{{inlineLinks description}~}} + {{/if~}} +{{~/each}} + +{{/if}}{{/if}} diff --git a/docs/ccxt/wiki/baseSpec.md b/docs/ccxt/wiki/baseSpec.md new file mode 100644 index 0000000..d26ac53 --- /dev/null +++ b/docs/ccxt/wiki/baseSpec.md @@ -0,0 +1,7663 @@ + + + +## addMargin +add margin + +**Kind**: instance +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexaddmargin) +* [binance](/exchanges/binance.md#binanceaddmargin) +* [bitget](/exchanges/bitget.md#bitgetaddmargin) +* [coincatch](/exchanges/coincatch.md#coincatchaddmargin) +* [coinex](/exchanges/coinex.md#coinexaddmargin) +* [delta](/exchanges/delta.md#deltaaddmargin) +* [digifinex](/exchanges/digifinex.md#digifinexaddmargin) +* [exmo](/exchanges/exmo.md#exmoaddmargin) +* [gate](/exchanges/gate.md#gateaddmargin) +* [hitbtc](/exchanges/hitbtc.md#hitbtcaddmargin) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidaddmargin) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesaddmargin) +* [mexc](/exchanges/mexc.md#mexcaddmargin) +* [okx](/exchanges/okx.md#okxaddmargin) +* [poloniex](/exchanges/poloniex.md#poloniexaddmargin) +* [woo](/exchanges/woo.md#wooaddmargin) +* [xt](/exchanges/xt.md#xtaddmargin) + +--- + + + +## borrowCrossMargin +create a loan to borrow margin + +**Kind**: instance +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to borrow margin in a portfolio margin account | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binanceborrowcrossmargin) +* [bitget](/exchanges/bitget.md#bitgetborrowcrossmargin) +* [bybit](/exchanges/bybit.md#bybitborrowcrossmargin) +* [coinmetro](/exchanges/coinmetro.md#coinmetroborrowcrossmargin) +* [htx](/exchanges/htx.md#htxborrowcrossmargin) +* [kucoin](/exchanges/kucoin.md#kucoinborrowcrossmargin) +* [okx](/exchanges/okx.md#okxborrowcrossmargin) + +--- + + + +## borrowIsolatedMargin +create a loan to borrow margin + +**Kind**: instance +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for isolated margin | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binanceborrowisolatedmargin) +* [bitget](/exchanges/bitget.md#bitgetborrowisolatedmargin) +* [bitmart](/exchanges/bitmart.md#bitmartborrowisolatedmargin) +* [coinex](/exchanges/coinex.md#coinexborrowisolatedmargin) +* [gate](/exchanges/gate.md#gateborrowisolatedmargin) +* [htx](/exchanges/htx.md#htxborrowisolatedmargin) +* [kucoin](/exchanges/kucoin.md#kucoinborrowisolatedmargin) + +--- + + + +## borrowMargin +create a loan to borrow margin + +**Kind**: instance +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.rate | string | No | '0.0002' or '0.002' extra parameter required for isolated margin | +| params.unifiedAccount | boolean | No | set to true for borrowing in the unified account | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gateborrowmargin) + +--- + + + +## calculatePricePrecision +Helper function to calculate the Hyperliquid DECIMAL_PLACES price precision + +**Kind**: instance +**Returns**: int - The calculated price precision + + +| Param | Type | Description | +| --- | --- | --- | +| price | float | the price to use in the calculation | +| amountPrecision | int | the amountPrecision to use in the calculation | +| maxDecimals | int | the maxDecimals to use in the calculation | + +##### Supported exchanges +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcalculatepriceprecision) + +--- + + + +## cancelAllOrders +cancel all open orders in a market + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacacancelallorders) +* [apex](/exchanges/apex.md#apexcancelallorders) +* [ascendex](/exchanges/ascendex.md#ascendexcancelallorders) +* [backpack](/exchanges/backpack.md#backpackcancelallorders) +* [bigone](/exchanges/bigone.md#bigonecancelallorders) +* [binance](/exchanges/binance.md#binancecancelallorders) +* [bingx](/exchanges/bingx.md#bingxcancelallorders) +* [bitfinex](/exchanges/bitfinex.md#bitfinexcancelallorders) +* [bitget](/exchanges/bitget.md#bitgetcancelallorders) +* [bitmart](/exchanges/bitmart.md#bitmartcancelallorders) +* [bitmex](/exchanges/bitmex.md#bitmexcancelallorders) +* [bitopro](/exchanges/bitopro.md#bitoprocancelallorders) +* [bitrue](/exchanges/bitrue.md#bitruecancelallorders) +* [bitso](/exchanges/bitso.md#bitsocancelallorders) +* [bitstamp](/exchanges/bitstamp.md#bitstampcancelallorders) +* [bitteam](/exchanges/bitteam.md#bitteamcancelallorders) +* [bittrade](/exchanges/bittrade.md#bittradecancelallorders) +* [bitvavo](/exchanges/bitvavo.md#bitvavocancelallorders) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomcancelallorders) +* [bybit](/exchanges/bybit.md#bybitcancelallorders) +* [cex](/exchanges/cex.md#cexcancelallorders) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangecancelallorders) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalcancelallorders) +* [coincatch](/exchanges/coincatch.md#coincatchcancelallorders) +* [coinex](/exchanges/coinex.md#coinexcancelallorders) +* [coinsph](/exchanges/coinsph.md#coinsphcancelallorders) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcancelallorders) +* [defx](/exchanges/defx.md#defxcancelallorders) +* [delta](/exchanges/delta.md#deltacancelallorders) +* [deribit](/exchanges/deribit.md#deribitcancelallorders) +* [derive](/exchanges/derive.md#derivecancelallorders) +* [foxbit](/exchanges/foxbit.md#foxbitcancelallorders) +* [gate](/exchanges/gate.md#gatecancelallorders) +* [hashkey](/exchanges/hashkey.md#hashkeycancelallorders) +* [hibachi](/exchanges/hibachi.md#hibachicancelallorders) +* [hitbtc](/exchanges/hitbtc.md#hitbtccancelallorders) +* [hollaex](/exchanges/hollaex.md#hollaexcancelallorders) +* [htx](/exchanges/htx.md#htxcancelallorders) +* [kraken](/exchanges/kraken.md#krakencancelallorders) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturescancelallorders) +* [kucoin](/exchanges/kucoin.md#kucoincancelallorders) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturescancelallorders) +* [latoken](/exchanges/latoken.md#latokencancelallorders) +* [lbank](/exchanges/lbank.md#lbankcancelallorders) +* [mexc](/exchanges/mexc.md#mexccancelallorders) +* [modetrade](/exchanges/modetrade.md#modetradecancelallorders) +* [ndax](/exchanges/ndax.md#ndaxcancelallorders) +* [oceanex](/exchanges/oceanex.md#oceanexcancelallorders) +* [onetrading](/exchanges/onetrading.md#onetradingcancelallorders) +* [oxfun](/exchanges/oxfun.md#oxfuncancelallorders) +* [paradex](/exchanges/paradex.md#paradexcancelallorders) +* [phemex](/exchanges/phemex.md#phemexcancelallorders) +* [poloniex](/exchanges/poloniex.md#poloniexcancelallorders) +* [toobit](/exchanges/toobit.md#toobitcancelallorders) +* [whitebit](/exchanges/whitebit.md#whitebitcancelallorders) +* [woo](/exchanges/woo.md#woocancelallorders) +* [woofipro](/exchanges/woofipro.md#woofiprocancelallorders) +* [xt](/exchanges/xt.md#xtcancelallorders) + +--- + + + +## cancelAllOrdersAfter +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance +**Returns**: object - the api result + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | spot or swap market | + +##### Supported exchanges +* [bingx](/exchanges/bingx.md#bingxcancelallordersafter) +* [bitmex](/exchanges/bitmex.md#bitmexcancelallordersafter) +* [bybit](/exchanges/bybit.md#bybitcancelallordersafter) +* [htx](/exchanges/htx.md#htxcancelallordersafter) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcancelallordersafter) +* [kraken](/exchanges/kraken.md#krakencancelallordersafter) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturescancelallordersafter) +* [okx](/exchanges/okx.md#okxcancelallordersafter) +* [whitebit](/exchanges/whitebit.md#whitebitcancelallordersafter) +* [woo](/exchanges/woo.md#woocancelallordersafter) + +--- + + + +## cancelAllOrdersWs +cancel all open orders + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavocancelallordersws) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcancelallordersws) +* [gate](/exchanges/gate.md#gatecancelallordersws) +* [okx](/exchanges/okx.md#okxcancelallordersws) + +--- + + + +## cancelOrder +cancels an open order + +**Kind**: instance +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacacancelorder) +* [apex](/exchanges/apex.md#apexcancelorder) +* [ascendex](/exchanges/ascendex.md#ascendexcancelorder) +* [backpack](/exchanges/backpack.md#backpackcancelorder) +* [bigone](/exchanges/bigone.md#bigonecancelorder) +* [binance](/exchanges/binance.md#binancecancelorder) +* [bingx](/exchanges/bingx.md#bingxcancelorder) +* [bit2c](/exchanges/bit2c.md#bit2ccancelorder) +* [bitbank](/exchanges/bitbank.md#bitbankcancelorder) +* [bitbns](/exchanges/bitbns.md#bitbnscancelorder) +* [bitfinex](/exchanges/bitfinex.md#bitfinexcancelorder) +* [bitflyer](/exchanges/bitflyer.md#bitflyercancelorder) +* [bitget](/exchanges/bitget.md#bitgetcancelorder) +* [bithumb](/exchanges/bithumb.md#bithumbcancelorder) +* [bitmart](/exchanges/bitmart.md#bitmartcancelorder) +* [bitmex](/exchanges/bitmex.md#bitmexcancelorder) +* [bitopro](/exchanges/bitopro.md#bitoprocancelorder) +* [bitrue](/exchanges/bitrue.md#bitruecancelorder) +* [bitso](/exchanges/bitso.md#bitsocancelorder) +* [bitstamp](/exchanges/bitstamp.md#bitstampcancelorder) +* [bitteam](/exchanges/bitteam.md#bitteamcancelorder) +* [bittrade](/exchanges/bittrade.md#bittradecancelorder) +* [bitvavo](/exchanges/bitvavo.md#bitvavocancelorder) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomcancelorder) +* [blofin](/exchanges/blofin.md#blofincancelorder) +* [btcalpha](/exchanges/btcalpha.md#btcalphacancelorder) +* [btcbox](/exchanges/btcbox.md#btcboxcancelorder) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketscancelorder) +* [btcturk](/exchanges/btcturk.md#btcturkcancelorder) +* [bybit](/exchanges/bybit.md#bybitcancelorder) +* [cex](/exchanges/cex.md#cexcancelorder) +* [coinbase](/exchanges/coinbase.md#coinbasecancelorder) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangecancelorder) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalcancelorder) +* [coincatch](/exchanges/coincatch.md#coincatchcancelorder) +* [coincheck](/exchanges/coincheck.md#coincheckcancelorder) +* [coinex](/exchanges/coinex.md#coinexcancelorder) +* [coinmate](/exchanges/coinmate.md#coinmatecancelorder) +* [coinmetro](/exchanges/coinmetro.md#coinmetrocancelorder) +* [coinone](/exchanges/coinone.md#coinonecancelorder) +* [coinsph](/exchanges/coinsph.md#coinsphcancelorder) +* [coinspot](/exchanges/coinspot.md#coinspotcancelorder) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcancelorder) +* [cryptomus](/exchanges/cryptomus.md#cryptomuscancelorder) +* [defx](/exchanges/defx.md#defxcancelorder) +* [delta](/exchanges/delta.md#deltacancelorder) +* [deribit](/exchanges/deribit.md#deribitcancelorder) +* [derive](/exchanges/derive.md#derivecancelorder) +* [digifinex](/exchanges/digifinex.md#digifinexcancelorder) +* [exmo](/exchanges/exmo.md#exmocancelorder) +* [foxbit](/exchanges/foxbit.md#foxbitcancelorder) +* [gate](/exchanges/gate.md#gatecancelorder) +* [gemini](/exchanges/gemini.md#geminicancelorder) +* [hashkey](/exchanges/hashkey.md#hashkeycancelorder) +* [hibachi](/exchanges/hibachi.md#hibachicancelorder) +* [hitbtc](/exchanges/hitbtc.md#hitbtccancelorder) +* [hollaex](/exchanges/hollaex.md#hollaexcancelorder) +* [htx](/exchanges/htx.md#htxcancelorder) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcancelorder) +* [independentreserve](/exchanges/independentreserve.md#independentreservecancelorder) +* [indodax](/exchanges/indodax.md#indodaxcancelorder) +* [kraken](/exchanges/kraken.md#krakencancelorder) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturescancelorder) +* [kucoin](/exchanges/kucoin.md#kucoincancelorder) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturescancelorder) +* [latoken](/exchanges/latoken.md#latokencancelorder) +* [lbank](/exchanges/lbank.md#lbankcancelorder) +* [luno](/exchanges/luno.md#lunocancelorder) +* [mercado](/exchanges/mercado.md#mercadocancelorder) +* [mexc](/exchanges/mexc.md#mexccancelorder) +* [modetrade](/exchanges/modetrade.md#modetradecancelorder) +* [ndax](/exchanges/ndax.md#ndaxcancelorder) +* [novadax](/exchanges/novadax.md#novadaxcancelorder) +* [oceanex](/exchanges/oceanex.md#oceanexcancelorder) +* [okcoin](/exchanges/okcoin.md#okcoincancelorder) +* [okx](/exchanges/okx.md#okxcancelorder) +* [onetrading](/exchanges/onetrading.md#onetradingcancelorder) +* [oxfun](/exchanges/oxfun.md#oxfuncancelorder) +* [p2b](/exchanges/p2b.md#p2bcancelorder) +* [paradex](/exchanges/paradex.md#paradexcancelorder) +* [paymium](/exchanges/paymium.md#paymiumcancelorder) +* [phemex](/exchanges/phemex.md#phemexcancelorder) +* [probit](/exchanges/probit.md#probitcancelorder) +* [timex](/exchanges/timex.md#timexcancelorder) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptocancelorder) +* [toobit](/exchanges/toobit.md#toobitcancelorder) +* [upbit](/exchanges/upbit.md#upbitcancelorder) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangecancelorder) +* [whitebit](/exchanges/whitebit.md#whitebitcancelorder) +* [woo](/exchanges/woo.md#woocancelorder) +* [woofipro](/exchanges/woofipro.md#woofiprocancelorder) +* [xt](/exchanges/xt.md#xtcancelorder) +* [yobit](/exchanges/yobit.md#yobitcancelorder) +* [zaif](/exchanges/zaif.md#zaifcancelorder) +* [zonda](/exchanges/zonda.md#zondacancelorder) + +--- + + + +## cancelOrderWs +cancels an open order + +**Kind**: instance +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavocancelorderws) +* [bybit](/exchanges/bybit.md#bybitcancelorderws) +* [cex](/exchanges/cex.md#cexcancelorderws) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcancelorderws) +* [gate](/exchanges/gate.md#gatecancelorderws) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcancelorderws) +* [okx](/exchanges/okx.md#okxcancelorderws) +* [oxfun](/exchanges/oxfun.md#oxfuncancelorderws) + +--- + + + +## cancelOrders +cancel multiple orders + +**Kind**: instance +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | alternative to ids, array of client order ids EXCHANGE SPECIFIC PARAMETERS | +| params.origClientOrderIdList | Array<string> | No | max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma | +| params.recvWindow | Array<int> | No | | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancecancelorders) +* [bingx](/exchanges/bingx.md#bingxcancelorders) +* [bitfinex](/exchanges/bitfinex.md#bitfinexcancelorders) +* [bitget](/exchanges/bitget.md#bitgetcancelorders) +* [bitmart](/exchanges/bitmart.md#bitmartcancelorders) +* [bitmex](/exchanges/bitmex.md#bitmexcancelorders) +* [bitopro](/exchanges/bitopro.md#bitoprocancelorders) +* [bitso](/exchanges/bitso.md#bitsocancelorders) +* [bittrade](/exchanges/bittrade.md#bittradecancelorders) +* [blofin](/exchanges/blofin.md#blofincancelorders) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketscancelorders) +* [bybit](/exchanges/bybit.md#bybitcancelorders) +* [coinbase](/exchanges/coinbase.md#coinbasecancelorders) +* [coincatch](/exchanges/coincatch.md#coincatchcancelorders) +* [coinex](/exchanges/coinex.md#coinexcancelorders) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcancelorders) +* [digifinex](/exchanges/digifinex.md#digifinexcancelorders) +* [gate](/exchanges/gate.md#gatecancelorders) +* [hashkey](/exchanges/hashkey.md#hashkeycancelorders) +* [hibachi](/exchanges/hibachi.md#hibachicancelorders) +* [htx](/exchanges/htx.md#htxcancelorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcancelorders) +* [kraken](/exchanges/kraken.md#krakencancelorders) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturescancelorders) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturescancelorders) +* [mexc](/exchanges/mexc.md#mexccancelorders) +* [modetrade](/exchanges/modetrade.md#modetradecancelorders) +* [oceanex](/exchanges/oceanex.md#oceanexcancelorders) +* [okcoin](/exchanges/okcoin.md#okcoincancelorders) +* [okx](/exchanges/okx.md#okxcancelorders) +* [onetrading](/exchanges/onetrading.md#onetradingcancelorders) +* [oxfun](/exchanges/oxfun.md#oxfuncancelorders) +* [timex](/exchanges/timex.md#timexcancelorders) +* [toobit](/exchanges/toobit.md#toobitcancelorders) +* [woofipro](/exchanges/woofipro.md#woofiprocancelorders) +* [xt](/exchanges/xt.md#xtcancelorders) + +--- + + + +## cancelOrdersForSymbols +cancel multiple orders for multiple symbols + +**Kind**: instance +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array<CancellationRequest> | Yes | list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}] | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitcancelordersforsymbols) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcancelordersforsymbols) +* [gate](/exchanges/gate.md#gatecancelordersforsymbols) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcancelordersforsymbols) +* [okx](/exchanges/okx.md#okxcancelordersforsymbols) + +--- + + + +## cancelOrdersRequest +build the request payload for cancelling multiple orders + +**Kind**: instance +**Returns**: object - the raw request object to be sent to the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | | + +##### Supported exchanges +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcancelordersrequest) + +--- + + + +## cancelOrdersWs +cancel multiple orders + +**Kind**: instance +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by cex cancelOrders() | +| params | object | No | extra parameters specific to the cex api endpoint | + +##### Supported exchanges +* [cex](/exchanges/cex.md#cexcancelordersws) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcancelordersws) +* [okx](/exchanges/okx.md#okxcancelordersws) +* [oxfun](/exchanges/oxfun.md#oxfuncancelordersws) + +--- + + + +## closeAllPositions +closes all open positions for a market type + +**Kind**: instance +**Returns**: Array<object> - A list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + +##### Supported exchanges +* [bitget](/exchanges/bitget.md#bitgetcloseallpositions) +* [defx](/exchanges/defx.md#defxcloseallpositions) +* [delta](/exchanges/delta.md#deltacloseallpositions) + +--- + + + +## closePosition +closes open positions for a market + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | No | not used by bingx | +| params | object | No | extra parameters specific to the bingx api endpoint | +| params.positionId | string, undefined | No | the id of the position you would like to close | + +##### Supported exchanges +* [bingx](/exchanges/bingx.md#bingxcloseposition) +* [bitget](/exchanges/bitget.md#bitgetcloseposition) +* [blofin](/exchanges/blofin.md#blofincloseposition) +* [coinbase](/exchanges/coinbase.md#coinbasecloseposition) +* [coinex](/exchanges/coinex.md#coinexcloseposition) +* [coinmetro](/exchanges/coinmetro.md#coinmetrocloseposition) +* [defx](/exchanges/defx.md#defxcloseposition) +* [gate](/exchanges/gate.md#gatecloseposition) +* [hitbtc](/exchanges/hitbtc.md#hitbtccloseposition) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturescloseposition) +* [okx](/exchanges/okx.md#okxcloseposition) + +--- + + + +## closePositions +closes open positions for a market + +**Kind**: instance +**Returns**: Array<object> - [a list of position structures](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bingx api endpoint | +| params.recvWindow | string | No | request valid time window value | + +##### Supported exchanges +* [bitget](/exchanges/bitget.md#bitgetclosepositions) +* [cryptocom](/exchanges/cryptocom.md#cryptocomclosepositions) +* [htx](/exchanges/htx.md#htxclosepositions) + +--- + + + +## createConvertTrade +convert from one currency to another + +**Kind**: instance +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancecreateconverttrade) +* [bitget](/exchanges/bitget.md#bitgetcreateconverttrade) +* [bybit](/exchanges/bybit.md#bybitcreateconverttrade) +* [coinbase](/exchanges/coinbase.md#coinbasecreateconverttrade) +* [okx](/exchanges/okx.md#okxcreateconverttrade) +* [phemex](/exchanges/phemex.md#phemexcreateconverttrade) +* [whitebit](/exchanges/whitebit.md#whitebitcreateconverttrade) +* [woo](/exchanges/woo.md#woocreateconverttrade) + +--- + + + +## createDepositAddress +create a currency deposit address + +**Kind**: instance +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bitfinex](/exchanges/bitfinex.md#bitfinexcreatedepositaddress) +* [coinbase](/exchanges/coinbase.md#coinbasecreatedepositaddress) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangecreatedepositaddress) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalcreatedepositaddress) +* [coinex](/exchanges/coinex.md#coinexcreatedepositaddress) +* [deribit](/exchanges/deribit.md#deribitcreatedepositaddress) +* [gemini](/exchanges/gemini.md#geminicreatedepositaddress) +* [hitbtc](/exchanges/hitbtc.md#hitbtccreatedepositaddress) +* [kraken](/exchanges/kraken.md#krakencreatedepositaddress) +* [kucoin](/exchanges/kucoin.md#kucoincreatedepositaddress) +* [luno](/exchanges/luno.md#lunocreatedepositaddress) +* [mexc](/exchanges/mexc.md#mexccreatedepositaddress) +* [ndax](/exchanges/ndax.md#ndaxcreatedepositaddress) +* [paymium](/exchanges/paymium.md#paymiumcreatedepositaddress) +* [poloniex](/exchanges/poloniex.md#poloniexcreatedepositaddress) +* [upbit](/exchanges/upbit.md#upbitcreatedepositaddress) +* [whitebit](/exchanges/whitebit.md#whitebitcreatedepositaddress) +* [yobit](/exchanges/yobit.md#yobitcreatedepositaddress) + +--- + + + +## createGiftCode +create gift code + +**Kind**: instance +**Returns**: object - The gift code id, code, currency and amount + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | gift code | +| amount | float | Yes | amount of currency for the gift | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancecreategiftcode) + +--- + + + +## createMarkeSellOrderWithCost +create a market sell order by providing the symbol and cost + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitcreatemarkesellorderwithcost) + +--- + + + +## createMarketBuyOrderWithCost +create a market buy order by providing the symbol and cost + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacacreatemarketbuyorderwithcost) +* [bigone](/exchanges/bigone.md#bigonecreatemarketbuyorderwithcost) +* [binance](/exchanges/binance.md#binancecreatemarketbuyorderwithcost) +* [bingx](/exchanges/bingx.md#bingxcreatemarketbuyorderwithcost) +* [bitget](/exchanges/bitget.md#bitgetcreatemarketbuyorderwithcost) +* [bitmart](/exchanges/bitmart.md#bitmartcreatemarketbuyorderwithcost) +* [bitrue](/exchanges/bitrue.md#bitruecreatemarketbuyorderwithcost) +* [bittrade](/exchanges/bittrade.md#bittradecreatemarketbuyorderwithcost) +* [bybit](/exchanges/bybit.md#bybitcreatemarketbuyorderwithcost) +* [coinbase](/exchanges/coinbase.md#coinbasecreatemarketbuyorderwithcost) +* [coincatch](/exchanges/coincatch.md#coincatchcreatemarketbuyorderwithcost) +* [coinex](/exchanges/coinex.md#coinexcreatemarketbuyorderwithcost) +* [digifinex](/exchanges/digifinex.md#digifinexcreatemarketbuyorderwithcost) +* [exmo](/exchanges/exmo.md#exmocreatemarketbuyorderwithcost) +* [gate](/exchanges/gate.md#gatecreatemarketbuyorderwithcost) +* [hashkey](/exchanges/hashkey.md#hashkeycreatemarketbuyorderwithcost) +* [htx](/exchanges/htx.md#htxcreatemarketbuyorderwithcost) +* [kraken](/exchanges/kraken.md#krakencreatemarketbuyorderwithcost) +* [kucoin](/exchanges/kucoin.md#kucoincreatemarketbuyorderwithcost) +* [lbank](/exchanges/lbank.md#lbankcreatemarketbuyorderwithcost) +* [mexc](/exchanges/mexc.md#mexccreatemarketbuyorderwithcost) +* [okcoin](/exchanges/okcoin.md#okcoincreatemarketbuyorderwithcost) +* [okx](/exchanges/okx.md#okxcreatemarketbuyorderwithcost) +* [oxfun](/exchanges/oxfun.md#oxfuncreatemarketbuyorderwithcost) +* [whitebit](/exchanges/whitebit.md#whitebitcreatemarketbuyorderwithcost) +* [woo](/exchanges/woo.md#woocreatemarketbuyorderwithcost) +* [xt](/exchanges/xt.md#xtcreatemarketbuyorderwithcost) + +--- + + + +## createMarketOrderWithCost +create a market order by providing the symbol, side and cost + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacacreatemarketorderwithcost) +* [binance](/exchanges/binance.md#binancecreatemarketorderwithcost) +* [bingx](/exchanges/bingx.md#bingxcreatemarketorderwithcost) +* [exmo](/exchanges/exmo.md#exmocreatemarketorderwithcost) +* [kraken](/exchanges/kraken.md#krakencreatemarketorderwithcost) +* [kucoin](/exchanges/kucoin.md#kucoincreatemarketorderwithcost) +* [whitebit](/exchanges/whitebit.md#whitebitcreatemarketorderwithcost) + +--- + + + +## createMarketSellOrderWithCost +create a market sell order by providing the symbol and cost + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacacreatemarketsellorderwithcost) +* [binance](/exchanges/binance.md#binancecreatemarketsellorderwithcost) +* [bingx](/exchanges/bingx.md#bingxcreatemarketsellorderwithcost) +* [exmo](/exchanges/exmo.md#exmocreatemarketsellorderwithcost) +* [kucoin](/exchanges/kucoin.md#kucoincreatemarketsellorderwithcost) +* [mexc](/exchanges/mexc.md#mexccreatemarketsellorderwithcost) +* [okx](/exchanges/okx.md#okxcreatemarketsellorderwithcost) +* [woo](/exchanges/woo.md#woocreatemarketsellorderwithcost) + +--- + + + +## createOrder +create a trade order + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit' or 'stop_limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.cost | float | No | *market orders only* the cost of the order in units of the quote currency | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacacreateorder) +* [apex](/exchanges/apex.md#apexcreateorder) +* [ascendex](/exchanges/ascendex.md#ascendexcreateorder) +* [backpack](/exchanges/backpack.md#backpackcreateorder) +* [bigone](/exchanges/bigone.md#bigonecreateorder) +* [binance](/exchanges/binance.md#binancecreateorder) +* [bingx](/exchanges/bingx.md#bingxcreateorder) +* [bit2c](/exchanges/bit2c.md#bit2ccreateorder) +* [bitbank](/exchanges/bitbank.md#bitbankcreateorder) +* [bitbns](/exchanges/bitbns.md#bitbnscreateorder) +* [bitfinex](/exchanges/bitfinex.md#bitfinexcreateorder) +* [bitflyer](/exchanges/bitflyer.md#bitflyercreateorder) +* [bitget](/exchanges/bitget.md#bitgetcreateorder) +* [bithumb](/exchanges/bithumb.md#bithumbcreateorder) +* [bitmart](/exchanges/bitmart.md#bitmartcreateorder) +* [bitmex](/exchanges/bitmex.md#bitmexcreateorder) +* [bitopro](/exchanges/bitopro.md#bitoprocreateorder) +* [bitrue](/exchanges/bitrue.md#bitruecreateorder) +* [bitso](/exchanges/bitso.md#bitsocreateorder) +* [bitstamp](/exchanges/bitstamp.md#bitstampcreateorder) +* [bitteam](/exchanges/bitteam.md#bitteamcreateorder) +* [bittrade](/exchanges/bittrade.md#bittradecreateorder) +* [bitvavo](/exchanges/bitvavo.md#bitvavocreateorder) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomcreateorder) +* [blofin](/exchanges/blofin.md#blofincreateorder) +* [btcalpha](/exchanges/btcalpha.md#btcalphacreateorder) +* [btcbox](/exchanges/btcbox.md#btcboxcreateorder) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketscreateorder) +* [btcturk](/exchanges/btcturk.md#btcturkcreateorder) +* [bybit](/exchanges/bybit.md#bybitcreateorder) +* [cex](/exchanges/cex.md#cexcreateorder) +* [coinbase](/exchanges/coinbase.md#coinbasecreateorder) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangecreateorder) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalcreateorder) +* [coincatch](/exchanges/coincatch.md#coincatchcreateorder) +* [coincheck](/exchanges/coincheck.md#coincheckcreateorder) +* [coinex](/exchanges/coinex.md#coinexcreateorder) +* [coinmate](/exchanges/coinmate.md#coinmatecreateorder) +* [coinmetro](/exchanges/coinmetro.md#coinmetrocreateorder) +* [coinone](/exchanges/coinone.md#coinonecreateorder) +* [coinsph](/exchanges/coinsph.md#coinsphcreateorder) +* [coinspot](/exchanges/coinspot.md#coinspotcreateorder) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcreateorder) +* [cryptomus](/exchanges/cryptomus.md#cryptomuscreateorder) +* [defx](/exchanges/defx.md#defxcreateorder) +* [delta](/exchanges/delta.md#deltacreateorder) +* [deribit](/exchanges/deribit.md#deribitcreateorder) +* [derive](/exchanges/derive.md#derivecreateorder) +* [digifinex](/exchanges/digifinex.md#digifinexcreateorder) +* [exmo](/exchanges/exmo.md#exmocreateorder) +* [foxbit](/exchanges/foxbit.md#foxbitcreateorder) +* [gate](/exchanges/gate.md#gatecreateorder) +* [gemini](/exchanges/gemini.md#geminicreateorder) +* [hashkey](/exchanges/hashkey.md#hashkeycreateorder) +* [hibachi](/exchanges/hibachi.md#hibachicreateorder) +* [hitbtc](/exchanges/hitbtc.md#hitbtccreateorder) +* [hollaex](/exchanges/hollaex.md#hollaexcreateorder) +* [htx](/exchanges/htx.md#htxcreateorder) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcreateorder) +* [independentreserve](/exchanges/independentreserve.md#independentreservecreateorder) +* [indodax](/exchanges/indodax.md#indodaxcreateorder) +* [kraken](/exchanges/kraken.md#krakencreateorder) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturescreateorder) +* [kucoin](/exchanges/kucoin.md#kucoincreateorder) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturescreateorder) +* [latoken](/exchanges/latoken.md#latokencreateorder) +* [lbank](/exchanges/lbank.md#lbankcreateorder) +* [luno](/exchanges/luno.md#lunocreateorder) +* [mercado](/exchanges/mercado.md#mercadocreateorder) +* [mexc](/exchanges/mexc.md#mexccreateorder) +* [modetrade](/exchanges/modetrade.md#modetradecreateorder) +* [ndax](/exchanges/ndax.md#ndaxcreateorder) +* [novadax](/exchanges/novadax.md#novadaxcreateorder) +* [oceanex](/exchanges/oceanex.md#oceanexcreateorder) +* [okcoin](/exchanges/okcoin.md#okcoincreateorder) +* [okx](/exchanges/okx.md#okxcreateorder) +* [onetrading](/exchanges/onetrading.md#onetradingcreateorder) +* [oxfun](/exchanges/oxfun.md#oxfuncreateorder) +* [p2b](/exchanges/p2b.md#p2bcreateorder) +* [paradex](/exchanges/paradex.md#paradexcreateorder) +* [paymium](/exchanges/paymium.md#paymiumcreateorder) +* [phemex](/exchanges/phemex.md#phemexcreateorder) +* [poloniex](/exchanges/poloniex.md#poloniexcreateorder) +* [probit](/exchanges/probit.md#probitcreateorder) +* [timex](/exchanges/timex.md#timexcreateorder) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptocreateorder) +* [toobit](/exchanges/toobit.md#toobitcreateorder) +* [upbit](/exchanges/upbit.md#upbitcreateorder) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangecreateorder) +* [whitebit](/exchanges/whitebit.md#whitebitcreateorder) +* [woo](/exchanges/woo.md#woocreateorder) +* [woofipro](/exchanges/woofipro.md#woofiprocreateorder) +* [xt](/exchanges/xt.md#xtcreateorder) +* [yobit](/exchanges/yobit.md#yobitcreateorder) +* [zaif](/exchanges/zaif.md#zaifcreateorder) +* [zonda](/exchanges/zonda.md#zondacreateorder) + +--- + + + +## createOrderWithTakeProfitAndStopLoss +*swap markets only* create an order with a stop loss or take profit attached (type 3) + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency or the number of contracts | +| price | float | No | the price to fulfill the order, in units of the quote currency, ignored in market orders | +| takeProfit | float | No | the take profit price, in units of the quote currency | +| stopLoss | float | No | the stop loss price, in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coincatch](/exchanges/coincatch.md#coincatchcreateorderwithtakeprofitandstoploss) + +--- + + + +## createOrderWs +create a trade order + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the bitvavo api endpoint | +| params.timeInForce | string | No | "GTC", "IOC", or "PO" | +| params.stopPrice | float | No | The price at which a trigger order is triggered at | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.postOnly | bool | No | If true, the order will only be posted to the order book and not executed immediately | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.triggerType | string | No | "price" | +| params.triggerReference | string | No | "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order | +| params.selfTradePrevention | string | No | "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth" | +| params.disableMarketProtection | bool | No | don't cancel if the next fill price is 10% worse than the best fill price | +| params.responseRequired | bool | No | Set this to 'false' when only an acknowledgement of success or failure is required, this is faster. | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavocreateorderws) +* [bybit](/exchanges/bybit.md#bybitcreateorderws) +* [cex](/exchanges/cex.md#cexcreateorderws) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcreateorderws) +* [gate](/exchanges/gate.md#gatecreateorderws) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcreateorderws) +* [okx](/exchanges/okx.md#okxcreateorderws) +* [oxfun](/exchanges/oxfun.md#oxfuncreateorderws) + +--- + + + +## createOrders +create a list of trade orders + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", or "PO" | +| params.postOnly | bool | No | true or false | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexcreateorders) +* [backpack](/exchanges/backpack.md#backpackcreateorders) +* [binance](/exchanges/binance.md#binancecreateorders) +* [bingx](/exchanges/bingx.md#bingxcreateorders) +* [bitfinex](/exchanges/bitfinex.md#bitfinexcreateorders) +* [bitget](/exchanges/bitget.md#bitgetcreateorders) +* [bitmart](/exchanges/bitmart.md#bitmartcreateorders) +* [blofin](/exchanges/blofin.md#blofincreateorders) +* [bybit](/exchanges/bybit.md#bybitcreateorders) +* [coincatch](/exchanges/coincatch.md#coincatchcreateorders) +* [coinex](/exchanges/coinex.md#coinexcreateorders) +* [cryptocom](/exchanges/cryptocom.md#cryptocomcreateorders) +* [digifinex](/exchanges/digifinex.md#digifinexcreateorders) +* [foxbit](/exchanges/foxbit.md#foxbitcreateorders) +* [gate](/exchanges/gate.md#gatecreateorders) +* [hashkey](/exchanges/hashkey.md#hashkeycreateorders) +* [hibachi](/exchanges/hibachi.md#hibachicreateorders) +* [htx](/exchanges/htx.md#htxcreateorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcreateorders) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturescreateorders) +* [kucoin](/exchanges/kucoin.md#kucoincreateorders) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturescreateorders) +* [mexc](/exchanges/mexc.md#mexccreateorders) +* [modetrade](/exchanges/modetrade.md#modetradecreateorders) +* [okx](/exchanges/okx.md#okxcreateorders) +* [oxfun](/exchanges/oxfun.md#oxfuncreateorders) +* [woofipro](/exchanges/woofipro.md#woofiprocreateorders) + +--- + + + +## createOrdersRequest +create a list of trade orders + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Description | +| --- | --- | --- | +| orders | Array | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | + +##### Supported exchanges +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcreateordersrequest) + +--- + + + +## createOrdersWs +create a list of trade orders + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gatecreateordersws) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcreateordersws) + +--- + + + +## createSpotOrder +create a trade order on spot market + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *market buy only* the quote quantity that can be used as an alternative for the amount | +| params.triggerPrice | float | No | the price that the order is to be triggered at | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'PO' | +| params.clientOrderId | string | No | a unique id for the order (max length 40) | + +##### Supported exchanges +* [coincatch](/exchanges/coincatch.md#coincatchcreatespotorder) +* [hashkey](/exchanges/hashkey.md#hashkeycreatespotorder) + +--- + + + +## createSwapOrder +create a trade order on swap market + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.hedged | bool | No | must be set to true if position mode is hedged (default false) | +| params.postOnly | bool | No | *non-trigger orders only* if true, the order will only be posted to the order book and not executed immediately | +| params.reduceOnly | bool | No | true or false whether the order is reduce only | +| params.timeInForce | string | No | *non-trigger orders only* 'GTC', 'FOK', 'IOC' or 'PO' | +| params.clientOrderId | string | No | a unique id for the order | +| params.triggerPrice | float | No | the price that the order is to be triggered at | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | + +##### Supported exchanges +* [coincatch](/exchanges/coincatch.md#coincatchcreateswaporder) +* [hashkey](/exchanges/hashkey.md#hashkeycreateswaporder) + +--- + + + +## createTrailingAmountOrder +create a trailing order by providing the symbol, type, side, amount, price and trailingAmount + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, or number of contracts | +| price | float | No | the price for the order to be filled at, in units of the quote currency, ignored in market orders | +| trailingAmount | float | Yes | the quote amount to trail away from the current market price | +| trailingTriggerPrice | float | Yes | the price to activate a trailing order, default uses the price argument | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [woo](/exchanges/woo.md#woocreatetrailingamountorder) + +--- + + + +## createTrailingPercentOrder +create a trailing order by providing the symbol, type, side, amount, price and trailingPercent + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, or number of contracts | +| price | float | No | the price for the order to be filled at, in units of the quote currency, ignored in market orders | +| trailingPercent | float | Yes | the percent to trail away from the current market price | +| trailingTriggerPrice | float | Yes | the price to activate a trailing order, default uses the price argument | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [htx](/exchanges/htx.md#htxcreatetrailingpercentorder) +* [woo](/exchanges/woo.md#woocreatetrailingpercentorder) + +--- + + + +## createVault +creates a value + +**Kind**: instance +**Returns**: object - the api result + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| name | string | Yes | The name of the vault | +| description | string | Yes | The description of the vault | +| initialUsd | number | Yes | The initialUsd of the vault | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidcreatevault) + +--- + + + +## deposit +make a deposit + +**Kind**: instance +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to deposit | +| id | string | Yes | the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountId | string | No | the id of the account to deposit into | + +##### Supported exchanges +* [coinbase](/exchanges/coinbase.md#coinbasedeposit) + +--- + + + +## editContractOrder +edit a trade order + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to edit an order in a portfolio margin account | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binanceeditcontractorder) + +--- + + + +## editOrder +edit a trade order + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market to create an order in | +| type | string | No | 'market', 'limit' or 'stop_limit' | +| side | string | No | 'buy' or 'sell' | +| amount | float | No | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price for the order, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | string | No | the price to trigger a stop order | +| params.timeInForce | string | No | for crypto trading either 'gtc' or 'ioc' can be used | +| params.clientOrderId | string | No | a unique identifier for the order, automatically generated if not sent | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacaeditorder) +* [binance](/exchanges/binance.md#binanceeditorder) +* [bingx](/exchanges/bingx.md#bingxeditorder) +* [bitfinex](/exchanges/bitfinex.md#bitfinexeditorder) +* [bitget](/exchanges/bitget.md#bitgeteditorder) +* [bitmart](/exchanges/bitmart.md#bitmarteditorder) +* [bitvavo](/exchanges/bitvavo.md#bitvavoeditorder) +* [bybit](/exchanges/bybit.md#bybiteditorder) +* [coinbase](/exchanges/coinbase.md#coinbaseeditorder) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationaleditorder) +* [coincatch](/exchanges/coincatch.md#coincatcheditorder) +* [coinex](/exchanges/coinex.md#coinexeditorder) +* [cryptocom](/exchanges/cryptocom.md#cryptocomeditorder) +* [delta](/exchanges/delta.md#deltaeditorder) +* [deribit](/exchanges/deribit.md#deribiteditorder) +* [derive](/exchanges/derive.md#deriveeditorder) +* [exmo](/exchanges/exmo.md#exmoeditorder) +* [foxbit](/exchanges/foxbit.md#foxbiteditorder) +* [gate](/exchanges/gate.md#gateeditorder) +* [hibachi](/exchanges/hibachi.md#hibachieditorder) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquideditorder) +* [kraken](/exchanges/kraken.md#krakeneditorder) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfutureseditorder) +* [kucoin](/exchanges/kucoin.md#kucoineditorder) +* [modetrade](/exchanges/modetrade.md#modetradeeditorder) +* [okx](/exchanges/okx.md#okxeditorder) +* [phemex](/exchanges/phemex.md#phemexeditorder) +* [poloniex](/exchanges/poloniex.md#poloniexeditorder) +* [upbit](/exchanges/upbit.md#upbiteditorder) +* [whitebit](/exchanges/whitebit.md#whitebiteditorder) +* [woo](/exchanges/woo.md#wooeditorder) +* [woofipro](/exchanges/woofipro.md#woofiproeditorder) +* [xt](/exchanges/xt.md#xteditorder) + +--- + + + +## editOrderWs +edit a trade order + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | No | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavoeditorderws) +* [bybit](/exchanges/bybit.md#bybiteditorderws) +* [cex](/exchanges/cex.md#cexeditorderws) +* [cryptocom](/exchanges/cryptocom.md#cryptocomeditorderws) +* [gate](/exchanges/gate.md#gateeditorderws) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquideditorderws) +* [okx](/exchanges/okx.md#okxeditorderws) +* [oxfun](/exchanges/oxfun.md#oxfuneditorderws) + +--- + + + +## editOrders +edit a list of trade orders + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binanceeditorders) +* [bybit](/exchanges/bybit.md#bybiteditorders) +* [hibachi](/exchanges/hibachi.md#hibachieditorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquideditorders) + +--- + + + +## enableDemoTrading +enables or disables demo trading mode + +**Kind**: instance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| enable | boolean | No | true if demo trading should be enabled, false otherwise | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binanceenabledemotrading) +* [bybit](/exchanges/bybit.md#bybitenabledemotrading) + +--- + + + +## fetchAccount +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexfetchaccount) + +--- + + + +## fetchAccountIdByType +fetch all the accounts by a type and marginModeassociated with a profile + +**Kind**: instance +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| type | string | Yes | 'spot', 'swap' or 'future | +| marginMode | string | No | 'cross' or 'isolated' | +| symbol | string | No | unified ccxt market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [htx](/exchanges/htx.md#htxfetchaccountidbytype) + +--- + + + +## fetchAccounts +fetch all the accounts associated with a profile + +**Kind**: instance +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexfetchaccounts) +* [bittrade](/exchanges/bittrade.md#bittradefetchaccounts) +* [coinbase](/exchanges/coinbase.md#coinbasefetchaccounts) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchaccounts) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchaccounts) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchaccounts) +* [deribit](/exchanges/deribit.md#deribitfetchaccounts) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchaccounts) +* [htx](/exchanges/htx.md#htxfetchaccounts) +* [kucoin](/exchanges/kucoin.md#kucoinfetchaccounts) +* [luno](/exchanges/luno.md#lunofetchaccounts) +* [mexc](/exchanges/mexc.md#mexcfetchaccounts) +* [ndax](/exchanges/ndax.md#ndaxfetchaccounts) +* [novadax](/exchanges/novadax.md#novadaxfetchaccounts) +* [okx](/exchanges/okx.md#okxfetchaccounts) +* [oxfun](/exchanges/oxfun.md#oxfunfetchaccounts) +* [woo](/exchanges/woo.md#woofetchaccounts) + +--- + + + +## fetchAllGreeks +fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch greeks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchallgreeks) +* [bybit](/exchanges/bybit.md#bybitfetchallgreeks) +* [okx](/exchanges/okx.md#okxfetchallgreeks) +* [paradex](/exchanges/paradex.md#paradexfetchallgreeks) + +--- + + + +## fetchBalance +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchbalance) +* [apex](/exchanges/apex.md#apexfetchbalance) +* [ascendex](/exchanges/ascendex.md#ascendexfetchbalance) +* [backpack](/exchanges/backpack.md#backpackfetchbalance) +* [bigone](/exchanges/bigone.md#bigonefetchbalance) +* [binance](/exchanges/binance.md#binancefetchbalance) +* [bingx](/exchanges/bingx.md#bingxfetchbalance) +* [bit2c](/exchanges/bit2c.md#bit2cfetchbalance) +* [bitbank](/exchanges/bitbank.md#bitbankfetchbalance) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchbalance) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchbalance) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchbalance) +* [bitget](/exchanges/bitget.md#bitgetfetchbalance) +* [bithumb](/exchanges/bithumb.md#bithumbfetchbalance) +* [bitmart](/exchanges/bitmart.md#bitmartfetchbalance) +* [bitmex](/exchanges/bitmex.md#bitmexfetchbalance) +* [bitopro](/exchanges/bitopro.md#bitoprofetchbalance) +* [bitrue](/exchanges/bitrue.md#bitruefetchbalance) +* [bitso](/exchanges/bitso.md#bitsofetchbalance) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchbalance) +* [betteam](/exchanges/betteam.md#betteamfetchbalance) +* [bittrade](/exchanges/bittrade.md#bittradefetchbalance) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchbalance) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchbalance) +* [blofin](/exchanges/blofin.md#blofinfetchbalance) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchbalance) +* [btcbox](/exchanges/btcbox.md#btcboxfetchbalance) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchbalance) +* [btcturk](/exchanges/btcturk.md#btcturkfetchbalance) +* [bybit](/exchanges/bybit.md#bybitfetchbalance) +* [cex](/exchanges/cex.md#cexfetchbalance) +* [coinbase](/exchanges/coinbase.md#coinbasefetchbalance) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchbalance) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchbalance) +* [coincatch](/exchanges/coincatch.md#coincatchfetchbalance) +* [coincheck](/exchanges/coincheck.md#coincheckfetchbalance) +* [coinex](/exchanges/coinex.md#coinexfetchbalance) +* [coinmate](/exchanges/coinmate.md#coinmatefetchbalance) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchbalance) +* [coinone](/exchanges/coinone.md#coinonefetchbalance) +* [coinsph](/exchanges/coinsph.md#coinsphfetchbalance) +* [coinspot](/exchanges/coinspot.md#coinspotfetchbalance) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchbalance) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchbalance) +* [defx](/exchanges/defx.md#defxfetchbalance) +* [delta](/exchanges/delta.md#deltafetchbalance) +* [deribit](/exchanges/deribit.md#deribitfetchbalance) +* [derive](/exchanges/derive.md#derivefetchbalance) +* [digifinex](/exchanges/digifinex.md#digifinexfetchbalance) +* [exmo](/exchanges/exmo.md#exmofetchbalance) +* [foxbit](/exchanges/foxbit.md#foxbitfetchbalance) +* [gate](/exchanges/gate.md#gatefetchbalance) +* [gemini](/exchanges/gemini.md#geminifetchbalance) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchbalance) +* [hibachi](/exchanges/hibachi.md#hibachifetchbalance) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchbalance) +* [hollaex](/exchanges/hollaex.md#hollaexfetchbalance) +* [htx](/exchanges/htx.md#htxfetchbalance) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchbalance) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchbalance) +* [indodax](/exchanges/indodax.md#indodaxfetchbalance) +* [kraken](/exchanges/kraken.md#krakenfetchbalance) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchbalance) +* [kucoin](/exchanges/kucoin.md#kucoinfetchbalance) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchbalance) +* [latoken](/exchanges/latoken.md#latokenfetchbalance) +* [lbank](/exchanges/lbank.md#lbankfetchbalance) +* [luno](/exchanges/luno.md#lunofetchbalance) +* [mercado](/exchanges/mercado.md#mercadofetchbalance) +* [mexc](/exchanges/mexc.md#mexcfetchbalance) +* [modetrade](/exchanges/modetrade.md#modetradefetchbalance) +* [ndax](/exchanges/ndax.md#ndaxfetchbalance) +* [novadax](/exchanges/novadax.md#novadaxfetchbalance) +* [oceanex](/exchanges/oceanex.md#oceanexfetchbalance) +* [okcoin](/exchanges/okcoin.md#okcoinfetchbalance) +* [okx](/exchanges/okx.md#okxfetchbalance) +* [onetrading](/exchanges/onetrading.md#onetradingfetchbalance) +* [oxfun](/exchanges/oxfun.md#oxfunfetchbalance) +* [p2b](/exchanges/p2b.md#p2bfetchbalance) +* [paradex](/exchanges/paradex.md#paradexfetchbalance) +* [paymium](/exchanges/paymium.md#paymiumfetchbalance) +* [phemex](/exchanges/phemex.md#phemexfetchbalance) +* [poloniex](/exchanges/poloniex.md#poloniexfetchbalance) +* [probit](/exchanges/probit.md#probitfetchbalance) +* [timex](/exchanges/timex.md#timexfetchbalance) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchbalance) +* [toobit](/exchanges/toobit.md#toobitfetchbalance) +* [upbit](/exchanges/upbit.md#upbitfetchbalance) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchbalance) +* [whitebit](/exchanges/whitebit.md#whitebitfetchbalance) +* [woo](/exchanges/woo.md#woofetchbalance) +* [woofipro](/exchanges/woofipro.md#woofiprofetchbalance) +* [xt](/exchanges/xt.md#xtfetchbalance) +* [yobit](/exchanges/yobit.md#yobitfetchbalance) +* [zaif](/exchanges/zaif.md#zaiffetchbalance) +* [zonda](/exchanges/zonda.md#zondafetchbalance) + +--- + + + +## fetchBalanceWs +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance +**Returns**: object - a [balance structure](https://docs.ccxt.com/en/latest/manual.html?#balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchbalancews) +* [cex](/exchanges/cex.md#cexfetchbalancews) + +--- + + + +## fetchBidsAsks +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchbidsasks) +* [bitrue](/exchanges/bitrue.md#bitruefetchbidsasks) +* [bybit](/exchanges/bybit.md#bybitfetchbidsasks) +* [coinbase](/exchanges/coinbase.md#coinbasefetchbidsasks) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchbidsasks) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchbidsasks) +* [mexc](/exchanges/mexc.md#mexcfetchbidsasks) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchbidsasks) +* [toobit](/exchanges/toobit.md#toobitfetchbidsasks) +* [xt](/exchanges/xt.md#xtfetchbidsasks) + +--- + + + +## fetchBorrowInterest +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| symbol | string | No | unified market symbol when fetch interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch the borrow interest in a portfolio margin account | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchborrowinterest) +* [bitget](/exchanges/bitget.md#bitgetfetchborrowinterest) +* [bitmart](/exchanges/bitmart.md#bitmartfetchborrowinterest) +* [bybit](/exchanges/bybit.md#bybitfetchborrowinterest) +* [coinex](/exchanges/coinex.md#coinexfetchborrowinterest) +* [gate](/exchanges/gate.md#gatefetchborrowinterest) +* [htx](/exchanges/htx.md#htxfetchborrowinterest) +* [kucoin](/exchanges/kucoin.md#kucoinfetchborrowinterest) +* [okx](/exchanges/okx.md#okxfetchborrowinterest) +* [whitebit](/exchanges/whitebit.md#whitebitfetchborrowinterest) + +--- + + + +## fetchBorrowRateHistories +retrieves a history of a multiple currencies borrow interest rate at specific time slots, returns all currencies if no symbols passed, default is undefined + +**Kind**: instance +**Returns**: object - a dictionary of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) indexed by the market symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| since | int | No | timestamp in ms of the earliest borrowRate, default is undefined | +| limit | int | No | max number of borrow rate prices to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' default is 'cross' | +| params.until | int | No | the latest time in ms to fetch entries for | + +##### Supported exchanges +* [kucoin](/exchanges/kucoin.md#kucoinfetchborrowratehistories) +* [okx](/exchanges/okx.md#okxfetchborrowratehistories) + +--- + + + +## fetchBorrowRateHistory +retrieves a history of a currencies borrow interest rate at specific time slots + +**Kind**: instance +**Returns**: Array<object> - an array of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | timestamp for the earliest borrow rate | +| limit | int | No | the maximum number of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchborrowratehistory) +* [bybit](/exchanges/bybit.md#bybitfetchborrowratehistory) +* [kucoin](/exchanges/kucoin.md#kucoinfetchborrowratehistory) +* [okx](/exchanges/okx.md#okxfetchborrowratehistory) + +--- + + + +## fetchCanceledAndClosedOrders +fetches information on multiple canceled orders made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch orders in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to fetch portfolio margin account trigger or conditional orders | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchcanceledandclosedorders) +* [bingx](/exchanges/bingx.md#bingxfetchcanceledandclosedorders) +* [bitget](/exchanges/bitget.md#bitgetfetchcanceledandclosedorders) +* [bybit](/exchanges/bybit.md#bybitfetchcanceledandclosedorders) +* [coincatch](/exchanges/coincatch.md#coincatchfetchcanceledandclosedorders) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchcanceledandclosedorders) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchcanceledandclosedorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchcanceledandclosedorders) + +--- + + + +## fetchCanceledOrders +fetches information on multiple canceled orders made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch orders in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to fetch portfolio margin account trigger or conditional orders | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchcanceledorders) +* [bingx](/exchanges/bingx.md#bingxfetchcanceledorders) +* [bitget](/exchanges/bitget.md#bitgetfetchcanceledorders) +* [bitmart](/exchanges/bitmart.md#bitmartfetchcanceledorders) +* [bitteam](/exchanges/bitteam.md#bitteamfetchcanceledorders) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchcanceledorders) +* [bybit](/exchanges/bybit.md#bybitfetchcanceledorders) +* [coinbase](/exchanges/coinbase.md#coinbasefetchcanceledorders) +* [defx](/exchanges/defx.md#defxfetchcanceledorders) +* [derive](/exchanges/derive.md#derivefetchcanceledorders) +* [exmo](/exchanges/exmo.md#exmofetchcanceledorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchcanceledorders) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchcanceledorders) +* [mexc](/exchanges/mexc.md#mexcfetchcanceledorders) +* [okx](/exchanges/okx.md#okxfetchcanceledorders) +* [upbit](/exchanges/upbit.md#upbitfetchcanceledorders) +* [xt](/exchanges/xt.md#xtfetchcanceledorders) + +--- + + + +## fetchClosedOrder +fetch an open order by it's id + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchclosedorder) +* [bybit](/exchanges/bybit.md#bybitfetchclosedorder) +* [cex](/exchanges/cex.md#cexfetchclosedorder) + +--- + + + +## fetchClosedOrders +fetches information on multiple closed orders made by the user + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchclosedorders) +* [ascendex](/exchanges/ascendex.md#ascendexfetchclosedorders) +* [bigone](/exchanges/bigone.md#bigonefetchclosedorders) +* [binance](/exchanges/binance.md#binancefetchclosedorders) +* [bingx](/exchanges/bingx.md#bingxfetchclosedorders) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchclosedorders) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchclosedorders) +* [bitget](/exchanges/bitget.md#bitgetfetchclosedorders) +* [bitmart](/exchanges/bitmart.md#bitmartfetchclosedorders) +* [bitmex](/exchanges/bitmex.md#bitmexfetchclosedorders) +* [bitopro](/exchanges/bitopro.md#bitoprofetchclosedorders) +* [bitrue](/exchanges/bitrue.md#bitruefetchclosedorders) +* [bitteam](/exchanges/bitteam.md#bitteamfetchclosedorders) +* [bittrade](/exchanges/bittrade.md#bittradefetchclosedorders) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchclosedorders) +* [blofin](/exchanges/blofin.md#blofinfetchclosedorders) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchclosedorders) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchclosedorders) +* [bybit](/exchanges/bybit.md#bybitfetchclosedorders) +* [cex](/exchanges/cex.md#cexfetchclosedorders) +* [coinbase](/exchanges/coinbase.md#coinbasefetchclosedorders) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchclosedorders) +* [coinex](/exchanges/coinex.md#coinexfetchclosedorders) +* [coinsph](/exchanges/coinsph.md#coinsphfetchclosedorders) +* [defx](/exchanges/defx.md#defxfetchclosedorders) +* [delta](/exchanges/delta.md#deltafetchclosedorders) +* [deribit](/exchanges/deribit.md#deribitfetchclosedorders) +* [derive](/exchanges/derive.md#derivefetchclosedorders) +* [foxbit](/exchanges/foxbit.md#foxbitfetchclosedorders) +* [gate](/exchanges/gate.md#gatefetchclosedorders) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchclosedorders) +* [hollaex](/exchanges/hollaex.md#hollaexfetchclosedorders) +* [htx](/exchanges/htx.md#htxfetchclosedorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchclosedorders) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchclosedorders) +* [indodax](/exchanges/indodax.md#indodaxfetchclosedorders) +* [kraken](/exchanges/kraken.md#krakenfetchclosedorders) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchclosedorders) +* [kucoin](/exchanges/kucoin.md#kucoinfetchclosedorders) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchclosedorders) +* [luno](/exchanges/luno.md#lunofetchclosedorders) +* [mexc](/exchanges/mexc.md#mexcfetchclosedorders) +* [modetrade](/exchanges/modetrade.md#modetradefetchclosedorders) +* [novadax](/exchanges/novadax.md#novadaxfetchclosedorders) +* [oceanex](/exchanges/oceanex.md#oceanexfetchclosedorders) +* [okcoin](/exchanges/okcoin.md#okcoinfetchclosedorders) +* [okx](/exchanges/okx.md#okxfetchclosedorders) +* [onetrading](/exchanges/onetrading.md#onetradingfetchclosedorders) +* [p2b](/exchanges/p2b.md#p2bfetchclosedorders) +* [phemex](/exchanges/phemex.md#phemexfetchclosedorders) +* [poloniex](/exchanges/poloniex.md#poloniexfetchclosedorders) +* [probit](/exchanges/probit.md#probitfetchclosedorders) +* [timex](/exchanges/timex.md#timexfetchclosedorders) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchclosedorders) +* [toobit](/exchanges/toobit.md#toobitfetchclosedorders) +* [upbit](/exchanges/upbit.md#upbitfetchclosedorders) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchclosedorders) +* [whitebit](/exchanges/whitebit.md#whitebitfetchclosedorders) +* [woo](/exchanges/woo.md#woofetchclosedorders) +* [woofipro](/exchanges/woofipro.md#woofiprofetchclosedorders) +* [xt](/exchanges/xt.md#xtfetchclosedorders) +* [zaif](/exchanges/zaif.md#zaiffetchclosedorders) + +--- + + + +## fetchClosedOrdersWs +fetches information on multiple closed orders made by the user + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gatefetchclosedordersws) + +--- + + + +## fetchConvertCurrencies +fetches all available currencies that can be converted + +**Kind**: instance +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchconvertcurrencies) +* [bitget](/exchanges/bitget.md#bitgetfetchconvertcurrencies) +* [bybit](/exchanges/bybit.md#bybitfetchconvertcurrencies) +* [okx](/exchanges/okx.md#okxfetchconvertcurrencies) +* [woo](/exchanges/woo.md#woofetchconvertcurrencies) + +--- + + + +## fetchConvertQuote +fetch a quote for converting from one currency to another + +**Kind**: instance +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | Yes | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.walletType | string | No | either 'SPOT' or 'FUNDING', the default is 'SPOT' | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchconvertquote) +* [bitget](/exchanges/bitget.md#bitgetfetchconvertquote) +* [bybit](/exchanges/bybit.md#bybitfetchconvertquote) +* [coinbase](/exchanges/coinbase.md#coinbasefetchconvertquote) +* [okx](/exchanges/okx.md#okxfetchconvertquote) +* [phemex](/exchanges/phemex.md#phemexfetchconvertquote) +* [whitebit](/exchanges/whitebit.md#whitebitfetchconvertquote) +* [woo](/exchanges/woo.md#woofetchconvertquote) + +--- + + + +## fetchConvertTrade +fetch the data for a conversion trade + +**Kind**: instance +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to fetch | +| code | string | No | the unified currency code of the conversion trade | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchconverttrade) +* [bybit](/exchanges/bybit.md#bybitfetchconverttrade) +* [coinbase](/exchanges/coinbase.md#coinbasefetchconverttrade) +* [okx](/exchanges/okx.md#okxfetchconverttrade) +* [woo](/exchanges/woo.md#woofetchconverttrade) + +--- + + + +## fetchConvertTradeHistory +fetch the users history of conversion trades + +**Kind**: instance +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest conversion to fetch | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchconverttradehistory) +* [bitget](/exchanges/bitget.md#bitgetfetchconverttradehistory) +* [bybit](/exchanges/bybit.md#bybitfetchconverttradehistory) +* [okx](/exchanges/okx.md#okxfetchconverttradehistory) +* [phemex](/exchanges/phemex.md#phemexfetchconverttradehistory) +* [whitebit](/exchanges/whitebit.md#whitebitfetchconverttradehistory) +* [woo](/exchanges/woo.md#woofetchconverttradehistory) + +--- + + + +## fetchCrossBorrowRate +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance +**Returns**: object - a [borrow rate structure](https://docs.ccxt.com/#/?id=borrow-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchcrossborrowrate) +* [bitget](/exchanges/bitget.md#bitgetfetchcrossborrowrate) +* [bybit](/exchanges/bybit.md#bybitfetchcrossborrowrate) +* [digifinex](/exchanges/digifinex.md#digifinexfetchcrossborrowrate) +* [okx](/exchanges/okx.md#okxfetchcrossborrowrate) +* [whitebit](/exchanges/whitebit.md#whitebitfetchcrossborrowrate) + +--- + + + +## fetchCrossBorrowRates +fetch the borrow interest rates of all currencies + +**Kind**: instance +**Returns**: object - a list of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [digifinex](/exchanges/digifinex.md#digifinexfetchcrossborrowrates) +* [okx](/exchanges/okx.md#okxfetchcrossborrowrates) + +--- + + + +## fetchCurrencies +fetches all available currencies on an exchange + +**Kind**: instance +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexfetchcurrencies) +* [ascendex](/exchanges/ascendex.md#ascendexfetchcurrencies) +* [backpack](/exchanges/backpack.md#backpackfetchcurrencies) +* [bigone](/exchanges/bigone.md#bigonefetchcurrencies) +* [binance](/exchanges/binance.md#binancefetchcurrencies) +* [bingx](/exchanges/bingx.md#bingxfetchcurrencies) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchcurrencies) +* [bitget](/exchanges/bitget.md#bitgetfetchcurrencies) +* [bitmart](/exchanges/bitmart.md#bitmartfetchcurrencies) +* [bitmex](/exchanges/bitmex.md#bitmexfetchcurrencies) +* [bitopro](/exchanges/bitopro.md#bitoprofetchcurrencies) +* [bitrue](/exchanges/bitrue.md#bitruefetchcurrencies) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchcurrencies) +* [bitteam](/exchanges/bitteam.md#bitteamfetchcurrencies) +* [bittrade](/exchanges/bittrade.md#bittradefetchcurrencies) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchcurrencies) +* [bybit](/exchanges/bybit.md#bybitfetchcurrencies) +* [cex](/exchanges/cex.md#cexfetchcurrencies) +* [coinbase](/exchanges/coinbase.md#coinbasefetchcurrencies) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchcurrencies) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchcurrencies) +* [coincatch](/exchanges/coincatch.md#coincatchfetchcurrencies) +* [coinex](/exchanges/coinex.md#coinexfetchcurrencies) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchcurrencies) +* [coinone](/exchanges/coinone.md#coinonefetchcurrencies) +* [coinsph](/exchanges/coinsph.md#coinsphfetchcurrencies) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchcurrencies) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchcurrencies) +* [delta](/exchanges/delta.md#deltafetchcurrencies) +* [deribit](/exchanges/deribit.md#deribitfetchcurrencies) +* [derive](/exchanges/derive.md#derivefetchcurrencies) +* [digifinex](/exchanges/digifinex.md#digifinexfetchcurrencies) +* [exmo](/exchanges/exmo.md#exmofetchcurrencies) +* [gate](/exchanges/gate.md#gatefetchcurrencies) +* [gemini](/exchanges/gemini.md#geminifetchcurrencies) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchcurrencies) +* [hibachi](/exchanges/hibachi.md#hibachifetchcurrencies) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchcurrencies) +* [hollaex](/exchanges/hollaex.md#hollaexfetchcurrencies) +* [htx](/exchanges/htx.md#htxfetchcurrencies) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchcurrencies) +* [kraken](/exchanges/kraken.md#krakenfetchcurrencies) +* [kucoin](/exchanges/kucoin.md#kucoinfetchcurrencies) +* [latoken](/exchanges/latoken.md#latokenfetchcurrencies) +* [lbank](/exchanges/lbank.md#lbankfetchcurrencies) +* [luno](/exchanges/luno.md#lunofetchcurrencies) +* [mexc](/exchanges/mexc.md#mexcfetchcurrencies) +* [modetrade](/exchanges/modetrade.md#modetradefetchcurrencies) +* [ndax](/exchanges/ndax.md#ndaxfetchcurrencies) +* [okcoin](/exchanges/okcoin.md#okcoinfetchcurrencies) +* [okx](/exchanges/okx.md#okxfetchcurrencies) +* [onetrading](/exchanges/onetrading.md#onetradingfetchcurrencies) +* [oxfun](/exchanges/oxfun.md#oxfunfetchcurrencies) +* [phemex](/exchanges/phemex.md#phemexfetchcurrencies) +* [poloniex](/exchanges/poloniex.md#poloniexfetchcurrencies) +* [probit](/exchanges/probit.md#probitfetchcurrencies) +* [timex](/exchanges/timex.md#timexfetchcurrencies) +* [toobit](/exchanges/toobit.md#toobitfetchcurrencies) +* [whitebit](/exchanges/whitebit.md#whitebitfetchcurrencies) +* [woo](/exchanges/woo.md#woofetchcurrencies) +* [woofipro](/exchanges/woofipro.md#woofiprofetchcurrencies) +* [xt](/exchanges/xt.md#xtfetchcurrencies) + +--- + + + +## fetchCurrenciesWs +fetches all available currencies on an exchange + +**Kind**: instance +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchcurrenciesws) + +--- + + + +## fetchDeposit +fetch information on a deposit + +**Kind**: instance +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | Yes | not used by bitmart fetchDeposit () | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bitmart](/exchanges/bitmart.md#bitmartfetchdeposit) +* [bitso](/exchanges/bitso.md#bitsofetchdeposit) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchdeposit) +* [coinbase](/exchanges/coinbase.md#coinbasefetchdeposit) +* [exmo](/exchanges/exmo.md#exmofetchdeposit) +* [okx](/exchanges/okx.md#okxfetchdeposit) +* [upbit](/exchanges/upbit.md#upbitfetchdeposit) +* [whitebit](/exchanges/whitebit.md#whitebitfetchdeposit) + +--- + + + +## fetchDepositAddress +fetch the deposit address for a currency associated with this account + +**Kind**: instance +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchdepositaddress) +* [ascendex](/exchanges/ascendex.md#ascendexfetchdepositaddress) +* [backpack](/exchanges/backpack.md#backpackfetchdepositaddress) +* [bigone](/exchanges/bigone.md#bigonefetchdepositaddress) +* [binance](/exchanges/binance.md#binancefetchdepositaddress) +* [bingx](/exchanges/bingx.md#bingxfetchdepositaddress) +* [bit2c](/exchanges/bit2c.md#bit2cfetchdepositaddress) +* [bitbank](/exchanges/bitbank.md#bitbankfetchdepositaddress) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchdepositaddress) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchdepositaddress) +* [bitget](/exchanges/bitget.md#bitgetfetchdepositaddress) +* [bitmart](/exchanges/bitmart.md#bitmartfetchdepositaddress) +* [bitmex](/exchanges/bitmex.md#bitmexfetchdepositaddress) +* [bitso](/exchanges/bitso.md#bitsofetchdepositaddress) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchdepositaddress) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchdepositaddress) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchdepositaddress) +* [bybit](/exchanges/bybit.md#bybitfetchdepositaddress) +* [cex](/exchanges/cex.md#cexfetchdepositaddress) +* [coinbase](/exchanges/coinbase.md#coinbasefetchdepositaddress) +* [coincatch](/exchanges/coincatch.md#coincatchfetchdepositaddress) +* [coinex](/exchanges/coinex.md#coinexfetchdepositaddress) +* [coinsph](/exchanges/coinsph.md#coinsphfetchdepositaddress) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchdepositaddress) +* [delta](/exchanges/delta.md#deltafetchdepositaddress) +* [deribit](/exchanges/deribit.md#deribitfetchdepositaddress) +* [digifinex](/exchanges/digifinex.md#digifinexfetchdepositaddress) +* [exmo](/exchanges/exmo.md#exmofetchdepositaddress) +* [foxbit](/exchanges/foxbit.md#foxbitfetchdepositaddress) +* [gate](/exchanges/gate.md#gatefetchdepositaddress) +* [gemini](/exchanges/gemini.md#geminifetchdepositaddress) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchdepositaddress) +* [hibachi](/exchanges/hibachi.md#hibachifetchdepositaddress) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchdepositaddress) +* [htx](/exchanges/htx.md#htxfetchdepositaddress) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchdepositaddress) +* [kraken](/exchanges/kraken.md#krakenfetchdepositaddress) +* [kucoin](/exchanges/kucoin.md#kucoinfetchdepositaddress) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchdepositaddress) +* [lbank](/exchanges/lbank.md#lbankfetchdepositaddress) +* [luno](/exchanges/luno.md#lunofetchdepositaddress) +* [mexc](/exchanges/mexc.md#mexcfetchdepositaddress) +* [ndax](/exchanges/ndax.md#ndaxfetchdepositaddress) +* [okcoin](/exchanges/okcoin.md#okcoinfetchdepositaddress) +* [okx](/exchanges/okx.md#okxfetchdepositaddress) +* [oxfun](/exchanges/oxfun.md#oxfunfetchdepositaddress) +* [paymium](/exchanges/paymium.md#paymiumfetchdepositaddress) +* [phemex](/exchanges/phemex.md#phemexfetchdepositaddress) +* [poloniex](/exchanges/poloniex.md#poloniexfetchdepositaddress) +* [probit](/exchanges/probit.md#probitfetchdepositaddress) +* [timex](/exchanges/timex.md#timexfetchdepositaddress) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchdepositaddress) +* [toobit](/exchanges/toobit.md#toobitfetchdepositaddress) +* [upbit](/exchanges/upbit.md#upbitfetchdepositaddress) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchdepositaddress) +* [whitebit](/exchanges/whitebit.md#whitebitfetchdepositaddress) +* [woo](/exchanges/woo.md#woofetchdepositaddress) +* [xt](/exchanges/xt.md#xtfetchdepositaddress) +* [yobit](/exchanges/yobit.md#yobitfetchdepositaddress) +* [zonda](/exchanges/zonda.md#zondafetchdepositaddress) + +--- + + + +## fetchDepositAddresses +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coinone](/exchanges/coinone.md#coinonefetchdepositaddresses) +* [hollaex](/exchanges/hollaex.md#hollaexfetchdepositaddresses) +* [indodax](/exchanges/indodax.md#indodaxfetchdepositaddresses) +* [paymium](/exchanges/paymium.md#paymiumfetchdepositaddresses) +* [probit](/exchanges/probit.md#probitfetchdepositaddresses) +* [upbit](/exchanges/upbit.md#upbitfetchdepositaddresses) +* [zonda](/exchanges/zonda.md#zondafetchdepositaddresses) + +--- + + + +## fetchDepositAddressesByNetwork +fetch the deposit addresses for a currency associated with this account + +**Kind**: instance +**Returns**: object - a dictionary [address structures](https://docs.ccxt.com/#/?id=address-structure), indexed by the network + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bingx](/exchanges/bingx.md#bingxfetchdepositaddressesbynetwork) +* [bybit](/exchanges/bybit.md#bybitfetchdepositaddressesbynetwork) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchdepositaddressesbynetwork) +* [gate](/exchanges/gate.md#gatefetchdepositaddressesbynetwork) +* [gemini](/exchanges/gemini.md#geminifetchdepositaddressesbynetwork) +* [htx](/exchanges/htx.md#htxfetchdepositaddressesbynetwork) +* [kucoin](/exchanges/kucoin.md#kucoinfetchdepositaddressesbynetwork) +* [mexc](/exchanges/mexc.md#mexcfetchdepositaddressesbynetwork) +* [oceanex](/exchanges/oceanex.md#oceanexfetchdepositaddressesbynetwork) +* [okcoin](/exchanges/okcoin.md#okcoinfetchdepositaddressesbynetwork) +* [okx](/exchanges/okx.md#okxfetchdepositaddressesbynetwork) + +--- + + + +## fetchDepositMethodId +fetch the deposit id for a fiat currency associated with this account + +**Kind**: instance +**Returns**: object - a [deposit id structure](https://docs.ccxt.com/#/?id=deposit-id-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the deposit payment method id | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coinbase](/exchanges/coinbase.md#coinbasefetchdepositmethodid) + +--- + + + +## fetchDepositMethodIds +fetch the deposit id for a fiat currency associated with this account + +**Kind**: instance +**Returns**: object - an array of [deposit id structures](https://docs.ccxt.com/#/?id=deposit-id-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coinbase](/exchanges/coinbase.md#coinbasefetchdepositmethodids) + +--- + + + +## fetchDepositMethods +fetch deposit methods for a currency associated with this account + +**Kind**: instance +**Returns**: object - of deposit methods + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the kraken api endpoint | + +##### Supported exchanges +* [kraken](/exchanges/kraken.md#krakenfetchdepositmethods) + +--- + + + +## fetchDepositWithdrawFee +fetch the fee for deposits and withdrawals + +**Kind**: instance +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the network code of the currency | + +##### Supported exchanges +* [bitmart](/exchanges/bitmart.md#bitmartfetchdepositwithdrawfee) +* [coinex](/exchanges/coinex.md#coinexfetchdepositwithdrawfee) +* [kucoin](/exchanges/kucoin.md#kucoinfetchdepositwithdrawfee) + +--- + + + +## fetchDepositWithdrawFees +fetch deposit and withdraw fees + +**Kind**: instance +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexfetchdepositwithdrawfees) +* [binance](/exchanges/binance.md#binancefetchdepositwithdrawfees) +* [bingx](/exchanges/bingx.md#bingxfetchdepositwithdrawfees) +* [bitget](/exchanges/bitget.md#bitgetfetchdepositwithdrawfees) +* [bitmex](/exchanges/bitmex.md#bitmexfetchdepositwithdrawfees) +* [bitopro](/exchanges/bitopro.md#bitoprofetchdepositwithdrawfees) +* [bitrue](/exchanges/bitrue.md#bitruefetchdepositwithdrawfees) +* [bitso](/exchanges/bitso.md#bitsofetchdepositwithdrawfees) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchdepositwithdrawfees) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchdepositwithdrawfees) +* [bybit](/exchanges/bybit.md#bybitfetchdepositwithdrawfees) +* [coincatch](/exchanges/coincatch.md#coincatchfetchdepositwithdrawfees) +* [coinex](/exchanges/coinex.md#coinexfetchdepositwithdrawfees) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchdepositwithdrawfees) +* [deribit](/exchanges/deribit.md#deribitfetchdepositwithdrawfees) +* [digifinex](/exchanges/digifinex.md#digifinexfetchdepositwithdrawfees) +* [exmo](/exchanges/exmo.md#exmofetchdepositwithdrawfees) +* [gate](/exchanges/gate.md#gatefetchdepositwithdrawfees) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchdepositwithdrawfees) +* [hollaex](/exchanges/hollaex.md#hollaexfetchdepositwithdrawfees) +* [htx](/exchanges/htx.md#htxfetchdepositwithdrawfees) +* [kucoin](/exchanges/kucoin.md#kucoinfetchdepositwithdrawfees) +* [lbank](/exchanges/lbank.md#lbankfetchdepositwithdrawfees) +* [mexc](/exchanges/mexc.md#mexcfetchdepositwithdrawfees) +* [okx](/exchanges/okx.md#okxfetchdepositwithdrawfees) +* [poloniex](/exchanges/poloniex.md#poloniexfetchdepositwithdrawfees) +* [probit](/exchanges/probit.md#probitfetchdepositwithdrawfees) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchdepositwithdrawfees) +* [whitebit](/exchanges/whitebit.md#whitebitfetchdepositwithdrawfees) + +--- + + + +## fetchDeposits +fetch all deposits made to an account + +**Kind**: instance +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposit structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchdeposits) +* [ascendex](/exchanges/ascendex.md#ascendexfetchdeposits) +* [backpack](/exchanges/backpack.md#backpackfetchdeposits) +* [bigone](/exchanges/bigone.md#bigonefetchdeposits) +* [binance](/exchanges/binance.md#binancefetchdeposits) +* [bingx](/exchanges/bingx.md#bingxfetchdeposits) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchdeposits) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchdeposits) +* [bitget](/exchanges/bitget.md#bitgetfetchdeposits) +* [bitmart](/exchanges/bitmart.md#bitmartfetchdeposits) +* [bitopro](/exchanges/bitopro.md#bitoprofetchdeposits) +* [bitrue](/exchanges/bitrue.md#bitruefetchdeposits) +* [bitso](/exchanges/bitso.md#bitsofetchdeposits) +* [bittrade](/exchanges/bittrade.md#bittradefetchdeposits) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchdeposits) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchdeposits) +* [blofin](/exchanges/blofin.md#blofinfetchdeposits) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchdeposits) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchdeposits) +* [bybit](/exchanges/bybit.md#bybitfetchdeposits) +* [coinbase](/exchanges/coinbase.md#coinbasefetchdeposits) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchdeposits) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchdeposits) +* [coincatch](/exchanges/coincatch.md#coincatchfetchdeposits) +* [coincheck](/exchanges/coincheck.md#coincheckfetchdeposits) +* [coinex](/exchanges/coinex.md#coinexfetchdeposits) +* [coinsph](/exchanges/coinsph.md#coinsphfetchdeposits) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchdeposits) +* [deribit](/exchanges/deribit.md#deribitfetchdeposits) +* [derive](/exchanges/derive.md#derivefetchdeposits) +* [digifinex](/exchanges/digifinex.md#digifinexfetchdeposits) +* [exmo](/exchanges/exmo.md#exmofetchdeposits) +* [foxbit](/exchanges/foxbit.md#foxbitfetchdeposits) +* [gate](/exchanges/gate.md#gatefetchdeposits) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchdeposits) +* [hibachi](/exchanges/hibachi.md#hibachifetchdeposits) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchdeposits) +* [hollaex](/exchanges/hollaex.md#hollaexfetchdeposits) +* [htx](/exchanges/htx.md#htxfetchdeposits) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchdeposits) +* [kraken](/exchanges/kraken.md#krakenfetchdeposits) +* [kucoin](/exchanges/kucoin.md#kucoinfetchdeposits) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchdeposits) +* [lbank](/exchanges/lbank.md#lbankfetchdeposits) +* [mexc](/exchanges/mexc.md#mexcfetchdeposits) +* [modetrade](/exchanges/modetrade.md#modetradefetchdeposits) +* [ndax](/exchanges/ndax.md#ndaxfetchdeposits) +* [novadax](/exchanges/novadax.md#novadaxfetchdeposits) +* [okcoin](/exchanges/okcoin.md#okcoinfetchdeposits) +* [okx](/exchanges/okx.md#okxfetchdeposits) +* [oxfun](/exchanges/oxfun.md#oxfunfetchdeposits) +* [phemex](/exchanges/phemex.md#phemexfetchdeposits) +* [poloniex](/exchanges/poloniex.md#poloniexfetchdeposits) +* [probit](/exchanges/probit.md#probitfetchdeposits) +* [timex](/exchanges/timex.md#timexfetchdeposits) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchdeposits) +* [toobit](/exchanges/toobit.md#toobitfetchdeposits) +* [upbit](/exchanges/upbit.md#upbitfetchdeposits) +* [whitebit](/exchanges/whitebit.md#whitebitfetchdeposits) +* [woo](/exchanges/woo.md#woofetchdeposits) +* [woofipro](/exchanges/woofipro.md#woofiprofetchdeposits) +* [xt](/exchanges/xt.md#xtfetchdeposits) + +--- + + + +## fetchDepositsWithdrawals +fetch history of deposits and withdrawals + +**Kind**: instance +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchdepositswithdrawals) +* [ascendex](/exchanges/ascendex.md#ascendexfetchdepositswithdrawals) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchdepositswithdrawals) +* [bitmex](/exchanges/bitmex.md#bitmexfetchdepositswithdrawals) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchdepositswithdrawals) +* [bitteam](/exchanges/bitteam.md#bitteamfetchdepositswithdrawals) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchdepositswithdrawals) +* [cex](/exchanges/cex.md#cexfetchdepositswithdrawals) +* [coinbase](/exchanges/coinbase.md#coinbasefetchdepositswithdrawals) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchdepositswithdrawals) +* [exchange](/exchanges/exchange.md#exchangefetchdepositswithdrawals) +* [coinmate](/exchanges/coinmate.md#coinmatefetchdepositswithdrawals) +* [exmo](/exchanges/exmo.md#exmofetchdepositswithdrawals) +* [gemini](/exchanges/gemini.md#geminifetchdepositswithdrawals) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchdepositswithdrawals) +* [indodax](/exchanges/indodax.md#indodaxfetchdepositswithdrawals) +* [modetrade](/exchanges/modetrade.md#modetradefetchdepositswithdrawals) +* [novadax](/exchanges/novadax.md#novadaxfetchdepositswithdrawals) +* [poloniex](/exchanges/poloniex.md#poloniexfetchdepositswithdrawals) +* [probit](/exchanges/probit.md#probitfetchdepositswithdrawals) +* [whitebit](/exchanges/whitebit.md#whitebitfetchdepositswithdrawals) +* [woo](/exchanges/woo.md#woofetchdepositswithdrawals) +* [woofipro](/exchanges/woofipro.md#woofiprofetchdepositswithdrawals) + +--- + + + +## fetchDepositsWs +fetch all deposits made to an account + +**Kind**: instance +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchdepositsws) + +--- + + + +## fetchFundingHistory +fetches information on multiple orders made by the user *classic accounts only* + +**Kind**: instance +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=funding-history-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve, default 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | object | No | end time, ms | +| params.side | boolean | No | BUY or SELL | +| params.page | boolean | No | Page numbers start from 0 | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexfetchfundinghistory) +* [ascendex](/exchanges/ascendex.md#ascendexfetchfundinghistory) +* [backpack](/exchanges/backpack.md#backpackfetchfundinghistory) +* [binance](/exchanges/binance.md#binancefetchfundinghistory) +* [bitget](/exchanges/bitget.md#bitgetfetchfundinghistory) +* [bitmart](/exchanges/bitmart.md#bitmartfetchfundinghistory) +* [bybit](/exchanges/bybit.md#bybitfetchfundinghistory) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchfundinghistory) +* [coinex](/exchanges/coinex.md#coinexfetchfundinghistory) +* [derive](/exchanges/derive.md#derivefetchfundinghistory) +* [digifinex](/exchanges/digifinex.md#digifinexfetchfundinghistory) +* [gate](/exchanges/gate.md#gatefetchfundinghistory) +* [htx](/exchanges/htx.md#htxfetchfundinghistory) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchfundinghistory) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchfundinghistory) +* [mexc](/exchanges/mexc.md#mexcfetchfundinghistory) +* [modetrade](/exchanges/modetrade.md#modetradefetchfundinghistory) +* [okx](/exchanges/okx.md#okxfetchfundinghistory) +* [oxfun](/exchanges/oxfun.md#oxfunfetchfundinghistory) +* [phemex](/exchanges/phemex.md#phemexfetchfundinghistory) +* [whitebit](/exchanges/whitebit.md#whitebitfetchfundinghistory) +* [woo](/exchanges/woo.md#woofetchfundinghistory) +* [woofipro](/exchanges/woofipro.md#woofiprofetchfundinghistory) +* [xt](/exchanges/xt.md#xtfetchfundinghistory) + +--- + + + +## fetchFundingInterval +fetch the current funding rate interval + +**Kind**: instance +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + +##### Supported exchanges +* [bitget](/exchanges/bitget.md#bitgetfetchfundinginterval) +* [coinex](/exchanges/coinex.md#coinexfetchfundinginterval) +* [digifinex](/exchanges/digifinex.md#digifinexfetchfundinginterval) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchfundinginterval) +* [mexc](/exchanges/mexc.md#mexcfetchfundinginterval) +* [modetrade](/exchanges/modetrade.md#modetradefetchfundinginterval) +* [okx](/exchanges/okx.md#okxfetchfundinginterval) +* [woo](/exchanges/woo.md#woofetchfundinginterval) +* [woofipro](/exchanges/woofipro.md#woofiprofetchfundinginterval) +* [xt](/exchanges/xt.md#xtfetchfundinginterval) + +--- + + + +## fetchFundingIntervals +fetch the funding rate interval for multiple markets + +**Kind**: instance +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchfundingintervals) + +--- + + + +## fetchFundingRate +fetch the current funding rate + +**Kind**: instance +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackfetchfundingrate) +* [binance](/exchanges/binance.md#binancefetchfundingrate) +* [bingx](/exchanges/bingx.md#bingxfetchfundingrate) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchfundingrate) +* [bitget](/exchanges/bitget.md#bitgetfetchfundingrate) +* [bitmart](/exchanges/bitmart.md#bitmartfetchfundingrate) +* [blofin](/exchanges/blofin.md#blofinfetchfundingrate) +* [coincatch](/exchanges/coincatch.md#coincatchfetchfundingrate) +* [coinex](/exchanges/coinex.md#coinexfetchfundingrate) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchfundingrate) +* [defx](/exchanges/defx.md#defxfetchfundingrate) +* [delta](/exchanges/delta.md#deltafetchfundingrate) +* [deribit](/exchanges/deribit.md#deribitfetchfundingrate) +* [derive](/exchanges/derive.md#derivefetchfundingrate) +* [digifinex](/exchanges/digifinex.md#digifinexfetchfundingrate) +* [gate](/exchanges/gate.md#gatefetchfundingrate) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchfundingrate) +* [hibachi](/exchanges/hibachi.md#hibachifetchfundingrate) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchfundingrate) +* [htx](/exchanges/htx.md#htxfetchfundingrate) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchfundingrate) +* [lbank](/exchanges/lbank.md#lbankfetchfundingrate) +* [mexc](/exchanges/mexc.md#mexcfetchfundingrate) +* [modetrade](/exchanges/modetrade.md#modetradefetchfundingrate) +* [okx](/exchanges/okx.md#okxfetchfundingrate) +* [oxfun](/exchanges/oxfun.md#oxfunfetchfundingrate) +* [phemex](/exchanges/phemex.md#phemexfetchfundingrate) +* [whitebit](/exchanges/whitebit.md#whitebitfetchfundingrate) +* [woo](/exchanges/woo.md#woofetchfundingrate) +* [woofipro](/exchanges/woofipro.md#woofiprofetchfundingrate) +* [xt](/exchanges/xt.md#xtfetchfundingrate) + +--- + + + +## fetchFundingRateHistory +fetches historical funding rate prices + +**Kind**: instance +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexfetchfundingratehistory) +* [backpack](/exchanges/backpack.md#backpackfetchfundingratehistory) +* [binance](/exchanges/binance.md#binancefetchfundingratehistory) +* [bingx](/exchanges/bingx.md#bingxfetchfundingratehistory) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchfundingratehistory) +* [bitget](/exchanges/bitget.md#bitgetfetchfundingratehistory) +* [bitmart](/exchanges/bitmart.md#bitmartfetchfundingratehistory) +* [bitmex](/exchanges/bitmex.md#bitmexfetchfundingratehistory) +* [blofin](/exchanges/blofin.md#blofinfetchfundingratehistory) +* [bybit](/exchanges/bybit.md#bybitfetchfundingratehistory) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchfundingratehistory) +* [coincatch](/exchanges/coincatch.md#coincatchfetchfundingratehistory) +* [coinex](/exchanges/coinex.md#coinexfetchfundingratehistory) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchfundingratehistory) +* [deribit](/exchanges/deribit.md#deribitfetchfundingratehistory) +* [derive](/exchanges/derive.md#derivefetchfundingratehistory) +* [digifinex](/exchanges/digifinex.md#digifinexfetchfundingratehistory) +* [gate](/exchanges/gate.md#gatefetchfundingratehistory) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchfundingratehistory) +* [hibachi](/exchanges/hibachi.md#hibachifetchfundingratehistory) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchfundingratehistory) +* [htx](/exchanges/htx.md#htxfetchfundingratehistory) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchfundingratehistory) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchfundingratehistory) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchfundingratehistory) +* [mexc](/exchanges/mexc.md#mexcfetchfundingratehistory) +* [modetrade](/exchanges/modetrade.md#modetradefetchfundingratehistory) +* [okx](/exchanges/okx.md#okxfetchfundingratehistory) +* [oxfun](/exchanges/oxfun.md#oxfunfetchfundingratehistory) +* [phemex](/exchanges/phemex.md#phemexfetchfundingratehistory) +* [toobit](/exchanges/toobit.md#toobitfetchfundingratehistory) +* [woo](/exchanges/woo.md#woofetchfundingratehistory) +* [woofipro](/exchanges/woofipro.md#woofiprofetchfundingratehistory) +* [xt](/exchanges/xt.md#xtfetchfundingratehistory) + +--- + + + +## fetchFundingRates +fetch the funding rate for multiple markets + +**Kind**: instance +**Returns**: Array<object> - a list of [funding rates structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexe by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexfetchfundingrates) +* [binance](/exchanges/binance.md#binancefetchfundingrates) +* [bingx](/exchanges/bingx.md#bingxfetchfundingrates) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchfundingrates) +* [bitget](/exchanges/bitget.md#bitgetfetchfundingrates) +* [bitmex](/exchanges/bitmex.md#bitmexfetchfundingrates) +* [bybit](/exchanges/bybit.md#bybitfetchfundingrates) +* [coinex](/exchanges/coinex.md#coinexfetchfundingrates) +* [delta](/exchanges/delta.md#deltafetchfundingrates) +* [gate](/exchanges/gate.md#gatefetchfundingrates) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchfundingrates) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchfundingrates) +* [htx](/exchanges/htx.md#htxfetchfundingrates) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchfundingrates) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchfundingrates) +* [lbank](/exchanges/lbank.md#lbankfetchfundingrates) +* [modetrade](/exchanges/modetrade.md#modetradefetchfundingrates) +* [okx](/exchanges/okx.md#okxfetchfundingrates) +* [oxfun](/exchanges/oxfun.md#oxfunfetchfundingrates) +* [toobit](/exchanges/toobit.md#toobitfetchfundingrates) +* [whitebit](/exchanges/whitebit.md#whitebitfetchfundingrates) +* [woo](/exchanges/woo.md#woofetchfundingrates) +* [woofipro](/exchanges/woofipro.md#woofiprofetchfundingrates) + +--- + + + +## fetchGreeks +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchgreeks) +* [bybit](/exchanges/bybit.md#bybitfetchgreeks) +* [delta](/exchanges/delta.md#deltafetchgreeks) +* [deribit](/exchanges/deribit.md#deribitfetchgreeks) +* [gate](/exchanges/gate.md#gatefetchgreeks) +* [okx](/exchanges/okx.md#okxfetchgreeks) +* [paradex](/exchanges/paradex.md#paradexfetchgreeks) + +--- + + + +## fetchIsolatedBorrowRate +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance +**Returns**: object - an [isolated borrow rate structure](https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.vipLevel | object | No | user's current specific margin data will be returned if viplevel is omitted | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchisolatedborrowrate) +* [bitget](/exchanges/bitget.md#bitgetfetchisolatedborrowrate) +* [bitmart](/exchanges/bitmart.md#bitmartfetchisolatedborrowrate) +* [coinex](/exchanges/coinex.md#coinexfetchisolatedborrowrate) + +--- + + + +## fetchIsolatedBorrowRates +fetch the borrow interest rates of all currencies + +**Kind**: instance +**Returns**: object - a [borrow rate structure](https://docs.ccxt.com/#/?id=borrow-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | object | No | unified market symbol EXCHANGE SPECIFIC PARAMETERS | +| params.vipLevel | object | No | user's current specific margin data will be returned if viplevel is omitted | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchisolatedborrowrates) +* [bitmart](/exchanges/bitmart.md#bitmartfetchisolatedborrowrates) +* [htx](/exchanges/htx.md#htxfetchisolatedborrowrates) + +--- + + + +## fetchL3OrderBook +fetches level 3 information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance +**Returns**: object - an [order book structure](https://docs.ccxt.com/#/?id=order-book-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchl3orderbook) + +--- + + + +## fetchLastPrices +fetches the last price for multiple markets + +**Kind**: instance +**Returns**: object - a dictionary of lastprices structures + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the last prices | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchlastprices) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchlastprices) +* [htx](/exchanges/htx.md#htxfetchlastprices) +* [toobit](/exchanges/toobit.md#toobitfetchlastprices) + +--- + + + +## fetchLedger +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch the ledger for a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchledger) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchledger) +* [bitget](/exchanges/bitget.md#bitgetfetchledger) +* [bitmart](/exchanges/bitmart.md#bitmartfetchledger) +* [bitmex](/exchanges/bitmex.md#bitmexfetchledger) +* [bitso](/exchanges/bitso.md#bitsofetchledger) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchledger) +* [blofin](/exchanges/blofin.md#blofinfetchledger) +* [bybit](/exchanges/bybit.md#bybitfetchledger) +* [cex](/exchanges/cex.md#cexfetchledger) +* [coinbase](/exchanges/coinbase.md#coinbasefetchledger) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchledger) +* [coincatch](/exchanges/coincatch.md#coincatchfetchledger) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchledger) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchledger) +* [defx](/exchanges/defx.md#defxfetchledger) +* [delta](/exchanges/delta.md#deltafetchledger) +* [digifinex](/exchanges/digifinex.md#digifinexfetchledger) +* [foxbit](/exchanges/foxbit.md#foxbitfetchledger) +* [gate](/exchanges/gate.md#gatefetchledger) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchledger) +* [hibachi](/exchanges/hibachi.md#hibachifetchledger) +* [htx](/exchanges/htx.md#htxfetchledger) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchledger) +* [kraken](/exchanges/kraken.md#krakenfetchledger) +* [kucoin](/exchanges/kucoin.md#kucoinfetchledger) +* [luno](/exchanges/luno.md#lunofetchledger) +* [modetrade](/exchanges/modetrade.md#modetradefetchledger) +* [ndax](/exchanges/ndax.md#ndaxfetchledger) +* [okcoin](/exchanges/okcoin.md#okcoinfetchledger) +* [okx](/exchanges/okx.md#okxfetchledger) +* [toobit](/exchanges/toobit.md#toobitfetchledger) +* [woo](/exchanges/woo.md#woofetchledger) +* [woofipro](/exchanges/woofipro.md#woofiprofetchledger) +* [xt](/exchanges/xt.md#xtfetchledger) +* [zonda](/exchanges/zonda.md#zondafetchledger) + +--- + + + +## fetchLedgerEntry +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the identification number of the ledger entry | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchledgerentry) + +--- + + + +## fetchLeverage +fetch the set leverage for a market + +**Kind**: instance +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bingx](/exchanges/bingx.md#bingxfetchleverage) +* [bitget](/exchanges/bitget.md#bitgetfetchleverage) +* [blofin](/exchanges/blofin.md#blofinfetchleverage) +* [bybit](/exchanges/bybit.md#bybitfetchleverage) +* [coincatch](/exchanges/coincatch.md#coincatchfetchleverage) +* [coinex](/exchanges/coinex.md#coinexfetchleverage) +* [delta](/exchanges/delta.md#deltafetchleverage) +* [gate](/exchanges/gate.md#gatefetchleverage) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchleverage) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchleverage) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchleverage) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchleverage) +* [mexc](/exchanges/mexc.md#mexcfetchleverage) +* [modetrade](/exchanges/modetrade.md#modetradefetchleverage) +* [okx](/exchanges/okx.md#okxfetchleverage) +* [paradex](/exchanges/paradex.md#paradexfetchleverage) +* [poloniex](/exchanges/poloniex.md#poloniexfetchleverage) +* [toobit](/exchanges/toobit.md#toobitfetchleverage) +* [woo](/exchanges/woo.md#woofetchleverage) +* [woofipro](/exchanges/woofipro.md#woofiprofetchleverage) + +--- + + + +## fetchLeverageTiers +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexfetchleveragetiers) +* [binance](/exchanges/binance.md#binancefetchleveragetiers) +* [bybit](/exchanges/bybit.md#bybitfetchleveragetiers) +* [coinex](/exchanges/coinex.md#coinexfetchleveragetiers) +* [digifinex](/exchanges/digifinex.md#digifinexfetchleveragetiers) +* [gate](/exchanges/gate.md#gatefetchleveragetiers) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchleveragetiers) +* [htx](/exchanges/htx.md#htxfetchleveragetiers) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchleveragetiers) +* [mexc](/exchanges/mexc.md#mexcfetchleveragetiers) +* [oxfun](/exchanges/oxfun.md#oxfunfetchleveragetiers) +* [phemex](/exchanges/phemex.md#phemexfetchleveragetiers) +* [xt](/exchanges/xt.md#xtfetchleveragetiers) + +--- + + + +## fetchLeverages +fetch the set leverage for all contract markets + +**Kind**: instance +**Returns**: object - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexfetchleverages) +* [binance](/exchanges/binance.md#binancefetchleverages) +* [bitmex](/exchanges/bitmex.md#bitmexfetchleverages) +* [blofin](/exchanges/blofin.md#blofinfetchleverages) +* [gate](/exchanges/gate.md#gatefetchleverages) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchleverages) + +--- + + + +## fetchLiquidations +retrieves the public liquidations of a trading pair + +**Kind**: instance +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + +##### Supported exchanges +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchliquidations) +* [bitmex](/exchanges/bitmex.md#bitmexfetchliquidations) +* [deribit](/exchanges/deribit.md#deribitfetchliquidations) +* [gate](/exchanges/gate.md#gatefetchliquidations) +* [htx](/exchanges/htx.md#htxfetchliquidations) +* [paradex](/exchanges/paradex.md#paradexfetchliquidations) + +--- + + + +## fetchLongShortRatioHistory +fetches the long short ratio history for a unified market symbol + +**Kind**: instance +**Returns**: Array<object> - an array of [long short ratio structures](https://docs.ccxt.com/#/?id=long-short-ratio-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the long short ratio for | +| timeframe | string | No | the period for the ratio, default is 24 hours | +| since | int | No | the earliest time in ms to fetch ratios for | +| limit | int | No | the maximum number of long short ratio structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ratio to fetch | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchlongshortratiohistory) +* [bitget](/exchanges/bitget.md#bitgetfetchlongshortratiohistory) +* [bybit](/exchanges/bybit.md#bybitfetchlongshortratiohistory) +* [okx](/exchanges/okx.md#okxfetchlongshortratiohistory) + +--- + + + +## fetchMarginAdjustmentHistory +fetches the history of margin added or reduced from contract isolated positions + +**Kind**: instance +**Returns**: Array<object> - a list of [margin structures](https://docs.ccxt.com/#/?id=margin-loan-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| type | string | No | "add" or "reduce" | +| since | int | No | timestamp in ms of the earliest change to fetch | +| limit | int | No | the maximum amount of changes to fetch | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | timestamp in ms of the latest change to fetch | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchmarginadjustmenthistory) +* [coinex](/exchanges/coinex.md#coinexfetchmarginadjustmenthistory) +* [okx](/exchanges/okx.md#okxfetchmarginadjustmenthistory) + +--- + + + +## fetchMarginMode +fetches the margin mode of a specific symbol + +**Kind**: instance +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchmarginmode) +* [bingx](/exchanges/bingx.md#bingxfetchmarginmode) +* [bitget](/exchanges/bitget.md#bitgetfetchmarginmode) +* [blofin](/exchanges/blofin.md#blofinfetchmarginmode) +* [coincatch](/exchanges/coincatch.md#coincatchfetchmarginmode) +* [delta](/exchanges/delta.md#deltafetchmarginmode) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchmarginmode) +* [paradex](/exchanges/paradex.md#paradexfetchmarginmode) + +--- + + + +## fetchMarginModes +fetches the set margin mode of the user + +**Kind**: instance +**Returns**: object - a list of [margin mode structures](https://docs.ccxt.com/#/?id=margin-mode-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexfetchmarginmodes) +* [binance](/exchanges/binance.md#binancefetchmarginmodes) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchmarginmodes) + +--- + + + +## fetchMarkPrice +fetches mark price for the market + +**Kind**: instance +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchmarkprice) +* [bingx](/exchanges/bingx.md#bingxfetchmarkprice) +* [bitget](/exchanges/bitget.md#bitgetfetchmarkprice) +* [blofin](/exchanges/blofin.md#blofinfetchmarkprice) +* [defx](/exchanges/defx.md#defxfetchmarkprice) +* [kucoin](/exchanges/kucoin.md#kucoinfetchmarkprice) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchmarkprice) +* [okx](/exchanges/okx.md#okxfetchmarkprice) + +--- + + + +## fetchMarkPrices +fetches mark prices for multiple markets + +**Kind**: instance +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchmarkprices) +* [bingx](/exchanges/bingx.md#bingxfetchmarkprices) +* [kucoin](/exchanges/kucoin.md#kucoinfetchmarkprices) +* [okx](/exchanges/okx.md#okxfetchmarkprices) + +--- + + + +## fetchMarketLeverageTiers +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market + +**Kind**: instance +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | for spot margin 'cross' or 'isolated', default is 'isolated' | +| params.code | string | No | required for cross spot margin | +| params.productType | string | No | *contract and uta only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + +##### Supported exchanges +* [bitget](/exchanges/bitget.md#bitgetfetchmarketleveragetiers) +* [bybit](/exchanges/bybit.md#bybitfetchmarketleveragetiers) +* [digifinex](/exchanges/digifinex.md#digifinexfetchmarketleveragetiers) +* [gate](/exchanges/gate.md#gatefetchmarketleveragetiers) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchmarketleveragetiers) +* [okx](/exchanges/okx.md#okxfetchmarketleveragetiers) +* [xt](/exchanges/xt.md#xtfetchmarketleveragetiers) + +--- + + + +## fetchMarkets +retrieves data on all markets for alpaca + +**Kind**: instance +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange api endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchmarkets) +* [apex](/exchanges/apex.md#apexfetchmarkets) +* [ascendex](/exchanges/ascendex.md#ascendexfetchmarkets) +* [backpack](/exchanges/backpack.md#backpackfetchmarkets) +* [bigone](/exchanges/bigone.md#bigonefetchmarkets) +* [binance](/exchanges/binance.md#binancefetchmarkets) +* [bingx](/exchanges/bingx.md#bingxfetchmarkets) +* [bitbank](/exchanges/bitbank.md#bitbankfetchmarkets) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchmarkets) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchmarkets) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchmarkets) +* [bitget](/exchanges/bitget.md#bitgetfetchmarkets) +* [bithumb](/exchanges/bithumb.md#bithumbfetchmarkets) +* [bitmart](/exchanges/bitmart.md#bitmartfetchmarkets) +* [bitmex](/exchanges/bitmex.md#bitmexfetchmarkets) +* [bitopro](/exchanges/bitopro.md#bitoprofetchmarkets) +* [bitrue](/exchanges/bitrue.md#bitruefetchmarkets) +* [bitso](/exchanges/bitso.md#bitsofetchmarkets) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchmarkets) +* [bitteam](/exchanges/bitteam.md#bitteamfetchmarkets) +* [bittrade](/exchanges/bittrade.md#bittradefetchmarkets) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchmarkets) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchmarkets) +* [blofin](/exchanges/blofin.md#blofinfetchmarkets) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchmarkets) +* [btcbox](/exchanges/btcbox.md#btcboxfetchmarkets) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchmarkets) +* [btcturk](/exchanges/btcturk.md#btcturkfetchmarkets) +* [bybit](/exchanges/bybit.md#bybitfetchmarkets) +* [cex](/exchanges/cex.md#cexfetchmarkets) +* [coinbase](/exchanges/coinbase.md#coinbasefetchmarkets) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchmarkets) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchmarkets) +* [coincatch](/exchanges/coincatch.md#coincatchfetchmarkets) +* [coinex](/exchanges/coinex.md#coinexfetchmarkets) +* [coinmate](/exchanges/coinmate.md#coinmatefetchmarkets) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchmarkets) +* [coinone](/exchanges/coinone.md#coinonefetchmarkets) +* [coinsph](/exchanges/coinsph.md#coinsphfetchmarkets) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchmarkets) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchmarkets) +* [defx](/exchanges/defx.md#defxfetchmarkets) +* [delta](/exchanges/delta.md#deltafetchmarkets) +* [deribit](/exchanges/deribit.md#deribitfetchmarkets) +* [derive](/exchanges/derive.md#derivefetchmarkets) +* [digifinex](/exchanges/digifinex.md#digifinexfetchmarkets) +* [exmo](/exchanges/exmo.md#exmofetchmarkets) +* [foxbit](/exchanges/foxbit.md#foxbitfetchmarkets) +* [gate](/exchanges/gate.md#gatefetchmarkets) +* [gemini](/exchanges/gemini.md#geminifetchmarkets) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchmarkets) +* [hibachi](/exchanges/hibachi.md#hibachifetchmarkets) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchmarkets) +* [hollaex](/exchanges/hollaex.md#hollaexfetchmarkets) +* [htx](/exchanges/htx.md#htxfetchmarkets) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchmarkets) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchmarkets) +* [indodax](/exchanges/indodax.md#indodaxfetchmarkets) +* [kraken](/exchanges/kraken.md#krakenfetchmarkets) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchmarkets) +* [kucoin](/exchanges/kucoin.md#kucoinfetchmarkets) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchmarkets) +* [latoken](/exchanges/latoken.md#latokenfetchmarkets) +* [lbank](/exchanges/lbank.md#lbankfetchmarkets) +* [luno](/exchanges/luno.md#lunofetchmarkets) +* [mercado](/exchanges/mercado.md#mercadofetchmarkets) +* [mexc](/exchanges/mexc.md#mexcfetchmarkets) +* [modetrade](/exchanges/modetrade.md#modetradefetchmarkets) +* [ndax](/exchanges/ndax.md#ndaxfetchmarkets) +* [novadax](/exchanges/novadax.md#novadaxfetchmarkets) +* [oceanex](/exchanges/oceanex.md#oceanexfetchmarkets) +* [okcoin](/exchanges/okcoin.md#okcoinfetchmarkets) +* [okx](/exchanges/okx.md#okxfetchmarkets) +* [onetrading](/exchanges/onetrading.md#onetradingfetchmarkets) +* [oxfun](/exchanges/oxfun.md#oxfunfetchmarkets) +* [p2b](/exchanges/p2b.md#p2bfetchmarkets) +* [paradex](/exchanges/paradex.md#paradexfetchmarkets) +* [phemex](/exchanges/phemex.md#phemexfetchmarkets) +* [poloniex](/exchanges/poloniex.md#poloniexfetchmarkets) +* [probit](/exchanges/probit.md#probitfetchmarkets) +* [timex](/exchanges/timex.md#timexfetchmarkets) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchmarkets) +* [toobit](/exchanges/toobit.md#toobitfetchmarkets) +* [upbit](/exchanges/upbit.md#upbitfetchmarkets) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchmarkets) +* [whitebit](/exchanges/whitebit.md#whitebitfetchmarkets) +* [woo](/exchanges/woo.md#woofetchmarkets) +* [woofipro](/exchanges/woofipro.md#woofiprofetchmarkets) +* [xt](/exchanges/xt.md#xtfetchmarkets) +* [yobit](/exchanges/yobit.md#yobitfetchmarkets) +* [zaif](/exchanges/zaif.md#zaiffetchmarkets) +* [zonda](/exchanges/zonda.md#zondafetchmarkets) + +--- + + + +## fetchMarketsWs +retrieves data on all markets for bitvavo + +**Kind**: instance +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchmarketsws) + +--- + + + +## fetchMyDustTrades +fetch all dust trades made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | not used by binance fetchMyDustTrades () | +| since | int | No | the earliest time in ms to fetch my dust trades for | +| limit | int | No | the maximum number of dust trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'margin', default spot | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchmydusttrades) + +--- + + + +## fetchMyLiquidations +retrieves the users liquidated positions + +**Kind**: instance +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the binance api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.paginate | boolean | No | *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch liquidations in a portfolio margin account | +| params.type | string | No | "spot" | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchmyliquidations) +* [bingx](/exchanges/bingx.md#bingxfetchmyliquidations) +* [bitget](/exchanges/bitget.md#bitgetfetchmyliquidations) +* [bitmart](/exchanges/bitmart.md#bitmartfetchmyliquidations) +* [bybit](/exchanges/bybit.md#bybitfetchmyliquidations) +* [deribit](/exchanges/deribit.md#deribitfetchmyliquidations) +* [gate](/exchanges/gate.md#gatefetchmyliquidations) + +--- + + + +## fetchMySettlementHistory +fetches historical settlement records of the user + +**Kind**: instance +**Returns**: Array<object> - a list of [settlement history objects] + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchmysettlementhistory) +* [bybit](/exchanges/bybit.md#bybitfetchmysettlementhistory) +* [gate](/exchanges/gate.md#gatefetchmysettlementhistory) + +--- + + + +## fetchMyTrades +fetch all trades made by the user + +**Kind**: instance +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.page_token | string | No | page_token - used for paging | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchmytrades) +* [apex](/exchanges/apex.md#apexfetchmytrades) +* [backpack](/exchanges/backpack.md#backpackfetchmytrades) +* [bigone](/exchanges/bigone.md#bigonefetchmytrades) +* [binance](/exchanges/binance.md#binancefetchmytrades) +* [bingx](/exchanges/bingx.md#bingxfetchmytrades) +* [bit2c](/exchanges/bit2c.md#bit2cfetchmytrades) +* [bitbank](/exchanges/bitbank.md#bitbankfetchmytrades) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchmytrades) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchmytrades) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchmytrades) +* [bitget](/exchanges/bitget.md#bitgetfetchmytrades) +* [bitmart](/exchanges/bitmart.md#bitmartfetchmytrades) +* [bitmex](/exchanges/bitmex.md#bitmexfetchmytrades) +* [bitopro](/exchanges/bitopro.md#bitoprofetchmytrades) +* [bitrue](/exchanges/bitrue.md#bitruefetchmytrades) +* [bitso](/exchanges/bitso.md#bitsofetchmytrades) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchmytrades) +* [bitteam](/exchanges/bitteam.md#bitteamfetchmytrades) +* [bittrade](/exchanges/bittrade.md#bittradefetchmytrades) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchmytrades) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchmytrades) +* [blofin](/exchanges/blofin.md#blofinfetchmytrades) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchmytrades) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchmytrades) +* [btcturk](/exchanges/btcturk.md#btcturkfetchmytrades) +* [bybit](/exchanges/bybit.md#bybitfetchmytrades) +* [coinbase](/exchanges/coinbase.md#coinbasefetchmytrades) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchmytrades) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchmytrades) +* [coincatch](/exchanges/coincatch.md#coincatchfetchmytrades) +* [coincheck](/exchanges/coincheck.md#coincheckfetchmytrades) +* [coinex](/exchanges/coinex.md#coinexfetchmytrades) +* [coinmate](/exchanges/coinmate.md#coinmatefetchmytrades) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchmytrades) +* [coinone](/exchanges/coinone.md#coinonefetchmytrades) +* [coinsph](/exchanges/coinsph.md#coinsphfetchmytrades) +* [coinspot](/exchanges/coinspot.md#coinspotfetchmytrades) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchmytrades) +* [defx](/exchanges/defx.md#defxfetchmytrades) +* [delta](/exchanges/delta.md#deltafetchmytrades) +* [deribit](/exchanges/deribit.md#deribitfetchmytrades) +* [derive](/exchanges/derive.md#derivefetchmytrades) +* [digifinex](/exchanges/digifinex.md#digifinexfetchmytrades) +* [exmo](/exchanges/exmo.md#exmofetchmytrades) +* [foxbit](/exchanges/foxbit.md#foxbitfetchmytrades) +* [gate](/exchanges/gate.md#gatefetchmytrades) +* [gemini](/exchanges/gemini.md#geminifetchmytrades) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchmytrades) +* [hibachi](/exchanges/hibachi.md#hibachifetchmytrades) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchmytrades) +* [hollaex](/exchanges/hollaex.md#hollaexfetchmytrades) +* [htx](/exchanges/htx.md#htxfetchmytrades) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchmytrades) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchmytrades) +* [kraken](/exchanges/kraken.md#krakenfetchmytrades) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchmytrades) +* [kucoin](/exchanges/kucoin.md#kucoinfetchmytrades) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchmytrades) +* [latoken](/exchanges/latoken.md#latokenfetchmytrades) +* [lbank](/exchanges/lbank.md#lbankfetchmytrades) +* [luno](/exchanges/luno.md#lunofetchmytrades) +* [mercado](/exchanges/mercado.md#mercadofetchmytrades) +* [mexc](/exchanges/mexc.md#mexcfetchmytrades) +* [modetrade](/exchanges/modetrade.md#modetradefetchmytrades) +* [ndax](/exchanges/ndax.md#ndaxfetchmytrades) +* [novadax](/exchanges/novadax.md#novadaxfetchmytrades) +* [okcoin](/exchanges/okcoin.md#okcoinfetchmytrades) +* [okx](/exchanges/okx.md#okxfetchmytrades) +* [onetrading](/exchanges/onetrading.md#onetradingfetchmytrades) +* [oxfun](/exchanges/oxfun.md#oxfunfetchmytrades) +* [p2b](/exchanges/p2b.md#p2bfetchmytrades) +* [paradex](/exchanges/paradex.md#paradexfetchmytrades) +* [phemex](/exchanges/phemex.md#phemexfetchmytrades) +* [poloniex](/exchanges/poloniex.md#poloniexfetchmytrades) +* [probit](/exchanges/probit.md#probitfetchmytrades) +* [timex](/exchanges/timex.md#timexfetchmytrades) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchmytrades) +* [toobit](/exchanges/toobit.md#toobitfetchmytrades) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchmytrades) +* [whitebit](/exchanges/whitebit.md#whitebitfetchmytrades) +* [woo](/exchanges/woo.md#woofetchmytrades) +* [woofipro](/exchanges/woofipro.md#woofiprofetchmytrades) +* [xt](/exchanges/xt.md#xtfetchmytrades) +* [yobit](/exchanges/yobit.md#yobitfetchmytrades) +* [zonda](/exchanges/zonda.md#zondafetchmytrades) + +--- + + + +## fetchMyTradesWs +fetch all trades made by the user + +**Kind**: instance +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchmytradesws) + +--- + + + +## fetchOHLCV +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the alpha api endpoint | +| params.loc | string | No | crypto location, default: us | +| params.method | string | No | method, default: marketPublicGetV1beta3CryptoLocBars | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchohlcv) +* [apex](/exchanges/apex.md#apexfetchohlcv) +* [ascendex](/exchanges/ascendex.md#ascendexfetchohlcv) +* [backpack](/exchanges/backpack.md#backpackfetchohlcv) +* [bigone](/exchanges/bigone.md#bigonefetchohlcv) +* [binance](/exchanges/binance.md#binancefetchohlcv) +* [bingx](/exchanges/bingx.md#bingxfetchohlcv) +* [bitbank](/exchanges/bitbank.md#bitbankfetchohlcv) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchohlcv) +* [bitget](/exchanges/bitget.md#bitgetfetchohlcv) +* [bithumb](/exchanges/bithumb.md#bithumbfetchohlcv) +* [bitmart](/exchanges/bitmart.md#bitmartfetchohlcv) +* [bitmex](/exchanges/bitmex.md#bitmexfetchohlcv) +* [bitopro](/exchanges/bitopro.md#bitoprofetchohlcv) +* [bitrue](/exchanges/bitrue.md#bitruefetchohlcv) +* [bitso](/exchanges/bitso.md#bitsofetchohlcv) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchohlcv) +* [bitteam](/exchanges/bitteam.md#bitteamfetchohlcv) +* [bittrade](/exchanges/bittrade.md#bittradefetchohlcv) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchohlcv) +* [blofin](/exchanges/blofin.md#blofinfetchohlcv) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchohlcv) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchohlcv) +* [btcturk](/exchanges/btcturk.md#btcturkfetchohlcv) +* [bybit](/exchanges/bybit.md#bybitfetchohlcv) +* [cex](/exchanges/cex.md#cexfetchohlcv) +* [coinbase](/exchanges/coinbase.md#coinbasefetchohlcv) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchohlcv) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchohlcv) +* [coincatch](/exchanges/coincatch.md#coincatchfetchohlcv) +* [coinex](/exchanges/coinex.md#coinexfetchohlcv) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchohlcv) +* [coinsph](/exchanges/coinsph.md#coinsphfetchohlcv) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchohlcv) +* [defx](/exchanges/defx.md#defxfetchohlcv) +* [delta](/exchanges/delta.md#deltafetchohlcv) +* [deribit](/exchanges/deribit.md#deribitfetchohlcv) +* [digifinex](/exchanges/digifinex.md#digifinexfetchohlcv) +* [exmo](/exchanges/exmo.md#exmofetchohlcv) +* [foxbit](/exchanges/foxbit.md#foxbitfetchohlcv) +* [gateio](/exchanges/gateio.md#gateiofetchohlcv) +* [gemini](/exchanges/gemini.md#geminifetchohlcv) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchohlcv) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchohlcv) +* [hollaex](/exchanges/hollaex.md#hollaexfetchohlcv) +* [htx](/exchanges/htx.md#htxfetchohlcv) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchohlcv) +* [indodax](/exchanges/indodax.md#indodaxfetchohlcv) +* [kraken](/exchanges/kraken.md#krakenfetchohlcv) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchohlcv) +* [kucoin](/exchanges/kucoin.md#kucoinfetchohlcv) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchohlcv) +* [lbank](/exchanges/lbank.md#lbankfetchohlcv) +* [luno](/exchanges/luno.md#lunofetchohlcv) +* [mercado](/exchanges/mercado.md#mercadofetchohlcv) +* [mexc](/exchanges/mexc.md#mexcfetchohlcv) +* [modetrade](/exchanges/modetrade.md#modetradefetchohlcv) +* [ndax](/exchanges/ndax.md#ndaxfetchohlcv) +* [novadax](/exchanges/novadax.md#novadaxfetchohlcv) +* [oceanex](/exchanges/oceanex.md#oceanexfetchohlcv) +* [okcoin](/exchanges/okcoin.md#okcoinfetchohlcv) +* [okx](/exchanges/okx.md#okxfetchohlcv) +* [onetrading](/exchanges/onetrading.md#onetradingfetchohlcv) +* [oxfun](/exchanges/oxfun.md#oxfunfetchohlcv) +* [p2b](/exchanges/p2b.md#p2bfetchohlcv) +* [paradex](/exchanges/paradex.md#paradexfetchohlcv) +* [phemex](/exchanges/phemex.md#phemexfetchohlcv) +* [poloniex](/exchanges/poloniex.md#poloniexfetchohlcv) +* [probit](/exchanges/probit.md#probitfetchohlcv) +* [timex](/exchanges/timex.md#timexfetchohlcv) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchohlcv) +* [toobit](/exchanges/toobit.md#toobitfetchohlcv) +* [upbit](/exchanges/upbit.md#upbitfetchohlcv) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchohlcv) +* [whitebit](/exchanges/whitebit.md#whitebitfetchohlcv) +* [woo](/exchanges/woo.md#woofetchohlcv) +* [woofipro](/exchanges/woofipro.md#woofiprofetchohlcv) +* [xt](/exchanges/xt.md#xtfetchohlcv) +* [zonda](/exchanges/zonda.md#zondafetchohlcv) + +--- + + + +## fetchOHLCVWs +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchohlcvws) +* [lbank](/exchanges/lbank.md#lbankfetchohlcvws) + +--- + + + +## fetchOpenInterest +retrieves the open interest of a contract trading pair + +**Kind**: instance +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexfetchopeninterest) +* [backpack](/exchanges/backpack.md#backpackfetchopeninterest) +* [binance](/exchanges/binance.md#binancefetchopeninterest) +* [bingx](/exchanges/bingx.md#bingxfetchopeninterest) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchopeninterest) +* [bitget](/exchanges/bitget.md#bitgetfetchopeninterest) +* [bitmart](/exchanges/bitmart.md#bitmartfetchopeninterest) +* [bybit](/exchanges/bybit.md#bybitfetchopeninterest) +* [delta](/exchanges/delta.md#deltafetchopeninterest) +* [gate](/exchanges/gate.md#gatefetchopeninterest) +* [hibachi](/exchanges/hibachi.md#hibachifetchopeninterest) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchopeninterest) +* [htx](/exchanges/htx.md#htxfetchopeninterest) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchopeninterest) +* [okx](/exchanges/okx.md#okxfetchopeninterest) +* [paradex](/exchanges/paradex.md#paradexfetchopeninterest) +* [phemex](/exchanges/phemex.md#phemexfetchopeninterest) + +--- + + + +## fetchOpenInterestHistory +Retrieves the open interest history of a currency + +**Kind**: instance +**Returns**: object - an array of [open interest structure](https://docs.ccxt.com/#/?id=open-interest-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| timeframe | string | Yes | "5m","15m","30m","1h","2h","4h","6h","12h", or "1d" | +| since | int | No | the time(ms) of the earliest record to retrieve as a unix timestamp | +| limit | int | No | default 30, max 500 | +| params | object | No | exchange specific parameters | +| params.until | int | No | the time(ms) of the latest record to retrieve as a unix timestamp | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchopeninteresthistory) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchopeninteresthistory) +* [bybit](/exchanges/bybit.md#bybitfetchopeninteresthistory) +* [htx](/exchanges/htx.md#htxfetchopeninteresthistory) +* [okx](/exchanges/okx.md#okxfetchopeninteresthistory) + +--- + + + +## fetchOpenInterests +Retrieves the open interest for a list of symbols + +**Kind**: instance +**Returns**: Array<object> - a list of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified CCXT market symbols | +| params | object | No | exchange specific parameters | + +##### Supported exchanges +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchopeninterests) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchopeninterests) +* [htx](/exchanges/htx.md#htxfetchopeninterests) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchopeninterests) +* [okx](/exchanges/okx.md#okxfetchopeninterests) + +--- + + + +## fetchOpenOrder +fetch an open order by it's id + +**Kind**: instance +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by hollaex fetchOpenOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackfetchopenorder) +* [binance](/exchanges/binance.md#binancefetchopenorder) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchopenorder) +* [bybit](/exchanges/bybit.md#bybitfetchopenorder) +* [cex](/exchanges/cex.md#cexfetchopenorder) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchopenorder) +* [hollaex](/exchanges/hollaex.md#hollaexfetchopenorder) + +--- + + + +## fetchOpenOrders +fetch all unfilled currently open orders + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchopenorders) +* [apex](/exchanges/apex.md#apexfetchopenorders) +* [ascendex](/exchanges/ascendex.md#ascendexfetchopenorders) +* [backpack](/exchanges/backpack.md#backpackfetchopenorders) +* [bigone](/exchanges/bigone.md#bigonefetchopenorders) +* [binance](/exchanges/binance.md#binancefetchopenorders) +* [bingx](/exchanges/bingx.md#bingxfetchopenorders) +* [bit2c](/exchanges/bit2c.md#bit2cfetchopenorders) +* [bitbank](/exchanges/bitbank.md#bitbankfetchopenorders) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchopenorders) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchopenorders) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchopenorders) +* [bitget](/exchanges/bitget.md#bitgetfetchopenorders) +* [bithumb](/exchanges/bithumb.md#bithumbfetchopenorders) +* [bitmart](/exchanges/bitmart.md#bitmartfetchopenorders) +* [bitmex](/exchanges/bitmex.md#bitmexfetchopenorders) +* [bitopro](/exchanges/bitopro.md#bitoprofetchopenorders) +* [bitrue](/exchanges/bitrue.md#bitruefetchopenorders) +* [bitso](/exchanges/bitso.md#bitsofetchopenorders) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchopenorders) +* [bitteam](/exchanges/bitteam.md#bitteamfetchopenorders) +* [bittrade](/exchanges/bittrade.md#bittradefetchopenorders) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchopenorders) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchopenorders) +* [blofin](/exchanges/blofin.md#blofinfetchopenorders) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchopenorders) +* [btcbox](/exchanges/btcbox.md#btcboxfetchopenorders) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchopenorders) +* [btcturk](/exchanges/btcturk.md#btcturkfetchopenorders) +* [bybit](/exchanges/bybit.md#bybitfetchopenorders) +* [cex](/exchanges/cex.md#cexfetchopenorders) +* [coinbase](/exchanges/coinbase.md#coinbasefetchopenorders) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchopenorders) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchopenorders) +* [coincatch](/exchanges/coincatch.md#coincatchfetchopenorders) +* [coincheck](/exchanges/coincheck.md#coincheckfetchopenorders) +* [coinex](/exchanges/coinex.md#coinexfetchopenorders) +* [coinmate](/exchanges/coinmate.md#coinmatefetchopenorders) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchopenorders) +* [coinone](/exchanges/coinone.md#coinonefetchopenorders) +* [coinsph](/exchanges/coinsph.md#coinsphfetchopenorders) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchopenorders) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchopenorders) +* [defx](/exchanges/defx.md#defxfetchopenorders) +* [delta](/exchanges/delta.md#deltafetchopenorders) +* [deribit](/exchanges/deribit.md#deribitfetchopenorders) +* [derive](/exchanges/derive.md#derivefetchopenorders) +* [digifinex](/exchanges/digifinex.md#digifinexfetchopenorders) +* [exmo](/exchanges/exmo.md#exmofetchopenorders) +* [foxbit](/exchanges/foxbit.md#foxbitfetchopenorders) +* [gate](/exchanges/gate.md#gatefetchopenorders) +* [gemini](/exchanges/gemini.md#geminifetchopenorders) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchopenorders) +* [hibachi](/exchanges/hibachi.md#hibachifetchopenorders) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchopenorders) +* [hollaex](/exchanges/hollaex.md#hollaexfetchopenorders) +* [htx](/exchanges/htx.md#htxfetchopenorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchopenorders) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchopenorders) +* [indodax](/exchanges/indodax.md#indodaxfetchopenorders) +* [kraken](/exchanges/kraken.md#krakenfetchopenorders) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchopenorders) +* [kucoin](/exchanges/kucoin.md#kucoinfetchopenorders) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchopenorders) +* [latoken](/exchanges/latoken.md#latokenfetchopenorders) +* [lbank](/exchanges/lbank.md#lbankfetchopenorders) +* [luno](/exchanges/luno.md#lunofetchopenorders) +* [mercado](/exchanges/mercado.md#mercadofetchopenorders) +* [mexc](/exchanges/mexc.md#mexcfetchopenorders) +* [modetrade](/exchanges/modetrade.md#modetradefetchopenorders) +* [ndax](/exchanges/ndax.md#ndaxfetchopenorders) +* [novadax](/exchanges/novadax.md#novadaxfetchopenorders) +* [oceanex](/exchanges/oceanex.md#oceanexfetchopenorders) +* [okcoin](/exchanges/okcoin.md#okcoinfetchopenorders) +* [okx](/exchanges/okx.md#okxfetchopenorders) +* [onetrading](/exchanges/onetrading.md#onetradingfetchopenorders) +* [oxfun](/exchanges/oxfun.md#oxfunfetchopenorders) +* [p2b](/exchanges/p2b.md#p2bfetchopenorders) +* [paradex](/exchanges/paradex.md#paradexfetchopenorders) +* [phemex](/exchanges/phemex.md#phemexfetchopenorders) +* [poloniex](/exchanges/poloniex.md#poloniexfetchopenorders) +* [probit](/exchanges/probit.md#probitfetchopenorders) +* [timex](/exchanges/timex.md#timexfetchopenorders) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchopenorders) +* [toobit](/exchanges/toobit.md#toobitfetchopenorders) +* [upbit](/exchanges/upbit.md#upbitfetchopenorders) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchopenorders) +* [whitebit](/exchanges/whitebit.md#whitebitfetchopenorders) +* [woo](/exchanges/woo.md#woofetchopenorders) +* [woofipro](/exchanges/woofipro.md#woofiprofetchopenorders) +* [xt](/exchanges/xt.md#xtfetchopenorders) +* [yobit](/exchanges/yobit.md#yobitfetchopenorders) +* [zaif](/exchanges/zaif.md#zaiffetchopenorders) +* [zonda](/exchanges/zonda.md#zondafetchopenorders) + +--- + + + +## fetchOpenOrdersWs +fetch all unfilled currently open orders + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchopenordersws) +* [cex](/exchanges/cex.md#cexfetchopenordersws) +* [gate](/exchanges/gate.md#gatefetchopenordersws) + +--- + + + +## fetchOption +fetches option data that is commonly found in an option chain + +**Kind**: instance +**Returns**: object - an [option chain structure](https://docs.ccxt.com/#/?id=option-chain-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchoption) +* [bybit](/exchanges/bybit.md#bybitfetchoption) +* [delta](/exchanges/delta.md#deltafetchoption) +* [deribit](/exchanges/deribit.md#deribitfetchoption) +* [gate](/exchanges/gate.md#gatefetchoption) +* [okx](/exchanges/okx.md#okxfetchoption) + +--- + + + +## fetchOptionChain +fetches data for an underlying asset that is commonly found in an option chain + +**Kind**: instance +**Returns**: object - a list of [option chain structures](https://docs.ccxt.com/#/?id=option-chain-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | base currency to fetch an option chain for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitfetchoptionchain) +* [deribit](/exchanges/deribit.md#deribitfetchoptionchain) +* [gate](/exchanges/gate.md#gatefetchoptionchain) +* [okx](/exchanges/okx.md#okxfetchoptionchain) + +--- + + + +## fetchOptionPositions +fetch data on open options positions + +**Kind**: instance +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchoptionpositions) + +--- + + + +## fetchOrder +fetches information on an order made by the user + +**Kind**: instance +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchorder) +* [apex](/exchanges/apex.md#apexfetchorder) +* [ascendex](/exchanges/ascendex.md#ascendexfetchorder) +* [bigone](/exchanges/bigone.md#bigonefetchorder) +* [binance](/exchanges/binance.md#binancefetchorder) +* [bingx](/exchanges/bingx.md#bingxfetchorder) +* [bit2c](/exchanges/bit2c.md#bit2cfetchorder) +* [bitbank](/exchanges/bitbank.md#bitbankfetchorder) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchorder) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchorder) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchorder) +* [bitget](/exchanges/bitget.md#bitgetfetchorder) +* [bithumb](/exchanges/bithumb.md#bithumbfetchorder) +* [bitmart](/exchanges/bitmart.md#bitmartfetchorder) +* [bitmex](/exchanges/bitmex.md#bitmexfetchorder) +* [bitopro](/exchanges/bitopro.md#bitoprofetchorder) +* [bitrue](/exchanges/bitrue.md#bitruefetchorder) +* [bitso](/exchanges/bitso.md#bitsofetchorder) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchorder) +* [bitteam](/exchanges/bitteam.md#bitteamfetchorder) +* [bittrade](/exchanges/bittrade.md#bittradefetchorder) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchorder) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchorder) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchorder) +* [btcbox](/exchanges/btcbox.md#btcboxfetchorder) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchorder) +* [bybit](/exchanges/bybit.md#bybitfetchorder) +* [coinbase](/exchanges/coinbase.md#coinbasefetchorder) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchorder) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchorder) +* [coincatch](/exchanges/coincatch.md#coincatchfetchorder) +* [coinex](/exchanges/coinex.md#coinexfetchorder) +* [coinmate](/exchanges/coinmate.md#coinmatefetchorder) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchorder) +* [coinone](/exchanges/coinone.md#coinonefetchorder) +* [coinsph](/exchanges/coinsph.md#coinsphfetchorder) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchorder) +* [defx](/exchanges/defx.md#defxfetchorder) +* [deribit](/exchanges/deribit.md#deribitfetchorder) +* [digifinex](/exchanges/digifinex.md#digifinexfetchorder) +* [exmo](/exchanges/exmo.md#exmofetchorder) +* [foxbit](/exchanges/foxbit.md#foxbitfetchorder) +* [gate](/exchanges/gate.md#gatefetchorder) +* [gemini](/exchanges/gemini.md#geminifetchorder) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchorder) +* [hibachi](/exchanges/hibachi.md#hibachifetchorder) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchorder) +* [hollaex](/exchanges/hollaex.md#hollaexfetchorder) +* [htx](/exchanges/htx.md#htxfetchorder) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchorder) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchorder) +* [indodax](/exchanges/indodax.md#indodaxfetchorder) +* [kraken](/exchanges/kraken.md#krakenfetchorder) +* [kucoin](/exchanges/kucoin.md#kucoinfetchorder) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchorder) +* [latoken](/exchanges/latoken.md#latokenfetchorder) +* [lbank](/exchanges/lbank.md#lbankfetchorder) +* [luno](/exchanges/luno.md#lunofetchorder) +* [mercado](/exchanges/mercado.md#mercadofetchorder) +* [mexc](/exchanges/mexc.md#mexcfetchorder) +* [modetrade](/exchanges/modetrade.md#modetradefetchorder) +* [ndax](/exchanges/ndax.md#ndaxfetchorder) +* [novadax](/exchanges/novadax.md#novadaxfetchorder) +* [oceanex](/exchanges/oceanex.md#oceanexfetchorder) +* [okcoin](/exchanges/okcoin.md#okcoinfetchorder) +* [okx](/exchanges/okx.md#okxfetchorder) +* [onetrading](/exchanges/onetrading.md#onetradingfetchorder) +* [oxfun](/exchanges/oxfun.md#oxfunfetchorder) +* [paradex](/exchanges/paradex.md#paradexfetchorder) +* [phemex](/exchanges/phemex.md#phemexfetchorder) +* [poloniex](/exchanges/poloniex.md#poloniexfetchorder) +* [probit](/exchanges/probit.md#probitfetchorder) +* [timex](/exchanges/timex.md#timexfetchorder) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchorder) +* [toobit](/exchanges/toobit.md#toobitfetchorder) +* [upbit](/exchanges/upbit.md#upbitfetchorder) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchorder) +* [woo](/exchanges/woo.md#woofetchorder) +* [woofipro](/exchanges/woofipro.md#woofiprofetchorder) +* [xt](/exchanges/xt.md#xtfetchorder) +* [yobit](/exchanges/yobit.md#yobitfetchorder) + +--- + + + +## fetchOrderBook +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance +**Returns**: object - A dictionary of [order book structures](https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchorderbook) +* [apex](/exchanges/apex.md#apexfetchorderbook) +* [ascendex](/exchanges/ascendex.md#ascendexfetchorderbook) +* [backpack](/exchanges/backpack.md#backpackfetchorderbook) +* [bigone](/exchanges/bigone.md#bigonefetchorderbook) +* [binance](/exchanges/binance.md#binancefetchorderbook) +* [bingx](/exchanges/bingx.md#bingxfetchorderbook) +* [bit2c](/exchanges/bit2c.md#bit2cfetchorderbook) +* [bitbank](/exchanges/bitbank.md#bitbankfetchorderbook) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchorderbook) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchorderbook) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchorderbook) +* [bitget](/exchanges/bitget.md#bitgetfetchorderbook) +* [bithumb](/exchanges/bithumb.md#bithumbfetchorderbook) +* [bitmart](/exchanges/bitmart.md#bitmartfetchorderbook) +* [bitmex](/exchanges/bitmex.md#bitmexfetchorderbook) +* [bitopro](/exchanges/bitopro.md#bitoprofetchorderbook) +* [bitrue](/exchanges/bitrue.md#bitruefetchorderbook) +* [bitso](/exchanges/bitso.md#bitsofetchorderbook) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchorderbook) +* [bitteam](/exchanges/bitteam.md#bitteamfetchorderbook) +* [bittrade](/exchanges/bittrade.md#bittradefetchorderbook) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchorderbook) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchorderbook) +* [blofin](/exchanges/blofin.md#blofinfetchorderbook) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchorderbook) +* [btcbox](/exchanges/btcbox.md#btcboxfetchorderbook) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchorderbook) +* [btcturk](/exchanges/btcturk.md#btcturkfetchorderbook) +* [bybit](/exchanges/bybit.md#bybitfetchorderbook) +* [cex](/exchanges/cex.md#cexfetchorderbook) +* [coinbase](/exchanges/coinbase.md#coinbasefetchorderbook) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchorderbook) +* [coincatch](/exchanges/coincatch.md#coincatchfetchorderbook) +* [coincheck](/exchanges/coincheck.md#coincheckfetchorderbook) +* [coinex](/exchanges/coinex.md#coinexfetchorderbook) +* [coinmate](/exchanges/coinmate.md#coinmatefetchorderbook) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchorderbook) +* [coinone](/exchanges/coinone.md#coinonefetchorderbook) +* [coinsph](/exchanges/coinsph.md#coinsphfetchorderbook) +* [coinspot](/exchanges/coinspot.md#coinspotfetchorderbook) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchorderbook) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchorderbook) +* [defx](/exchanges/defx.md#defxfetchorderbook) +* [delta](/exchanges/delta.md#deltafetchorderbook) +* [deribit](/exchanges/deribit.md#deribitfetchorderbook) +* [digifinex](/exchanges/digifinex.md#digifinexfetchorderbook) +* [exmo](/exchanges/exmo.md#exmofetchorderbook) +* [foxbit](/exchanges/foxbit.md#foxbitfetchorderbook) +* [gate](/exchanges/gate.md#gatefetchorderbook) +* [gemini](/exchanges/gemini.md#geminifetchorderbook) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchorderbook) +* [hibachi](/exchanges/hibachi.md#hibachifetchorderbook) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchorderbook) +* [hollaex](/exchanges/hollaex.md#hollaexfetchorderbook) +* [htx](/exchanges/htx.md#htxfetchorderbook) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchorderbook) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchorderbook) +* [indodax](/exchanges/indodax.md#indodaxfetchorderbook) +* [kraken](/exchanges/kraken.md#krakenfetchorderbook) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchorderbook) +* [kucoin](/exchanges/kucoin.md#kucoinfetchorderbook) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchorderbook) +* [latoken](/exchanges/latoken.md#latokenfetchorderbook) +* [lbank](/exchanges/lbank.md#lbankfetchorderbook) +* [luno](/exchanges/luno.md#lunofetchorderbook) +* [mercado](/exchanges/mercado.md#mercadofetchorderbook) +* [mexc](/exchanges/mexc.md#mexcfetchorderbook) +* [modetrade](/exchanges/modetrade.md#modetradefetchorderbook) +* [ndax](/exchanges/ndax.md#ndaxfetchorderbook) +* [novadax](/exchanges/novadax.md#novadaxfetchorderbook) +* [oceanex](/exchanges/oceanex.md#oceanexfetchorderbook) +* [okcoin](/exchanges/okcoin.md#okcoinfetchorderbook) +* [okx](/exchanges/okx.md#okxfetchorderbook) +* [onetrading](/exchanges/onetrading.md#onetradingfetchorderbook) +* [oxfun](/exchanges/oxfun.md#oxfunfetchorderbook) +* [p2b](/exchanges/p2b.md#p2bfetchorderbook) +* [paradex](/exchanges/paradex.md#paradexfetchorderbook) +* [paymium](/exchanges/paymium.md#paymiumfetchorderbook) +* [phemex](/exchanges/phemex.md#phemexfetchorderbook) +* [poloniex](/exchanges/poloniex.md#poloniexfetchorderbook) +* [probit](/exchanges/probit.md#probitfetchorderbook) +* [timex](/exchanges/timex.md#timexfetchorderbook) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchorderbook) +* [toobit](/exchanges/toobit.md#toobitfetchorderbook) +* [upbit](/exchanges/upbit.md#upbitfetchorderbook) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchorderbook) +* [whitebit](/exchanges/whitebit.md#whitebitfetchorderbook) +* [woo](/exchanges/woo.md#woofetchorderbook) +* [woofipro](/exchanges/woofipro.md#woofiprofetchorderbook) +* [xt](/exchanges/xt.md#xtfetchorderbook) +* [yobit](/exchanges/yobit.md#yobitfetchorderbook) +* [zaif](/exchanges/zaif.md#zaiffetchorderbook) +* [zonda](/exchanges/zonda.md#zondafetchorderbook) + +--- + + + +## fetchOrderBookWs +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/en/latest/manual.html#order-book-structure) indexed by market symbols + + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified symbol of the market to fetch the order book for | +| limit | int, undefined | the maximum amount of order book entries to return | +| params | object | extra parameters specific to the lbank api endpoint | + +##### Supported exchanges +* [lbank](/exchanges/lbank.md#lbankfetchorderbookws) + +--- + + + +## fetchOrderBooks +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets + +**Kind**: instance +**Returns**: object - a dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols, all symbols fetched if undefined, default is undefined | +| limit | int | No | max number of entries per orderbook to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [exmo](/exchanges/exmo.md#exmofetchorderbooks) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchorderbooks) +* [hollaex](/exchanges/hollaex.md#hollaexfetchorderbooks) +* [oceanex](/exchanges/oceanex.md#oceanexfetchorderbooks) +* [upbit](/exchanges/upbit.md#upbitfetchorderbooks) +* [yobit](/exchanges/yobit.md#yobitfetchorderbooks) + +--- + + + +## fetchOrderClassic +fetches information on an order made by the user *classic accounts only* + +**Kind**: instance +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitfetchorderclassic) + +--- + + + +## fetchOrderTrades +fetch all the trades made from a single order + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexfetchordertrades) +* [binance](/exchanges/binance.md#binancefetchordertrades) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchordertrades) +* [bitmart](/exchanges/bitmart.md#bitmartfetchordertrades) +* [bitso](/exchanges/bitso.md#bitsofetchordertrades) +* [bittrade](/exchanges/bittrade.md#bittradefetchordertrades) +* [bybit](/exchanges/bybit.md#bybitfetchordertrades) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchordertrades) +* [coincatch](/exchanges/coincatch.md#coincatchfetchordertrades) +* [coinsph](/exchanges/coinsph.md#coinsphfetchordertrades) +* [deribit](/exchanges/deribit.md#deribitfetchordertrades) +* [derive](/exchanges/derive.md#derivefetchordertrades) +* [exmo](/exchanges/exmo.md#exmofetchordertrades) +* [gate](/exchanges/gate.md#gatefetchordertrades) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchordertrades) +* [htx](/exchanges/htx.md#htxfetchordertrades) +* [kraken](/exchanges/kraken.md#krakenfetchordertrades) +* [kucoin](/exchanges/kucoin.md#kucoinfetchordertrades) +* [mexc](/exchanges/mexc.md#mexcfetchordertrades) +* [modetrade](/exchanges/modetrade.md#modetradefetchordertrades) +* [ndax](/exchanges/ndax.md#ndaxfetchordertrades) +* [novadax](/exchanges/novadax.md#novadaxfetchordertrades) +* [okcoin](/exchanges/okcoin.md#okcoinfetchordertrades) +* [okx](/exchanges/okx.md#okxfetchordertrades) +* [onetrading](/exchanges/onetrading.md#onetradingfetchordertrades) +* [p2b](/exchanges/p2b.md#p2bfetchordertrades) +* [poloniex](/exchanges/poloniex.md#poloniexfetchordertrades) +* [whitebit](/exchanges/whitebit.md#whitebitfetchordertrades) +* [woo](/exchanges/woo.md#woofetchordertrades) +* [woofipro](/exchanges/woofipro.md#woofiprofetchordertrades) + +--- + + + +## fetchOrderWs +fetches information on an order made by the user + +**Kind**: instance +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchorderws) +* [cex](/exchanges/cex.md#cexfetchorderws) +* [gate](/exchanges/gate.md#gatefetchorderws) + +--- + + + +## fetchOrders +fetches information on multiple orders made by the user + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchorders) +* [apex](/exchanges/apex.md#apexfetchorders) +* [backpack](/exchanges/backpack.md#backpackfetchorders) +* [bigone](/exchanges/bigone.md#bigonefetchorders) +* [binance](/exchanges/binance.md#binancefetchorders) +* [bingx](/exchanges/bingx.md#bingxfetchorders) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchorders) +* [bitmex](/exchanges/bitmex.md#bitmexfetchorders) +* [bitopro](/exchanges/bitopro.md#bitoprofetchorders) +* [bitteam](/exchanges/bitteam.md#bitteamfetchorders) +* [bittrade](/exchanges/bittrade.md#bittradefetchorders) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchorders) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchorders) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchorders) +* [btcbox](/exchanges/btcbox.md#btcboxfetchorders) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchorders) +* [btcturk](/exchanges/btcturk.md#btcturkfetchorders) +* [bybit](/exchanges/bybit.md#bybitfetchorders) +* [cex](/exchanges/cex.md#cexfetchorders) +* [coinbase](/exchanges/coinbase.md#coinbasefetchorders) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchorders) +* [coinmate](/exchanges/coinmate.md#coinmatefetchorders) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchorders) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchorders) +* [defx](/exchanges/defx.md#defxfetchorders) +* [derive](/exchanges/derive.md#derivefetchorders) +* [digifinex](/exchanges/digifinex.md#digifinexfetchorders) +* [foxbit](/exchanges/foxbit.md#foxbitfetchorders) +* [gemini](/exchanges/gemini.md#geminifetchorders) +* [hollaex](/exchanges/hollaex.md#hollaexfetchorders) +* [htx](/exchanges/htx.md#htxfetchorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchorders) +* [latoken](/exchanges/latoken.md#latokenfetchorders) +* [lbank](/exchanges/lbank.md#lbankfetchorders) +* [luno](/exchanges/luno.md#lunofetchorders) +* [mercado](/exchanges/mercado.md#mercadofetchorders) +* [mexc](/exchanges/mexc.md#mexcfetchorders) +* [modetrade](/exchanges/modetrade.md#modetradefetchorders) +* [ndax](/exchanges/ndax.md#ndaxfetchorders) +* [novadax](/exchanges/novadax.md#novadaxfetchorders) +* [oceanex](/exchanges/oceanex.md#oceanexfetchorders) +* [paradex](/exchanges/paradex.md#paradexfetchorders) +* [phemex](/exchanges/phemex.md#phemexfetchorders) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchorders) +* [toobit](/exchanges/toobit.md#toobitfetchorders) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchorders) +* [woo](/exchanges/woo.md#woofetchorders) +* [woofipro](/exchanges/woofipro.md#woofiprofetchorders) +* [xt](/exchanges/xt.md#xtfetchorders) + +--- + + + +## fetchOrdersByIds +fetch orders by the list of order id + +**Kind**: instance +**Returns**: Array<object> - a list of [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | No | list of order id | +| symbol | string | No | unified ccxt market symbol | +| params | object | No | extra parameters specific to the kraken api endpoint | + +##### Supported exchanges +* [kraken](/exchanges/kraken.md#krakenfetchordersbyids) + +--- + + + +## fetchOrdersByStatus +fetch a list of orders + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| status | string | Yes | order status to fetch for | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.marginMode | string | No | 'cross' or 'isolated' for fetching spot margin orders | + +##### Supported exchanges +* [coinex](/exchanges/coinex.md#coinexfetchordersbystatus) +* [kucoin](/exchanges/kucoin.md#kucoinfetchordersbystatus) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchordersbystatus) + +--- + + + +## fetchOrdersClassic +fetches information on multiple orders made by the user *classic accounts only* + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if trigger order | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitfetchordersclassic) + +--- + + + +## fetchOrdersWs +fetches information on multiple orders made by the user + +**Kind**: instance +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of orde structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchordersws) +* [gate](/exchanges/gate.md#gatefetchordersws) + +--- + + + +## fetchPortfolioDetails +Fetch details for a specific portfolio by UUID + +**Kind**: instance +**Returns**: Array<any> - An account structure + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| portfolioUuid | string | Yes | The unique identifier of the portfolio to fetch | +| params | Dict | No | Extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coinbase](/exchanges/coinbase.md#coinbasefetchportfoliodetails) + +--- + + + +## fetchPortfolios +fetch all the portfolios + +**Kind**: instance +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coinbase](/exchanges/coinbase.md#coinbasefetchportfolios) + +--- + + + +## fetchPosition +fetch data on an open position + +**Kind**: instance +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchposition) +* [bingx](/exchanges/bingx.md#bingxfetchposition) +* [bitget](/exchanges/bitget.md#bitgetfetchposition) +* [bitmart](/exchanges/bitmart.md#bitmartfetchposition) +* [blofin](/exchanges/blofin.md#blofinfetchposition) +* [bybit](/exchanges/bybit.md#bybitfetchposition) +* [coinbase](/exchanges/coinbase.md#coinbasefetchposition) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchposition) +* [coincatch](/exchanges/coincatch.md#coincatchfetchposition) +* [coinex](/exchanges/coinex.md#coinexfetchposition) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchposition) +* [defx](/exchanges/defx.md#defxfetchposition) +* [delta](/exchanges/delta.md#deltafetchposition) +* [deribit](/exchanges/deribit.md#deribitfetchposition) +* [digifinex](/exchanges/digifinex.md#digifinexfetchposition) +* [gate](/exchanges/gate.md#gatefetchposition) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchposition) +* [htx](/exchanges/htx.md#htxfetchposition) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchposition) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchposition) +* [mexc](/exchanges/mexc.md#mexcfetchposition) +* [modetrade](/exchanges/modetrade.md#modetradefetchposition) +* [okx](/exchanges/okx.md#okxfetchposition) +* [paradex](/exchanges/paradex.md#paradexfetchposition) +* [whitebit](/exchanges/whitebit.md#whitebitfetchposition) +* [woo](/exchanges/woo.md#woofetchposition) +* [woofipro](/exchanges/woofipro.md#woofiprofetchposition) +* [xt](/exchanges/xt.md#xtfetchposition) + +--- + + + +## fetchPositionHistory +fetches historical positions + +**Kind**: instance +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified contract symbol | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum amount of records to fetch | +| params | object | No | extra parameters specific to the exchange api endpoint | +| params.until | int | No | the latest time in ms to fetch positions for | + +##### Supported exchanges +* [bingx](/exchanges/bingx.md#bingxfetchpositionhistory) +* [coinex](/exchanges/coinex.md#coinexfetchpositionhistory) +* [whitebit](/exchanges/whitebit.md#whitebitfetchpositionhistory) + +--- + + + +## fetchPositionMode +fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets + +**Kind**: instance +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchpositionmode) +* [bingx](/exchanges/bingx.md#bingxfetchpositionmode) +* [bitmart](/exchanges/bitmart.md#bitmartfetchpositionmode) +* [blofin](/exchanges/blofin.md#blofinfetchpositionmode) +* [coincatch](/exchanges/coincatch.md#coincatchfetchpositionmode) +* [mexc](/exchanges/mexc.md#mexcfetchpositionmode) +* [okx](/exchanges/okx.md#okxfetchpositionmode) +* [poloniex](/exchanges/poloniex.md#poloniexfetchpositionmode) + +--- + + + +## fetchPositions +fetch all open positions + +**Kind**: instance +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexfetchpositions) +* [ascendex](/exchanges/ascendex.md#ascendexfetchpositions) +* [backpack](/exchanges/backpack.md#backpackfetchpositions) +* [binance](/exchanges/binance.md#binancefetchpositions) +* [bingx](/exchanges/bingx.md#bingxfetchpositions) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchpositions) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchpositions) +* [bitget](/exchanges/bitget.md#bitgetfetchpositions) +* [bitmart](/exchanges/bitmart.md#bitmartfetchpositions) +* [bitmex](/exchanges/bitmex.md#bitmexfetchpositions) +* [blofin](/exchanges/blofin.md#blofinfetchpositions) +* [bybit](/exchanges/bybit.md#bybitfetchpositions) +* [coinbase](/exchanges/coinbase.md#coinbasefetchpositions) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchpositions) +* [coincatch](/exchanges/coincatch.md#coincatchfetchpositions) +* [coinex](/exchanges/coinex.md#coinexfetchpositions) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchpositions) +* [defx](/exchanges/defx.md#defxfetchpositions) +* [delta](/exchanges/delta.md#deltafetchpositions) +* [deribit](/exchanges/deribit.md#deribitfetchpositions) +* [derive](/exchanges/derive.md#derivefetchpositions) +* [digifinex](/exchanges/digifinex.md#digifinexfetchpositions) +* [gate](/exchanges/gate.md#gatefetchpositions) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchpositions) +* [hibachi](/exchanges/hibachi.md#hibachifetchpositions) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchpositions) +* [htx](/exchanges/htx.md#htxfetchpositions) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchpositions) +* [kraken](/exchanges/kraken.md#krakenfetchpositions) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchpositions) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchpositions) +* [mexc](/exchanges/mexc.md#mexcfetchpositions) +* [modetrade](/exchanges/modetrade.md#modetradefetchpositions) +* [okx](/exchanges/okx.md#okxfetchpositions) +* [oxfun](/exchanges/oxfun.md#oxfunfetchpositions) +* [paradex](/exchanges/paradex.md#paradexfetchpositions) +* [phemex](/exchanges/phemex.md#phemexfetchpositions) +* [poloniex](/exchanges/poloniex.md#poloniexfetchpositions) +* [toobit](/exchanges/toobit.md#toobitfetchpositions) +* [whitebit](/exchanges/whitebit.md#whitebitfetchpositions) +* [woo](/exchanges/woo.md#woofetchpositions) +* [woofipro](/exchanges/woofipro.md#woofiprofetchpositions) +* [xt](/exchanges/xt.md#xtfetchpositions) + +--- + + + +## fetchPositionsForSymbol +fetch all open positions for specific symbol + +**Kind**: instance +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coincatch](/exchanges/coincatch.md#coincatchfetchpositionsforsymbol) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchpositionsforsymbol) +* [okx](/exchanges/okx.md#okxfetchpositionsforsymbol) + +--- + + + +## fetchPositionsHistory +fetches historical positions + +**Kind**: instance +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified contract symbols | +| since | int | No | timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months | +| limit | int | No | the maximum amount of records to fetch, default=20, max=100 | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months | +| params.productType | string | No | USDT-FUTURES (default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + +##### Supported exchanges +* [bitget](/exchanges/bitget.md#bitgetfetchpositionshistory) +* [bybit](/exchanges/bybit.md#bybitfetchpositionshistory) +* [gate](/exchanges/gate.md#gatefetchpositionshistory) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchpositionshistory) +* [mexc](/exchanges/mexc.md#mexcfetchpositionshistory) +* [okx](/exchanges/okx.md#okxfetchpositionshistory) + +--- + + + +## fetchSettlementHistory +fetches historical settlement records + +**Kind**: instance +**Returns**: Array<object> - a list of [settlement history objects](https://docs.ccxt.com/#/?id=settlement-history-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records, default 100, max 100 | +| params | object | No | exchange specific params | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchsettlementhistory) +* [bybit](/exchanges/bybit.md#bybitfetchsettlementhistory) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchsettlementhistory) +* [delta](/exchanges/delta.md#deltafetchsettlementhistory) +* [gate](/exchanges/gate.md#gatefetchsettlementhistory) +* [htx](/exchanges/htx.md#htxfetchsettlementhistory) +* [okx](/exchanges/okx.md#okxfetchsettlementhistory) + +--- + + + +## fetchSpotMarkets +retrieves data on all spot markets for hyperliquid + +**Kind**: instance +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchspotmarkets) + +--- + + + +## fetchStatus +the latest known information on the availability of the exchange API + +**Kind**: instance +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackfetchstatus) +* [binance](/exchanges/binance.md#binancefetchstatus) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchstatus) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchstatus) +* [bitmart](/exchanges/bitmart.md#bitmartfetchstatus) +* [bitrue](/exchanges/bitrue.md#bitruefetchstatus) +* [coinsph](/exchanges/coinsph.md#coinsphfetchstatus) +* [defx](/exchanges/defx.md#defxfetchstatus) +* [delta](/exchanges/delta.md#deltafetchstatus) +* [deribit](/exchanges/deribit.md#deribitfetchstatus) +* [digifinex](/exchanges/digifinex.md#digifinexfetchstatus) +* [foxbit](/exchanges/foxbit.md#foxbitfetchstatus) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchstatus) +* [htx](/exchanges/htx.md#htxfetchstatus) +* [kraken](/exchanges/kraken.md#krakenfetchstatus) +* [kucoin](/exchanges/kucoin.md#kucoinfetchstatus) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchstatus) +* [mexc](/exchanges/mexc.md#mexcfetchstatus) +* [modetrade](/exchanges/modetrade.md#modetradefetchstatus) +* [okx](/exchanges/okx.md#okxfetchstatus) +* [paradex](/exchanges/paradex.md#paradexfetchstatus) +* [toobit](/exchanges/toobit.md#toobitfetchstatus) +* [whitebit](/exchanges/whitebit.md#whitebitfetchstatus) +* [woo](/exchanges/woo.md#woofetchstatus) +* [woofipro](/exchanges/woofipro.md#woofiprofetchstatus) + +--- + + + +## fetchSwapMarkets +retrieves data on all swap markets for hyperliquid + +**Kind**: instance +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchswapmarkets) + +--- + + + +## fetchTicker +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchticker) +* [apex](/exchanges/apex.md#apexfetchticker) +* [ascendex](/exchanges/ascendex.md#ascendexfetchticker) +* [backpack](/exchanges/backpack.md#backpackfetchticker) +* [bigone](/exchanges/bigone.md#bigonefetchticker) +* [binance](/exchanges/binance.md#binancefetchticker) +* [bingx](/exchanges/bingx.md#bingxfetchticker) +* [bit2c](/exchanges/bit2c.md#bit2cfetchticker) +* [bitbank](/exchanges/bitbank.md#bitbankfetchticker) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchticker) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchticker) +* [bitget](/exchanges/bitget.md#bitgetfetchticker) +* [bithumb](/exchanges/bithumb.md#bithumbfetchticker) +* [bitmart](/exchanges/bitmart.md#bitmartfetchticker) +* [bitmex](/exchanges/bitmex.md#bitmexfetchticker) +* [bitopro](/exchanges/bitopro.md#bitoprofetchticker) +* [bitrue](/exchanges/bitrue.md#bitruefetchticker) +* [bitso](/exchanges/bitso.md#bitsofetchticker) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchticker) +* [bitteam](/exchanges/bitteam.md#bitteamfetchticker) +* [bittrade](/exchanges/bittrade.md#bittradefetchticker) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchticker) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchticker) +* [blofin](/exchanges/blofin.md#blofinfetchticker) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchticker) +* [btcbox](/exchanges/btcbox.md#btcboxfetchticker) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchticker) +* [btcturk](/exchanges/btcturk.md#btcturkfetchticker) +* [bybit](/exchanges/bybit.md#bybitfetchticker) +* [cex](/exchanges/cex.md#cexfetchticker) +* [coinbase](/exchanges/coinbase.md#coinbasefetchticker) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchticker) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchticker) +* [coincatch](/exchanges/coincatch.md#coincatchfetchticker) +* [coincheck](/exchanges/coincheck.md#coincheckfetchticker) +* [coinex](/exchanges/coinex.md#coinexfetchticker) +* [coinmate](/exchanges/coinmate.md#coinmatefetchticker) +* [coinone](/exchanges/coinone.md#coinonefetchticker) +* [coinsph](/exchanges/coinsph.md#coinsphfetchticker) +* [coinspot](/exchanges/coinspot.md#coinspotfetchticker) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchticker) +* [defx](/exchanges/defx.md#defxfetchticker) +* [delta](/exchanges/delta.md#deltafetchticker) +* [deribit](/exchanges/deribit.md#deribitfetchticker) +* [derive](/exchanges/derive.md#derivefetchticker) +* [digifinex](/exchanges/digifinex.md#digifinexfetchticker) +* [exmo](/exchanges/exmo.md#exmofetchticker) +* [foxbit](/exchanges/foxbit.md#foxbitfetchticker) +* [gate](/exchanges/gate.md#gatefetchticker) +* [gemini](/exchanges/gemini.md#geminifetchticker) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchticker) +* [hibachi](/exchanges/hibachi.md#hibachifetchticker) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchticker) +* [hollaex](/exchanges/hollaex.md#hollaexfetchticker) +* [htx](/exchanges/htx.md#htxfetchticker) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchticker) +* [indodax](/exchanges/indodax.md#indodaxfetchticker) +* [kraken](/exchanges/kraken.md#krakenfetchticker) +* [kucoin](/exchanges/kucoin.md#kucoinfetchticker) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchticker) +* [latoken](/exchanges/latoken.md#latokenfetchticker) +* [lbank](/exchanges/lbank.md#lbankfetchticker) +* [luno](/exchanges/luno.md#lunofetchticker) +* [mercado](/exchanges/mercado.md#mercadofetchticker) +* [mexc](/exchanges/mexc.md#mexcfetchticker) +* [ndax](/exchanges/ndax.md#ndaxfetchticker) +* [novadax](/exchanges/novadax.md#novadaxfetchticker) +* [oceanex](/exchanges/oceanex.md#oceanexfetchticker) +* [okcoin](/exchanges/okcoin.md#okcoinfetchticker) +* [okx](/exchanges/okx.md#okxfetchticker) +* [onetrading](/exchanges/onetrading.md#onetradingfetchticker) +* [oxfun](/exchanges/oxfun.md#oxfunfetchticker) +* [p2b](/exchanges/p2b.md#p2bfetchticker) +* [paradex](/exchanges/paradex.md#paradexfetchticker) +* [paymium](/exchanges/paymium.md#paymiumfetchticker) +* [phemex](/exchanges/phemex.md#phemexfetchticker) +* [poloniex](/exchanges/poloniex.md#poloniexfetchticker) +* [probit](/exchanges/probit.md#probitfetchticker) +* [timex](/exchanges/timex.md#timexfetchticker) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchticker) +* [upbit](/exchanges/upbit.md#upbitfetchticker) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchticker) +* [whitebit](/exchanges/whitebit.md#whitebitfetchticker) +* [xt](/exchanges/xt.md#xtfetchticker) +* [yobit](/exchanges/yobit.md#yobitfetchticker) +* [zaif](/exchanges/zaif.md#zaiffetchticker) +* [zonda](/exchanges/zonda.md#zondafetchticker) + +--- + + + +## fetchTickerWs +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the cex api endpoint | + +##### Supported exchanges +* [cex](/exchanges/cex.md#cexfetchtickerws) +* [lbank](/exchanges/lbank.md#lbankfetchtickerws) + +--- + + + +## fetchTickers +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbols of the markets to fetch tickers for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchtickers) +* [apex](/exchanges/apex.md#apexfetchtickers) +* [ascendex](/exchanges/ascendex.md#ascendexfetchtickers) +* [backpack](/exchanges/backpack.md#backpackfetchtickers) +* [bigone](/exchanges/bigone.md#bigonefetchtickers) +* [binance](/exchanges/binance.md#binancefetchtickers) +* [bingx](/exchanges/bingx.md#bingxfetchtickers) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchtickers) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchtickers) +* [bitget](/exchanges/bitget.md#bitgetfetchtickers) +* [bithumb](/exchanges/bithumb.md#bithumbfetchtickers) +* [bitmart](/exchanges/bitmart.md#bitmartfetchtickers) +* [bitmex](/exchanges/bitmex.md#bitmexfetchtickers) +* [bitopro](/exchanges/bitopro.md#bitoprofetchtickers) +* [bitrue](/exchanges/bitrue.md#bitruefetchtickers) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchtickers) +* [bitteam](/exchanges/bitteam.md#bitteamfetchtickers) +* [bittrade](/exchanges/bittrade.md#bittradefetchtickers) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchtickers) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchtickers) +* [blofin](/exchanges/blofin.md#blofinfetchtickers) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchtickers) +* [btcbox](/exchanges/btcbox.md#btcboxfetchtickers) +* [btcturk](/exchanges/btcturk.md#btcturkfetchtickers) +* [bybit](/exchanges/bybit.md#bybitfetchtickers) +* [cex](/exchanges/cex.md#cexfetchtickers) +* [coinbase](/exchanges/coinbase.md#coinbasefetchtickers) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchtickers) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchtickers) +* [coincatch](/exchanges/coincatch.md#coincatchfetchtickers) +* [coinex](/exchanges/coinex.md#coinexfetchtickers) +* [coinmate](/exchanges/coinmate.md#coinmatefetchtickers) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchtickers) +* [coinone](/exchanges/coinone.md#coinonefetchtickers) +* [coinsph](/exchanges/coinsph.md#coinsphfetchtickers) +* [coinspot](/exchanges/coinspot.md#coinspotfetchtickers) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchtickers) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchtickers) +* [defx](/exchanges/defx.md#defxfetchtickers) +* [delta](/exchanges/delta.md#deltafetchtickers) +* [deribit](/exchanges/deribit.md#deribitfetchtickers) +* [digifinex](/exchanges/digifinex.md#digifinexfetchtickers) +* [exmo](/exchanges/exmo.md#exmofetchtickers) +* [foxbit](/exchanges/foxbit.md#foxbitfetchtickers) +* [gate](/exchanges/gate.md#gatefetchtickers) +* [gemini](/exchanges/gemini.md#geminifetchtickers) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchtickers) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchtickers) +* [hollaex](/exchanges/hollaex.md#hollaexfetchtickers) +* [htx](/exchanges/htx.md#htxfetchtickers) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchtickers) +* [indodax](/exchanges/indodax.md#indodaxfetchtickers) +* [kraken](/exchanges/kraken.md#krakenfetchtickers) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchtickers) +* [kucoin](/exchanges/kucoin.md#kucoinfetchtickers) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchtickers) +* [latoken](/exchanges/latoken.md#latokenfetchtickers) +* [lbank](/exchanges/lbank.md#lbankfetchtickers) +* [luno](/exchanges/luno.md#lunofetchtickers) +* [mexc](/exchanges/mexc.md#mexcfetchtickers) +* [novadax](/exchanges/novadax.md#novadaxfetchtickers) +* [oceanex](/exchanges/oceanex.md#oceanexfetchtickers) +* [okcoin](/exchanges/okcoin.md#okcoinfetchtickers) +* [okx](/exchanges/okx.md#okxfetchtickers) +* [onetrading](/exchanges/onetrading.md#onetradingfetchtickers) +* [oxfun](/exchanges/oxfun.md#oxfunfetchtickers) +* [p2b](/exchanges/p2b.md#p2bfetchtickers) +* [paradex](/exchanges/paradex.md#paradexfetchtickers) +* [phemex](/exchanges/phemex.md#phemexfetchtickers) +* [poloniex](/exchanges/poloniex.md#poloniexfetchtickers) +* [probit](/exchanges/probit.md#probitfetchtickers) +* [timex](/exchanges/timex.md#timexfetchtickers) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchtickers) +* [toobit](/exchanges/toobit.md#toobitfetchtickers) +* [upbit](/exchanges/upbit.md#upbitfetchtickers) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchtickers) +* [whitebit](/exchanges/whitebit.md#whitebitfetchtickers) +* [xt](/exchanges/xt.md#xtfetchtickers) +* [yobit](/exchanges/yobit.md#yobitfetchtickers) + +--- + + + +## fetchTime +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchtime) +* [apex](/exchanges/apex.md#apexfetchtime) +* [ascendex](/exchanges/ascendex.md#ascendexfetchtime) +* [backpack](/exchanges/backpack.md#backpackfetchtime) +* [bigone](/exchanges/bigone.md#bigonefetchtime) +* [binance](/exchanges/binance.md#binancefetchtime) +* [bingx](/exchanges/bingx.md#bingxfetchtime) +* [bitget](/exchanges/bitget.md#bitgetfetchtime) +* [bitmart](/exchanges/bitmart.md#bitmartfetchtime) +* [bitrue](/exchanges/bitrue.md#bitruefetchtime) +* [bittrade](/exchanges/bittrade.md#bittradefetchtime) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchtime) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchtime) +* [bybit](/exchanges/bybit.md#bybitfetchtime) +* [cex](/exchanges/cex.md#cexfetchtime) +* [coinbase](/exchanges/coinbase.md#coinbasefetchtime) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchtime) +* [coincatch](/exchanges/coincatch.md#coincatchfetchtime) +* [coinex](/exchanges/coinex.md#coinexfetchtime) +* [coinsph](/exchanges/coinsph.md#coinsphfetchtime) +* [defx](/exchanges/defx.md#defxfetchtime) +* [delta](/exchanges/delta.md#deltafetchtime) +* [deribit](/exchanges/deribit.md#deribitfetchtime) +* [derive](/exchanges/derive.md#derivefetchtime) +* [digifinex](/exchanges/digifinex.md#digifinexfetchtime) +* [gate](/exchanges/gate.md#gatefetchtime) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchtime) +* [hibachi](/exchanges/hibachi.md#hibachifetchtime) +* [htx](/exchanges/htx.md#htxfetchtime) +* [indodax](/exchanges/indodax.md#indodaxfetchtime) +* [kraken](/exchanges/kraken.md#krakenfetchtime) +* [kucoin](/exchanges/kucoin.md#kucoinfetchtime) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchtime) +* [latoken](/exchanges/latoken.md#latokenfetchtime) +* [lbank](/exchanges/lbank.md#lbankfetchtime) +* [mexc](/exchanges/mexc.md#mexcfetchtime) +* [modetrade](/exchanges/modetrade.md#modetradefetchtime) +* [novadax](/exchanges/novadax.md#novadaxfetchtime) +* [oceanex](/exchanges/oceanex.md#oceanexfetchtime) +* [okcoin](/exchanges/okcoin.md#okcoinfetchtime) +* [okx](/exchanges/okx.md#okxfetchtime) +* [onetrading](/exchanges/onetrading.md#onetradingfetchtime) +* [paradex](/exchanges/paradex.md#paradexfetchtime) +* [poloniex](/exchanges/poloniex.md#poloniexfetchtime) +* [probit](/exchanges/probit.md#probitfetchtime) +* [timex](/exchanges/timex.md#timexfetchtime) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchtime) +* [toobit](/exchanges/toobit.md#toobitfetchtime) +* [whitebit](/exchanges/whitebit.md#whitebitfetchtime) +* [woo](/exchanges/woo.md#woofetchtime) +* [woofipro](/exchanges/woofipro.md#woofiprofetchtime) +* [xt](/exchanges/xt.md#xtfetchtime) + +--- + + + +## fetchTrades +get the list of most recent trades for a particular symbol + +**Kind**: instance +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | +| params.method | string | No | method, default: marketPublicGetV1beta3CryptoLocTrades | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchtrades) +* [apex](/exchanges/apex.md#apexfetchtrades) +* [ascendex](/exchanges/ascendex.md#ascendexfetchtrades) +* [backpack](/exchanges/backpack.md#backpackfetchtrades) +* [bigone](/exchanges/bigone.md#bigonefetchtrades) +* [binance](/exchanges/binance.md#binancefetchtrades) +* [bingx](/exchanges/bingx.md#bingxfetchtrades) +* [bit2c](/exchanges/bit2c.md#bit2cfetchtrades) +* [bitbank](/exchanges/bitbank.md#bitbankfetchtrades) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchtrades) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchtrades) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchtrades) +* [bitget](/exchanges/bitget.md#bitgetfetchtrades) +* [bithumb](/exchanges/bithumb.md#bithumbfetchtrades) +* [bitmart](/exchanges/bitmart.md#bitmartfetchtrades) +* [bitmex](/exchanges/bitmex.md#bitmexfetchtrades) +* [bitopro](/exchanges/bitopro.md#bitoprofetchtrades) +* [bitrue](/exchanges/bitrue.md#bitruefetchtrades) +* [bitso](/exchanges/bitso.md#bitsofetchtrades) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchtrades) +* [bitteam](/exchanges/bitteam.md#bitteamfetchtrades) +* [bittrade](/exchanges/bittrade.md#bittradefetchtrades) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchtrades) +* [blofin](/exchanges/blofin.md#blofinfetchtrades) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchtrades) +* [btcbox](/exchanges/btcbox.md#btcboxfetchtrades) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchtrades) +* [btcturk](/exchanges/btcturk.md#btcturkfetchtrades) +* [bybit](/exchanges/bybit.md#bybitfetchtrades) +* [cex](/exchanges/cex.md#cexfetchtrades) +* [coinbase](/exchanges/coinbase.md#coinbasefetchtrades) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchtrades) +* [coincatch](/exchanges/coincatch.md#coincatchfetchtrades) +* [coincheck](/exchanges/coincheck.md#coincheckfetchtrades) +* [coinex](/exchanges/coinex.md#coinexfetchtrades) +* [coinmate](/exchanges/coinmate.md#coinmatefetchtrades) +* [coinmetro](/exchanges/coinmetro.md#coinmetrofetchtrades) +* [coinone](/exchanges/coinone.md#coinonefetchtrades) +* [coinsph](/exchanges/coinsph.md#coinsphfetchtrades) +* [coinspot](/exchanges/coinspot.md#coinspotfetchtrades) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchtrades) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchtrades) +* [defx](/exchanges/defx.md#defxfetchtrades) +* [delta](/exchanges/delta.md#deltafetchtrades) +* [deribit](/exchanges/deribit.md#deribitfetchtrades) +* [derive](/exchanges/derive.md#derivefetchtrades) +* [digifinex](/exchanges/digifinex.md#digifinexfetchtrades) +* [exmo](/exchanges/exmo.md#exmofetchtrades) +* [foxbit](/exchanges/foxbit.md#foxbitfetchtrades) +* [gate](/exchanges/gate.md#gatefetchtrades) +* [gemini](/exchanges/gemini.md#geminifetchtrades) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchtrades) +* [hibachi](/exchanges/hibachi.md#hibachifetchtrades) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchtrades) +* [hollaex](/exchanges/hollaex.md#hollaexfetchtrades) +* [htx](/exchanges/htx.md#htxfetchtrades) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchtrades) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchtrades) +* [indodax](/exchanges/indodax.md#indodaxfetchtrades) +* [kraken](/exchanges/kraken.md#krakenfetchtrades) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturesfetchtrades) +* [kucoin](/exchanges/kucoin.md#kucoinfetchtrades) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchtrades) +* [latoken](/exchanges/latoken.md#latokenfetchtrades) +* [lbank](/exchanges/lbank.md#lbankfetchtrades) +* [luno](/exchanges/luno.md#lunofetchtrades) +* [mercado](/exchanges/mercado.md#mercadofetchtrades) +* [mexc](/exchanges/mexc.md#mexcfetchtrades) +* [modetrade](/exchanges/modetrade.md#modetradefetchtrades) +* [ndax](/exchanges/ndax.md#ndaxfetchtrades) +* [novadax](/exchanges/novadax.md#novadaxfetchtrades) +* [oceanex](/exchanges/oceanex.md#oceanexfetchtrades) +* [okcoin](/exchanges/okcoin.md#okcoinfetchtrades) +* [okx](/exchanges/okx.md#okxfetchtrades) +* [oxfun](/exchanges/oxfun.md#oxfunfetchtrades) +* [p2b](/exchanges/p2b.md#p2bfetchtrades) +* [paradex](/exchanges/paradex.md#paradexfetchtrades) +* [paymium](/exchanges/paymium.md#paymiumfetchtrades) +* [phemex](/exchanges/phemex.md#phemexfetchtrades) +* [poloniex](/exchanges/poloniex.md#poloniexfetchtrades) +* [probit](/exchanges/probit.md#probitfetchtrades) +* [timex](/exchanges/timex.md#timexfetchtrades) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchtrades) +* [toobit](/exchanges/toobit.md#toobitfetchtrades) +* [upbit](/exchanges/upbit.md#upbitfetchtrades) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangefetchtrades) +* [whitebit](/exchanges/whitebit.md#whitebitfetchtrades) +* [woo](/exchanges/woo.md#woofetchtrades) +* [woofipro](/exchanges/woofipro.md#woofiprofetchtrades) +* [xt](/exchanges/xt.md#xtfetchtrades) +* [yobit](/exchanges/yobit.md#yobitfetchtrades) +* [zaif](/exchanges/zaif.md#zaiffetchtrades) +* [zonda](/exchanges/zonda.md#zondafetchtrades) + +--- + + + +## fetchTradesWs +get the list of most recent trades for a particular symbol + +**Kind**: instance +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [lbank](/exchanges/lbank.md#lbankfetchtradesws) + +--- + + + +## fetchTradingFee +fetch the trading fees for a market + +**Kind**: instance +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch trading fees in a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchtradingfee) +* [bingx](/exchanges/bingx.md#bingxfetchtradingfee) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchtradingfee) +* [bitget](/exchanges/bitget.md#bitgetfetchtradingfee) +* [bitmart](/exchanges/bitmart.md#bitmartfetchtradingfee) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchtradingfee) +* [bybit](/exchanges/bybit.md#bybitfetchtradingfee) +* [coinex](/exchanges/coinex.md#coinexfetchtradingfee) +* [coinmate](/exchanges/coinmate.md#coinmatefetchtradingfee) +* [coinsph](/exchanges/coinsph.md#coinsphfetchtradingfee) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchtradingfee) +* [digifinex](/exchanges/digifinex.md#digifinexfetchtradingfee) +* [gate](/exchanges/gate.md#gatefetchtradingfee) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchtradingfee) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchtradingfee) +* [htx](/exchanges/htx.md#htxfetchtradingfee) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchtradingfee) +* [kraken](/exchanges/kraken.md#krakenfetchtradingfee) +* [kucoin](/exchanges/kucoin.md#kucoinfetchtradingfee) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchtradingfee) +* [latoken](/exchanges/latoken.md#latokenfetchtradingfee) +* [lbank](/exchanges/lbank.md#lbankfetchtradingfee) +* [luno](/exchanges/luno.md#lunofetchtradingfee) +* [mexc](/exchanges/mexc.md#mexcfetchtradingfee) +* [okx](/exchanges/okx.md#okxfetchtradingfee) +* [timex](/exchanges/timex.md#timexfetchtradingfee) +* [upbit](/exchanges/upbit.md#upbitfetchtradingfee) +* [woo](/exchanges/woo.md#woofetchtradingfee) + +--- + + + +## fetchTradingFees +fetch the trading fees for multiple markets + +**Kind**: instance +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexfetchtradingfees) +* [binance](/exchanges/binance.md#binancefetchtradingfees) +* [bit2c](/exchanges/bit2c.md#bit2cfetchtradingfees) +* [bitbank](/exchanges/bitbank.md#bitbankfetchtradingfees) +* [bitfinex](/exchanges/bitfinex.md#bitfinexfetchtradingfees) +* [bitget](/exchanges/bitget.md#bitgetfetchtradingfees) +* [bitopro](/exchanges/bitopro.md#bitoprofetchtradingfees) +* [bitso](/exchanges/bitso.md#bitsofetchtradingfees) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchtradingfees) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchtradingfees) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchtradingfees) +* [bybit](/exchanges/bybit.md#bybitfetchtradingfees) +* [cex](/exchanges/cex.md#cexfetchtradingfees) +* [coinbase](/exchanges/coinbase.md#coinbasefetchtradingfees) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchtradingfees) +* [coincheck](/exchanges/coincheck.md#coincheckfetchtradingfees) +* [coinex](/exchanges/coinex.md#coinexfetchtradingfees) +* [coinsph](/exchanges/coinsph.md#coinsphfetchtradingfees) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchtradingfees) +* [cryptomus](/exchanges/cryptomus.md#cryptomusfetchtradingfees) +* [deribit](/exchanges/deribit.md#deribitfetchtradingfees) +* [exmo](/exchanges/exmo.md#exmofetchtradingfees) +* [foxbit](/exchanges/foxbit.md#foxbitfetchtradingfees) +* [gate](/exchanges/gate.md#gatefetchtradingfees) +* [gemini](/exchanges/gemini.md#geminifetchtradingfees) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchtradingfees) +* [hibachi](/exchanges/hibachi.md#hibachifetchtradingfees) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchtradingfees) +* [hollaex](/exchanges/hollaex.md#hollaexfetchtradingfees) +* [independentreserve](/exchanges/independentreserve.md#independentreservefetchtradingfees) +* [lbank](/exchanges/lbank.md#lbankfetchtradingfees) +* [modetrade](/exchanges/modetrade.md#modetradefetchtradingfees) +* [oceanex](/exchanges/oceanex.md#oceanexfetchtradingfees) +* [onetrading](/exchanges/onetrading.md#onetradingfetchtradingfees) +* [poloniex](/exchanges/poloniex.md#poloniexfetchtradingfees) +* [toobit](/exchanges/toobit.md#toobitfetchtradingfees) +* [upbit](/exchanges/upbit.md#upbitfetchtradingfees) +* [whitebit](/exchanges/whitebit.md#whitebitfetchtradingfees) +* [woo](/exchanges/woo.md#woofetchtradingfees) +* [woofipro](/exchanges/woofipro.md#woofiprofetchtradingfees) +* [yobit](/exchanges/yobit.md#yobitfetchtradingfees) + +--- + + + +## fetchTradingFeesWs +fetch the trading fees for multiple markets + +**Kind**: instance +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchtradingfeesws) + +--- + + + +## fetchTransactionFee +please use fetchDepositWithdrawFee instead + +**Kind**: instance +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the network code of the currency | + +##### Supported exchanges +* [bitmart](/exchanges/bitmart.md#bitmartfetchtransactionfee) +* [indodax](/exchanges/indodax.md#indodaxfetchtransactionfee) +* [kucoin](/exchanges/kucoin.md#kucoinfetchtransactionfee) + +--- + + + +## fetchTransactionFees +please use fetchDepositWithdrawFees instead + +**Kind**: instance +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | not used by binance fetchTransactionFees () | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchtransactionfees) +* [bitso](/exchanges/bitso.md#bitsofetchtransactionfees) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchtransactionfees) +* [exmo](/exchanges/exmo.md#exmofetchtransactionfees) +* [gate](/exchanges/gate.md#gatefetchtransactionfees) +* [lbank](/exchanges/lbank.md#lbankfetchtransactionfees) +* [mexc](/exchanges/mexc.md#mexcfetchtransactionfees) +* [whitebit](/exchanges/whitebit.md#whitebitfetchtransactionfees) + +--- + + + +## fetchTransactions +Fetch all transactions (deposits and withdrawals) made from an account. + +**Kind**: instance +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawal structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [foxbit](/exchanges/foxbit.md#foxbitfetchtransactions) +* [latoken](/exchanges/latoken.md#latokenfetchtransactions) + +--- + + + +## fetchTransfer +fetches a transfer + +**Kind**: instance +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | transfer id | +| code | string | No | not used by mexc fetchTransfer | +| params | object | Yes | extra parameters specific to the exchange api endpoint | + +##### Supported exchanges +* [mexc](/exchanges/mexc.md#mexcfetchtransfer) + +--- + + + +## fetchTransfers +fetch a history of internal transfers made on an account + +**Kind**: instance +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.internal | boolean | No | default false, when true will fetch pay trade history | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancefetchtransfers) +* [bingx](/exchanges/bingx.md#bingxfetchtransfers) +* [bitget](/exchanges/bitget.md#bitgetfetchtransfers) +* [bitmart](/exchanges/bitmart.md#bitmartfetchtransfers) +* [bitrue](/exchanges/bitrue.md#bitruefetchtransfers) +* [bybit](/exchanges/bybit.md#bybitfetchtransfers) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchtransfers) +* [coinex](/exchanges/coinex.md#coinexfetchtransfers) +* [deribit](/exchanges/deribit.md#deribitfetchtransfers) +* [digifinex](/exchanges/digifinex.md#digifinexfetchtransfers) +* [latoken](/exchanges/latoken.md#latokenfetchtransfers) +* [mexc](/exchanges/mexc.md#mexcfetchtransfers) +* [okx](/exchanges/okx.md#okxfetchtransfers) +* [oxfun](/exchanges/oxfun.md#oxfunfetchtransfers) +* [paradex](/exchanges/paradex.md#paradexfetchtransfers) +* [phemex](/exchanges/phemex.md#phemexfetchtransfers) +* [woo](/exchanges/woo.md#woofetchtransfers) + +--- + + + +## fetchUnderlyingAssets +fetches the market ids of underlying assets for a specific contract market type + +**Kind**: instance +**Returns**: Array<object> - a list of [underlying assets](https://docs.ccxt.com/#/?id=underlying-assets-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | exchange specific params | +| params.type | string | No | the contract market type, 'option', 'swap' or 'future', the default is 'option' | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gatefetchunderlyingassets) +* [okx](/exchanges/okx.md#okxfetchunderlyingassets) + +--- + + + +## fetchVolatilityHistory +fetch the historical volatility of an option market based on an underlying asset + +**Kind**: instance +**Returns**: Array<object> - a list of [volatility history objects](https://docs.ccxt.com/#/?id=volatility-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.period | int | No | the period in days to fetch the volatility for: 7,14,21,30,60,90,180,270 | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitfetchvolatilityhistory) +* [deribit](/exchanges/deribit.md#deribitfetchvolatilityhistory) + +--- + + + +## fetchWithdrawal +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | withdrawal id | +| code | string | Yes | not used by bitmart.fetchWithdrawal | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bitmart](/exchanges/bitmart.md#bitmartfetchwithdrawal) +* [bitopro](/exchanges/bitopro.md#bitoprofetchwithdrawal) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchwithdrawal) +* [exmo](/exchanges/exmo.md#exmofetchwithdrawal) +* [hollaex](/exchanges/hollaex.md#hollaexfetchwithdrawal) +* [okx](/exchanges/okx.md#okxfetchwithdrawal) +* [upbit](/exchanges/upbit.md#upbitfetchwithdrawal) + +--- + + + +## fetchWithdrawals +fetch all withdrawals made from an account + +**Kind**: instance +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawal structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacafetchwithdrawals) +* [ascendex](/exchanges/ascendex.md#ascendexfetchwithdrawals) +* [backpack](/exchanges/backpack.md#backpackfetchwithdrawals) +* [bigone](/exchanges/bigone.md#bigonefetchwithdrawals) +* [binance](/exchanges/binance.md#binancefetchwithdrawals) +* [bingx](/exchanges/bingx.md#bingxfetchwithdrawals) +* [bitbns](/exchanges/bitbns.md#bitbnsfetchwithdrawals) +* [bitflyer](/exchanges/bitflyer.md#bitflyerfetchwithdrawals) +* [bitget](/exchanges/bitget.md#bitgetfetchwithdrawals) +* [bitmart](/exchanges/bitmart.md#bitmartfetchwithdrawals) +* [bitopro](/exchanges/bitopro.md#bitoprofetchwithdrawals) +* [bitrue](/exchanges/bitrue.md#bitruefetchwithdrawals) +* [bitstamp](/exchanges/bitstamp.md#bitstampfetchwithdrawals) +* [bittrade](/exchanges/bittrade.md#bittradefetchwithdrawals) +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchwithdrawals) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomfetchwithdrawals) +* [blofin](/exchanges/blofin.md#blofinfetchwithdrawals) +* [btcalpha](/exchanges/btcalpha.md#btcalphafetchwithdrawals) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketsfetchwithdrawals) +* [bybit](/exchanges/bybit.md#bybitfetchwithdrawals) +* [coinbase](/exchanges/coinbase.md#coinbasefetchwithdrawals) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangefetchwithdrawals) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalfetchwithdrawals) +* [coincatch](/exchanges/coincatch.md#coincatchfetchwithdrawals) +* [coincheck](/exchanges/coincheck.md#coincheckfetchwithdrawals) +* [coinex](/exchanges/coinex.md#coinexfetchwithdrawals) +* [coinsph](/exchanges/coinsph.md#coinsphfetchwithdrawals) +* [cryptocom](/exchanges/cryptocom.md#cryptocomfetchwithdrawals) +* [deribit](/exchanges/deribit.md#deribitfetchwithdrawals) +* [derive](/exchanges/derive.md#derivefetchwithdrawals) +* [digifinex](/exchanges/digifinex.md#digifinexfetchwithdrawals) +* [exmo](/exchanges/exmo.md#exmofetchwithdrawals) +* [foxbit](/exchanges/foxbit.md#foxbitfetchwithdrawals) +* [gate](/exchanges/gate.md#gatefetchwithdrawals) +* [hashkey](/exchanges/hashkey.md#hashkeyfetchwithdrawals) +* [hibachi](/exchanges/hibachi.md#hibachifetchwithdrawals) +* [hitbtc](/exchanges/hitbtc.md#hitbtcfetchwithdrawals) +* [hollaex](/exchanges/hollaex.md#hollaexfetchwithdrawals) +* [htx](/exchanges/htx.md#htxfetchwithdrawals) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidfetchwithdrawals) +* [kraken](/exchanges/kraken.md#krakenfetchwithdrawals) +* [kucoin](/exchanges/kucoin.md#kucoinfetchwithdrawals) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesfetchwithdrawals) +* [lbank](/exchanges/lbank.md#lbankfetchwithdrawals) +* [mexc](/exchanges/mexc.md#mexcfetchwithdrawals) +* [modetrade](/exchanges/modetrade.md#modetradefetchwithdrawals) +* [ndax](/exchanges/ndax.md#ndaxfetchwithdrawals) +* [novadax](/exchanges/novadax.md#novadaxfetchwithdrawals) +* [okcoin](/exchanges/okcoin.md#okcoinfetchwithdrawals) +* [okx](/exchanges/okx.md#okxfetchwithdrawals) +* [oxfun](/exchanges/oxfun.md#oxfunfetchwithdrawals) +* [paradex](/exchanges/paradex.md#paradexfetchwithdrawals) +* [phemex](/exchanges/phemex.md#phemexfetchwithdrawals) +* [poloniex](/exchanges/poloniex.md#poloniexfetchwithdrawals) +* [probit](/exchanges/probit.md#probitfetchwithdrawals) +* [timex](/exchanges/timex.md#timexfetchwithdrawals) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptofetchwithdrawals) +* [toobit](/exchanges/toobit.md#toobitfetchwithdrawals) +* [upbit](/exchanges/upbit.md#upbitfetchwithdrawals) +* [woo](/exchanges/woo.md#woofetchwithdrawals) +* [woofipro](/exchanges/woofipro.md#woofiprofetchwithdrawals) +* [xt](/exchanges/xt.md#xtfetchwithdrawals) + +--- + + + +## fetchWithdrawalsWs +fetch all withdrawals made from an account + +**Kind**: instance +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavofetchwithdrawalsws) + +--- + + + +## isUnifiedEnabled +returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled + +**Kind**: instance +**Returns**: any - [enableUnifiedMargin, enableUnifiedAccount] + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitisunifiedenabled) + +--- + + + +## loadMigrationStatus +loads the migration status for the account (hf or not) + +**Kind**: instance +**Returns**: any - ignore + + +| Param | Type | Description | +| --- | --- | --- | +| force | boolean | load account state for non hf | + +##### Supported exchanges +* [kucoin](/exchanges/kucoin.md#kucoinloadmigrationstatus) + +--- + + + +## loadUnifiedStatus +returns unifiedAccount so the user can check if the unified account is enabled + +**Kind**: instance +**Returns**: boolean - true or false if the enabled unified account is enabled or not and sets the unifiedAccount option if it is undefined + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gateloadunifiedstatus) + +--- + + + +## market +calculates the presumptive fee that would be charged for an order + +**Kind**: instance +**Returns**: object - contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order + + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified market symbol | +| type | string | not used by btcmarkets.calculateFee | +| side | string | not used by btcmarkets.calculateFee | +| amount | float | how much you want to trade, in units of the base currency on most exchanges, or number of contracts | +| price | float | the price for the order to be filled at, in units of the quote currency | +| takerOrMaker | string | 'taker' or 'maker' | +| params | object | | + +##### Supported exchanges +* [<anonymous>](/exchanges/<anonymous>.md#<anonymous>market) + +--- + + + +## redeemGiftCode +redeem gift code + +**Kind**: instance +**Returns**: object - response from the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| giftcardCode | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binanceredeemgiftcode) + +--- + + + +## reduceMargin +remove margin from a position + +**Kind**: instance +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexreducemargin) +* [binance](/exchanges/binance.md#binancereducemargin) +* [bitget](/exchanges/bitget.md#bitgetreducemargin) +* [coincatch](/exchanges/coincatch.md#coincatchreducemargin) +* [coinex](/exchanges/coinex.md#coinexreducemargin) +* [delta](/exchanges/delta.md#deltareducemargin) +* [digifinex](/exchanges/digifinex.md#digifinexreducemargin) +* [exmo](/exchanges/exmo.md#exmoreducemargin) +* [gate](/exchanges/gate.md#gatereducemargin) +* [hitbtc](/exchanges/hitbtc.md#hitbtcreducemargin) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidreducemargin) +* [mexc](/exchanges/mexc.md#mexcreducemargin) +* [okx](/exchanges/okx.md#okxreducemargin) +* [poloniex](/exchanges/poloniex.md#poloniexreducemargin) +* [woo](/exchanges/woo.md#wooreducemargin) +* [xt](/exchanges/xt.md#xtreducemargin) + +--- + + + +## repayCrossMargin +repay borrowed margin and interest + +**Kind**: instance +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to repay margin in a portfolio margin account | +| params.repayCrossMarginMethod | string | No | *portfolio margin only* 'papiPostRepayLoan' (default), 'papiPostMarginRepayDebt' (alternative) | +| params.specifyRepayAssets | string | No | *portfolio margin papiPostMarginRepayDebt only* specific asset list to repay debt | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancerepaycrossmargin) +* [bitget](/exchanges/bitget.md#bitgetrepaycrossmargin) +* [bybit](/exchanges/bybit.md#bybitrepaycrossmargin) +* [gate](/exchanges/gate.md#gaterepaycrossmargin) +* [htx](/exchanges/htx.md#htxrepaycrossmargin) +* [kucoin](/exchanges/kucoin.md#kucoinrepaycrossmargin) +* [okx](/exchanges/okx.md#okxrepaycrossmargin) + +--- + + + +## repayIsolatedMargin +repay borrowed margin and interest + +**Kind**: instance +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for isolated margin | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancerepayisolatedmargin) +* [bitget](/exchanges/bitget.md#bitgetrepayisolatedmargin) +* [bitmart](/exchanges/bitmart.md#bitmartrepayisolatedmargin) +* [coinex](/exchanges/coinex.md#coinexrepayisolatedmargin) +* [htx](/exchanges/htx.md#htxrepayisolatedmargin) +* [kucoin](/exchanges/kucoin.md#kucoinrepayisolatedmargin) + +--- + + + +## repayMargin +repay borrowed margin and interest + +**Kind**: instance +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.mode | string | No | 'all' or 'partial' payment mode, extra parameter required for isolated margin | +| params.id | string | No | '34267567' loan id, extra parameter required for isolated margin | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gaterepaymargin) +* [woo](/exchanges/woo.md#woorepaymargin) + +--- + + + +## reserveRequestWeight +Instead of trading to increase the address based rate limits, this action allows reserving additional actions for 0.0005 USDC per request. The cost is paid from the Perps balance. + +**Kind**: instance +**Returns**: object - a response object + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| weight | number | Yes | the weight to reserve, 1 weight = 1 action, 0.0005 USDC per action | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidreserverequestweight) + +--- + + + +## setLeverage +set the level of leverage for a market + +**Kind**: instance +**Returns**: object - response from the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexsetleverage) +* [ascendex](/exchanges/ascendex.md#ascendexsetleverage) +* [binance](/exchanges/binance.md#binancesetleverage) +* [bingx](/exchanges/bingx.md#bingxsetleverage) +* [bitget](/exchanges/bitget.md#bitgetsetleverage) +* [bitmart](/exchanges/bitmart.md#bitmartsetleverage) +* [bitmex](/exchanges/bitmex.md#bitmexsetleverage) +* [bitrue](/exchanges/bitrue.md#bitruesetleverage) +* [blofin](/exchanges/blofin.md#blofinsetleverage) +* [bybit](/exchanges/bybit.md#bybitsetleverage) +* [coincatch](/exchanges/coincatch.md#coincatchsetleverage) +* [coinex](/exchanges/coinex.md#coinexsetleverage) +* [defx](/exchanges/defx.md#defxsetleverage) +* [delta](/exchanges/delta.md#deltasetleverage) +* [digifinex](/exchanges/digifinex.md#digifinexsetleverage) +* [gate](/exchanges/gate.md#gatesetleverage) +* [hashkey](/exchanges/hashkey.md#hashkeysetleverage) +* [hitbtc](/exchanges/hitbtc.md#hitbtcsetleverage) +* [htx](/exchanges/htx.md#htxsetleverage) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidsetleverage) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturessetleverage) +* [kucoin](/exchanges/kucoin.md#kucoinsetleverage) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturessetleverage) +* [mexc](/exchanges/mexc.md#mexcsetleverage) +* [modetrade](/exchanges/modetrade.md#modetradesetleverage) +* [okx](/exchanges/okx.md#okxsetleverage) +* [paradex](/exchanges/paradex.md#paradexsetleverage) +* [phemex](/exchanges/phemex.md#phemexsetleverage) +* [poloniex](/exchanges/poloniex.md#poloniexsetleverage) +* [toobit](/exchanges/toobit.md#toobitsetleverage) +* [whitebit](/exchanges/whitebit.md#whitebitsetleverage) +* [woo](/exchanges/woo.md#woosetleverage) +* [woofipro](/exchanges/woofipro.md#woofiprosetleverage) +* [xt](/exchanges/xt.md#xtsetleverage) + +--- + + + +## setMargin +Either adds or reduces margin in an isolated position in order to set the margin to a specific value + +**Kind**: instance +**Returns**: object - A [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to set margin in | +| amount | float | Yes | the amount to set the margin to | +| params | object | No | parameters specific to the bingx api endpoint | + +##### Supported exchanges +* [bingx](/exchanges/bingx.md#bingxsetmargin) +* [bitfinex](/exchanges/bitfinex.md#bitfinexsetmargin) +* [bitrue](/exchanges/bitrue.md#bitruesetmargin) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalsetmargin) +* [phemex](/exchanges/phemex.md#phemexsetmargin) + +--- + + + +## setMarginMode +set margin mode to 'cross' or 'isolated' + +**Kind**: instance +**Returns**: object - response from the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexsetmarginmode) +* [binance](/exchanges/binance.md#binancesetmarginmode) +* [bingx](/exchanges/bingx.md#bingxsetmarginmode) +* [bitget](/exchanges/bitget.md#bitgetsetmarginmode) +* [bitmex](/exchanges/bitmex.md#bitmexsetmarginmode) +* [blofin](/exchanges/blofin.md#blofinsetmarginmode) +* [bybit](/exchanges/bybit.md#bybitsetmarginmode) +* [coincatch](/exchanges/coincatch.md#coincatchsetmarginmode) +* [coinex](/exchanges/coinex.md#coinexsetmarginmode) +* [digifinex](/exchanges/digifinex.md#digifinexsetmarginmode) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidsetmarginmode) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturessetmarginmode) +* [mexc](/exchanges/mexc.md#mexcsetmarginmode) +* [okx](/exchanges/okx.md#okxsetmarginmode) +* [paradex](/exchanges/paradex.md#paradexsetmarginmode) +* [phemex](/exchanges/phemex.md#phemexsetmarginmode) +* [toobit](/exchanges/toobit.md#toobitsetmarginmode) +* [xt](/exchanges/xt.md#xtsetmarginmode) + +--- + + + +## setPositionMode +set hedged to true or false for a market + +**Kind**: instance +**Returns**: object - response from the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by binance setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to set the position mode for a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binancesetpositionmode) +* [bingx](/exchanges/bingx.md#bingxsetpositionmode) +* [bitget](/exchanges/bitget.md#bitgetsetpositionmode) +* [bitmart](/exchanges/bitmart.md#bitmartsetpositionmode) +* [blofin](/exchanges/blofin.md#blofinsetpositionmode) +* [bybit](/exchanges/bybit.md#bybitsetpositionmode) +* [coincatch](/exchanges/coincatch.md#coincatchsetpositionmode) +* [gate](/exchanges/gate.md#gatesetpositionmode) +* [htx](/exchanges/htx.md#htxsetpositionmode) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturessetpositionmode) +* [mexc](/exchanges/mexc.md#mexcsetpositionmode) +* [okx](/exchanges/okx.md#okxsetpositionmode) +* [phemex](/exchanges/phemex.md#phemexsetpositionmode) +* [poloniex](/exchanges/poloniex.md#poloniexsetpositionmode) +* [woo](/exchanges/woo.md#woosetpositionmode) + +--- + + + +## signIn +sign in, must be called prior to using other authenticated methods + +**Kind**: instance +**Returns**: response from exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ndax](/exchanges/ndax.md#ndaxsignin) +* [probit](/exchanges/probit.md#probitsignin) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangesignin) + +--- + + + +## transfer +transfer currency internally between wallets on the same account + +**Kind**: instance +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.transferId | string | No | UUID, which is unique across the platform | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apextransfer) +* [ascendex](/exchanges/ascendex.md#ascendextransfer) +* [bigone](/exchanges/bigone.md#bigonetransfer) +* [binance](/exchanges/binance.md#binancetransfer) +* [bingx](/exchanges/bingx.md#bingxtransfer) +* [bitfinex](/exchanges/bitfinex.md#bitfinextransfer) +* [bitget](/exchanges/bitget.md#bitgettransfer) +* [bitmart](/exchanges/bitmart.md#bitmarttransfer) +* [bitrue](/exchanges/bitrue.md#bitruetransfer) +* [bitstamp](/exchanges/bitstamp.md#bitstamptransfer) +* [blofin](/exchanges/blofin.md#blofintransfer) +* [bybit](/exchanges/bybit.md#bybittransfer) +* [cex](/exchanges/cex.md#cextransfer) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationaltransfer) +* [coincatch](/exchanges/coincatch.md#coincatchtransfer) +* [coinex](/exchanges/coinex.md#coinextransfer) +* [deribit](/exchanges/deribit.md#deribittransfer) +* [digifinex](/exchanges/digifinex.md#digifinextransfer) +* [gate](/exchanges/gate.md#gatetransfer) +* [hashkey](/exchanges/hashkey.md#hashkeytransfer) +* [hitbtc](/exchanges/hitbtc.md#hitbtctransfer) +* [htx](/exchanges/htx.md#htxtransfer) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidtransfer) +* [kraken](/exchanges/kraken.md#krakentransfer) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturestransfer) +* [kucoin](/exchanges/kucoin.md#kucointransfer) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturestransfer) +* [latoken](/exchanges/latoken.md#latokentransfer) +* [mexc](/exchanges/mexc.md#mexctransfer) +* [novadax](/exchanges/novadax.md#novadaxtransfer) +* [okcoin](/exchanges/okcoin.md#okcointransfer) +* [okx](/exchanges/okx.md#okxtransfer) +* [oxfun](/exchanges/oxfun.md#oxfuntransfer) +* [paymium](/exchanges/paymium.md#paymiumtransfer) +* [phemex](/exchanges/phemex.md#phemextransfer) +* [poloniex](/exchanges/poloniex.md#poloniextransfer) +* [toobit](/exchanges/toobit.md#toobittransfer) +* [whitebit](/exchanges/whitebit.md#whitebittransfer) +* [woo](/exchanges/woo.md#wootransfer) +* [xt](/exchanges/xt.md#xttransfer) +* [zonda](/exchanges/zonda.md#zondatransfer) + +--- + + + +## transferOut +transfer from spot wallet to futures wallet + +**Kind**: instance +**Returns**: a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | str | Yes | Unified currency code | +| amount | float | Yes | Size of the transfer | +| params | dict | No | Exchange specific parameters | + +##### Supported exchanges +* [kraken](/exchanges/kraken.md#krakentransferout) +* [krakenfutures](/exchanges/krakenfutures.md#krakenfuturestransferout) + +--- + + + +## unWatchBidsAsks +unWatches best bid & ask for symbols + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchbidsasks) +* [mexc](/exchanges/mexc.md#mexcunwatchbidsasks) + +--- + + + +## unWatchMyTrades +unWatches information on multiple trades made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | +| params.executionFast | boolean | No | use fast execution | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitunwatchmytrades) + +--- + + + +## unWatchOHLCV +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchohlcv) +* [bingx](/exchanges/bingx.md#bingxunwatchohlcv) +* [bitfinex](/exchanges/bitfinex.md#bitfinexunwatchohlcv) +* [bitget](/exchanges/bitget.md#bitgetunwatchohlcv) +* [bybit](/exchanges/bybit.md#bybitunwatchohlcv) +* [coincatch](/exchanges/coincatch.md#coincatchunwatchohlcv) +* [cryptocom](/exchanges/cryptocom.md#cryptocomunwatchohlcv) +* [defx](/exchanges/defx.md#defxunwatchohlcv) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidunwatchohlcv) +* [kucoin](/exchanges/kucoin.md#kucoinunwatchohlcv) +* [mexc](/exchanges/mexc.md#mexcunwatchohlcv) +* [okx](/exchanges/okx.md#okxunwatchohlcv) + +--- + + + +## unWatchOHLCVForSymbols +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchohlcvforsymbols) +* [bybit](/exchanges/bybit.md#bybitunwatchohlcvforsymbols) +* [defx](/exchanges/defx.md#defxunwatchohlcvforsymbols) +* [okx](/exchanges/okx.md#okxunwatchohlcvforsymbols) + +--- + + + +## unWatchOrderBook +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchorderbook) +* [bingx](/exchanges/bingx.md#bingxunwatchorderbook) +* [bitget](/exchanges/bitget.md#bitgetunwatchorderbook) +* [bybit](/exchanges/bybit.md#bybitunwatchorderbook) +* [coincatch](/exchanges/coincatch.md#coincatchunwatchorderbook) +* [cryptocom](/exchanges/cryptocom.md#cryptocomunwatchorderbook) +* [defx](/exchanges/defx.md#defxunwatchorderbook) +* [derive](/exchanges/derive.md#deriveunwatchorderbook) +* [gate](/exchanges/gate.md#gateunwatchorderbook) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidunwatchorderbook) +* [kucoin](/exchanges/kucoin.md#kucoinunwatchorderbook) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesunwatchorderbook) +* [mexc](/exchanges/mexc.md#mexcunwatchorderbook) +* [okx](/exchanges/okx.md#okxunwatchorderbook) + +--- + + + +## unWatchOrderBookForSymbols +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2' | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchorderbookforsymbols) +* [bybit](/exchanges/bybit.md#bybitunwatchorderbookforsymbols) +* [cryptocom](/exchanges/cryptocom.md#cryptocomunwatchorderbookforsymbols) +* [defx](/exchanges/defx.md#defxunwatchorderbookforsymbols) +* [kucoin](/exchanges/kucoin.md#kucoinunwatchorderbookforsymbols) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesunwatchorderbookforsymbols) +* [okx](/exchanges/okx.md#okxunwatchorderbookforsymbols) + +--- + + + +## unWatchOrders +unWatches information on multiple orders made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchorders) +* [bybit](/exchanges/bybit.md#bybitunwatchorders) + +--- + + + +## unWatchPositions +unWatches from the stream channel + +**Kind**: instance +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols to watch positions for | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchpositions) +* [bybit](/exchanges/bybit.md#bybitunwatchpositions) + +--- + + + +## unWatchTicker +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchticker) +* [bingx](/exchanges/bingx.md#bingxunwatchticker) +* [bitfinex](/exchanges/bitfinex.md#bitfinexunwatchticker) +* [bitget](/exchanges/bitget.md#bitgetunwatchticker) +* [bybit](/exchanges/bybit.md#bybitunwatchticker) +* [coincatch](/exchanges/coincatch.md#coincatchunwatchticker) +* [cryptocom](/exchanges/cryptocom.md#cryptocomunwatchticker) +* [defx](/exchanges/defx.md#defxunwatchticker) +* [kucoin](/exchanges/kucoin.md#kucoinunwatchticker) +* [mexc](/exchanges/mexc.md#mexcunwatchticker) +* [okx](/exchanges/okx.md#okxunwatchticker) + +--- + + + +## unWatchTickers +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchtickers) +* [bybit](/exchanges/bybit.md#bybitunwatchtickers) +* [cryptocom](/exchanges/cryptocom.md#cryptocomunwatchtickers) +* [defx](/exchanges/defx.md#defxunwatchtickers) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidunwatchtickers) +* [mexc](/exchanges/mexc.md#mexcunwatchtickers) +* [okx](/exchanges/okx.md#okxunwatchtickers) + +--- + + + +## unWatchTrades +unWatches from the stream channel + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchtrades) +* [bingx](/exchanges/bingx.md#bingxunwatchtrades) +* [bitfinex](/exchanges/bitfinex.md#bitfinexunwatchtrades) +* [bitget](/exchanges/bitget.md#bitgetunwatchtrades) +* [bybit](/exchanges/bybit.md#bybitunwatchtrades) +* [coincatch](/exchanges/coincatch.md#coincatchunwatchtrades) +* [cryptocom](/exchanges/cryptocom.md#cryptocomunwatchtrades) +* [defx](/exchanges/defx.md#defxunwatchtrades) +* [derive](/exchanges/derive.md#deriveunwatchtrades) +* [gate](/exchanges/gate.md#gateunwatchtrades) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidunwatchtrades) +* [kucoin](/exchanges/kucoin.md#kucoinunwatchtrades) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesunwatchtrades) +* [mexc](/exchanges/mexc.md#mexcunwatchtrades) +* [okx](/exchanges/okx.md#okxunwatchtrades) + +--- + + + +## unWatchTradesForSymbols +unWatches from the stream channel + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackunwatchtradesforsymbols) +* [bybit](/exchanges/bybit.md#bybitunwatchtradesforsymbols) +* [cryptocom](/exchanges/cryptocom.md#cryptocomunwatchtradesforsymbols) +* [defx](/exchanges/defx.md#defxunwatchtradesforsymbols) +* [gate](/exchanges/gate.md#gateunwatchtradesforsymbols) +* [kucoin](/exchanges/kucoin.md#kucoinunwatchtradesforsymbols) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfuturesunwatchtradesforsymbols) +* [okx](/exchanges/okx.md#okxunwatchtradesforsymbols) + +--- + + + +## upgradeUnifiedTradeAccount +upgrades the account to unified trade account *warning* this is irreversible + +**Kind**: instance +**Returns**: any - nothing + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [bybit](/exchanges/bybit.md#bybitupgradeunifiedtradeaccount) + +--- + + + +## verifyGiftCode +verify gift code + +**Kind**: instance +**Returns**: object - response from the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | reference number id | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [binance](/exchanges/binance.md#binanceverifygiftcode) + +--- + + + +## watchBalance +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [ascendex](/exchanges/ascendex.md#ascendexwatchbalance) +* [bingx](/exchanges/bingx.md#bingxwatchbalance) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwatchbalance) +* [bitget](/exchanges/bitget.md#bitgetwatchbalance) +* [bitmart](/exchanges/bitmart.md#bitmartwatchbalance) +* [bitmex](/exchanges/bitmex.md#bitmexwatchbalance) +* [bitopro](/exchanges/bitopro.md#bitoprowatchbalance) +* [bitrue](/exchanges/bitrue.md#bitruewatchbalance) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomwatchbalance) +* [blofin](/exchanges/blofin.md#blofinwatchbalance) +* [bybit](/exchanges/bybit.md#bybitwatchbalance) +* [cex](/exchanges/cex.md#cexwatchbalance) +* [coincatch](/exchanges/coincatch.md#coincatchwatchbalance) +* [coinex](/exchanges/coinex.md#coinexwatchbalance) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchbalance) +* [defx](/exchanges/defx.md#defxwatchbalance) +* [deribit](/exchanges/deribit.md#deribitwatchbalance) +* [exmo](/exchanges/exmo.md#exmowatchbalance) +* [gate](/exchanges/gate.md#gatewatchbalance) +* [hashkey](/exchanges/hashkey.md#hashkeywatchbalance) +* [hollaex](/exchanges/hollaex.md#hollaexwatchbalance) +* [htx](/exchanges/htx.md#htxwatchbalance) +* [kucoin](/exchanges/kucoin.md#kucoinwatchbalance) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchbalance) +* [lbank](/exchanges/lbank.md#lbankwatchbalance) +* [mexc](/exchanges/mexc.md#mexcwatchbalance) +* [modetrade](/exchanges/modetrade.md#modetradewatchbalance) +* [okcoin](/exchanges/okcoin.md#okcoinwatchbalance) +* [okx](/exchanges/okx.md#okxwatchbalance) +* [onetrading](/exchanges/onetrading.md#onetradingwatchbalance) +* [oxfun](/exchanges/oxfun.md#oxfunwatchbalance) +* [phemex](/exchanges/phemex.md#phemexwatchbalance) +* [probit](/exchanges/probit.md#probitwatchbalance) +* [toobit](/exchanges/toobit.md#toobitwatchbalance) +* [upbit](/exchanges/upbit.md#upbitwatchbalance) +* [whitebit](/exchanges/whitebit.md#whitebitwatchbalance) +* [woo](/exchanges/woo.md#woowatchbalance) +* [woofipro](/exchanges/woofipro.md#woofiprowatchbalance) + +--- + + + +## watchBidsAsks +watches best bid & ask for symbols + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [backpack](/exchanges/backpack.md#backpackwatchbidsasks) +* [bitget](/exchanges/bitget.md#bitgetwatchbidsasks) +* [bitmart](/exchanges/bitmart.md#bitmartwatchbidsasks) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchbidsasks) +* [blofin](/exchanges/blofin.md#blofinwatchbidsasks) +* [bybit](/exchanges/bybit.md#bybitwatchbidsasks) +* [coinex](/exchanges/coinex.md#coinexwatchbidsasks) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchbidsasks) +* [defx](/exchanges/defx.md#defxwatchbidsasks) +* [deribit](/exchanges/deribit.md#deribitwatchbidsasks) +* [gate](/exchanges/gate.md#gatewatchbidsasks) +* [gemini](/exchanges/gemini.md#geminiwatchbidsasks) +* [kucoin](/exchanges/kucoin.md#kucoinwatchbidsasks) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchbidsasks) +* [mexc](/exchanges/mexc.md#mexcwatchbidsasks) +* [modetrade](/exchanges/modetrade.md#modetradewatchbidsasks) +* [okx](/exchanges/okx.md#okxwatchbidsasks) +* [oxfun](/exchanges/oxfun.md#oxfunwatchbidsasks) +* [woo](/exchanges/woo.md#woowatchbidsasks) +* [woofipro](/exchanges/woofipro.md#woofiprowatchbidsasks) + +--- + + + +## watchFundingRate +watch the current funding rate + +**Kind**: instance +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [okx](/exchanges/okx.md#okxwatchfundingrate) + +--- + + + +## watchFundingRates +watch the funding rate for multiple markets + +**Kind**: instance +**Returns**: object - a dictionary of [funding rates structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexe by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalwatchfundingrates) + +--- + + + +## watchLiquidations +watch the public liquidations of a trading pair + +**Kind**: instance +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | + +##### Supported exchanges +* [bitmex](/exchanges/bitmex.md#bitmexwatchliquidations) +* [bybit](/exchanges/bybit.md#bybitwatchliquidations) + +--- + + + +## watchLiquidationsForSymbols +watch the public liquidations of a trading pair + +**Kind**: instance +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | + +##### Supported exchanges +* [bitmex](/exchanges/bitmex.md#bitmexwatchliquidationsforsymbols) +* [okx](/exchanges/okx.md#okxwatchliquidationsforsymbols) + +--- + + + +## watchMarkPrice +watches a mark price + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + +##### Supported exchanges +* [okx](/exchanges/okx.md#okxwatchmarkprice) + +--- + + + +## watchMarkPrices +watches mark prices + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + +##### Supported exchanges +* [okx](/exchanges/okx.md#okxwatchmarkprices) + +--- + + + +## watchMyLiquidations +watch the public liquidations of a trading pair + +**Kind**: instance +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gatewatchmyliquidations) + +--- + + + +## watchMyLiquidationsForSymbols +watch the private liquidations of a trading pair + +**Kind**: instance +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified CCXT market symbols | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the gate api endpoint | + +##### Supported exchanges +* [gate](/exchanges/gate.md#gatewatchmyliquidationsforsymbols) +* [okx](/exchanges/okx.md#okxwatchmyliquidationsforsymbols) + +--- + + + +## watchMyTrades +watches information on multiple trades made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacawatchmytrades) +* [apex](/exchanges/apex.md#apexwatchmytrades) +* [bingx](/exchanges/bingx.md#bingxwatchmytrades) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwatchmytrades) +* [bitget](/exchanges/bitget.md#bitgetwatchmytrades) +* [bitmex](/exchanges/bitmex.md#bitmexwatchmytrades) +* [bitopro](/exchanges/bitopro.md#bitoprowatchmytrades) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchmytrades) +* [bybit](/exchanges/bybit.md#bybitwatchmytrades) +* [cex](/exchanges/cex.md#cexwatchmytrades) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchmytrades) +* [coinex](/exchanges/coinex.md#coinexwatchmytrades) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchmytrades) +* [deribit](/exchanges/deribit.md#deribitwatchmytrades) +* [derive](/exchanges/derive.md#derivewatchmytrades) +* [exmo](/exchanges/exmo.md#exmowatchmytrades) +* [gate](/exchanges/gate.md#gatewatchmytrades) +* [hashkey](/exchanges/hashkey.md#hashkeywatchmytrades) +* [hollaex](/exchanges/hollaex.md#hollaexwatchmytrades) +* [htx](/exchanges/htx.md#htxwatchmytrades) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidwatchmytrades) +* [kucoin](/exchanges/kucoin.md#kucoinwatchmytrades) +* [mexc](/exchanges/mexc.md#mexcwatchmytrades) +* [modetrade](/exchanges/modetrade.md#modetradewatchmytrades) +* [okx](/exchanges/okx.md#okxwatchmytrades) +* [onetrading](/exchanges/onetrading.md#onetradingwatchmytrades) +* [phemex](/exchanges/phemex.md#phemexwatchmytrades) +* [probit](/exchanges/probit.md#probitwatchmytrades) +* [toobit](/exchanges/toobit.md#toobitwatchmytrades) +* [upbit](/exchanges/upbit.md#upbitwatchmytrades) +* [whitebit](/exchanges/whitebit.md#whitebitwatchmytrades) +* [woo](/exchanges/woo.md#woowatchmytrades) +* [woofipro](/exchanges/woofipro.md#woofiprowatchmytrades) + +--- + + + +## watchMyTradesForSymbols +watches information on multiple trades made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchmytradesforsymbols) + +--- + + + +## watchOHLCV +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacawatchohlcv) +* [apex](/exchanges/apex.md#apexwatchohlcv) +* [ascendex](/exchanges/ascendex.md#ascendexwatchohlcv) +* [backpack](/exchanges/backpack.md#backpackwatchohlcv) +* [bingx](/exchanges/bingx.md#bingxwatchohlcv) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwatchohlcv) +* [bitget](/exchanges/bitget.md#bitgetwatchohlcv) +* [bitmart](/exchanges/bitmart.md#bitmartwatchohlcv) +* [bitmex](/exchanges/bitmex.md#bitmexwatchohlcv) +* [bittrade](/exchanges/bittrade.md#bittradewatchohlcv) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchohlcv) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomwatchohlcv) +* [blofin](/exchanges/blofin.md#blofinwatchohlcv) +* [bybit](/exchanges/bybit.md#bybitwatchohlcv) +* [cex](/exchanges/cex.md#cexwatchohlcv) +* [coincatch](/exchanges/coincatch.md#coincatchwatchohlcv) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchohlcv) +* [defx](/exchanges/defx.md#defxwatchohlcv) +* [deribit](/exchanges/deribit.md#deribitwatchohlcv) +* [gate](/exchanges/gate.md#gatewatchohlcv) +* [gemini](/exchanges/gemini.md#geminiwatchohlcv) +* [hashkey](/exchanges/hashkey.md#hashkeywatchohlcv) +* [htx](/exchanges/htx.md#htxwatchohlcv) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidwatchohlcv) +* [kucoin](/exchanges/kucoin.md#kucoinwatchohlcv) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchohlcv) +* [lbank](/exchanges/lbank.md#lbankwatchohlcv) +* [mexc](/exchanges/mexc.md#mexcwatchohlcv) +* [modetrade](/exchanges/modetrade.md#modetradewatchohlcv) +* [ndax](/exchanges/ndax.md#ndaxwatchohlcv) +* [okcoin](/exchanges/okcoin.md#okcoinwatchohlcv) +* [okx](/exchanges/okx.md#okxwatchohlcv) +* [onetrading](/exchanges/onetrading.md#onetradingwatchohlcv) +* [oxfun](/exchanges/oxfun.md#oxfunwatchohlcv) +* [phemex](/exchanges/phemex.md#phemexwatchohlcv) +* [toobit](/exchanges/toobit.md#toobitwatchohlcv) +* [upbit](/exchanges/upbit.md#upbitwatchohlcv) +* [whitebit](/exchanges/whitebit.md#whitebitwatchohlcv) +* [woo](/exchanges/woo.md#woowatchohlcv) +* [woofipro](/exchanges/woofipro.md#woofiprowatchohlcv) + +--- + + + +## watchOHLCVForSymbols +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance +**Returns**: object - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexwatchohlcvforsymbols) +* [backpack](/exchanges/backpack.md#backpackwatchohlcvforsymbols) +* [blofin](/exchanges/blofin.md#blofinwatchohlcvforsymbols) +* [bybit](/exchanges/bybit.md#bybitwatchohlcvforsymbols) +* [defx](/exchanges/defx.md#defxwatchohlcvforsymbols) +* [deribit](/exchanges/deribit.md#deribitwatchohlcvforsymbols) +* [okx](/exchanges/okx.md#okxwatchohlcvforsymbols) +* [oxfun](/exchanges/oxfun.md#oxfunwatchohlcvforsymbols) +* [toobit](/exchanges/toobit.md#toobitwatchohlcvforsymbols) + +--- + + + +## watchOrderBook +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacawatchorderbook) +* [apex](/exchanges/apex.md#apexwatchorderbook) +* [ascendex](/exchanges/ascendex.md#ascendexwatchorderbook) +* [backpack](/exchanges/backpack.md#backpackwatchorderbook) +* [bingx](/exchanges/bingx.md#bingxwatchorderbook) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwatchorderbook) +* [bitget](/exchanges/bitget.md#bitgetwatchorderbook) +* [bithumb](/exchanges/bithumb.md#bithumbwatchorderbook) +* [bitmart](/exchanges/bitmart.md#bitmartwatchorderbook) +* [bitmex](/exchanges/bitmex.md#bitmexwatchorderbook) +* [bitopro](/exchanges/bitopro.md#bitoprowatchorderbook) +* [bitstamp](/exchanges/bitstamp.md#bitstampwatchorderbook) +* [bittrade](/exchanges/bittrade.md#bittradewatchorderbook) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchorderbook) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomwatchorderbook) +* [blofin](/exchanges/blofin.md#blofinwatchorderbook) +* [bybit](/exchanges/bybit.md#bybitwatchorderbook) +* [cex](/exchanges/cex.md#cexwatchorderbook) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchorderbook) +* [coincatch](/exchanges/coincatch.md#coincatchwatchorderbook) +* [coincheck](/exchanges/coincheck.md#coincheckwatchorderbook) +* [coinex](/exchanges/coinex.md#coinexwatchorderbook) +* [coinone](/exchanges/coinone.md#coinonewatchorderbook) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchorderbook) +* [defx](/exchanges/defx.md#defxwatchorderbook) +* [deribit](/exchanges/deribit.md#deribitwatchorderbook) +* [derive](/exchanges/derive.md#derivewatchorderbook) +* [exmo](/exchanges/exmo.md#exmowatchorderbook) +* [gate](/exchanges/gate.md#gatewatchorderbook) +* [gemini](/exchanges/gemini.md#geminiwatchorderbook) +* [hashkey](/exchanges/hashkey.md#hashkeywatchorderbook) +* [hollaex](/exchanges/hollaex.md#hollaexwatchorderbook) +* [htx](/exchanges/htx.md#htxwatchorderbook) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidwatchorderbook) +* [independentreserve](/exchanges/independentreserve.md#independentreservewatchorderbook) +* [kucoin](/exchanges/kucoin.md#kucoinwatchorderbook) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchorderbook) +* [lbank](/exchanges/lbank.md#lbankwatchorderbook) +* [luno](/exchanges/luno.md#lunowatchorderbook) +* [mexc](/exchanges/mexc.md#mexcwatchorderbook) +* [modetrade](/exchanges/modetrade.md#modetradewatchorderbook) +* [ndax](/exchanges/ndax.md#ndaxwatchorderbook) +* [okcoin](/exchanges/okcoin.md#okcoinwatchorderbook) +* [okx](/exchanges/okx.md#okxwatchorderbook) +* [onetrading](/exchanges/onetrading.md#onetradingwatchorderbook) +* [oxfun](/exchanges/oxfun.md#oxfunwatchorderbook) +* [phemex](/exchanges/phemex.md#phemexwatchorderbook) +* [probit](/exchanges/probit.md#probitwatchorderbook) +* [toobit](/exchanges/toobit.md#toobitwatchorderbook) +* [upbit](/exchanges/upbit.md#upbitwatchorderbook) +* [whitebit](/exchanges/whitebit.md#whitebitwatchorderbook) +* [woo](/exchanges/woo.md#woowatchorderbook) +* [woofipro](/exchanges/woofipro.md#woofiprowatchorderbook) + +--- + + + +## watchOrderBookForSymbols +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexwatchorderbookforsymbols) +* [backpack](/exchanges/backpack.md#backpackwatchorderbookforsymbols) +* [bitget](/exchanges/bitget.md#bitgetwatchorderbookforsymbols) +* [bitmart](/exchanges/bitmart.md#bitmartwatchorderbookforsymbols) +* [bitmex](/exchanges/bitmex.md#bitmexwatchorderbookforsymbols) +* [blofin](/exchanges/blofin.md#blofinwatchorderbookforsymbols) +* [bybit](/exchanges/bybit.md#bybitwatchorderbookforsymbols) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchorderbookforsymbols) +* [coincatch](/exchanges/coincatch.md#coincatchwatchorderbookforsymbols) +* [coinex](/exchanges/coinex.md#coinexwatchorderbookforsymbols) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchorderbookforsymbols) +* [defx](/exchanges/defx.md#defxwatchorderbookforsymbols) +* [deribit](/exchanges/deribit.md#deribitwatchorderbookforsymbols) +* [gemini](/exchanges/gemini.md#geminiwatchorderbookforsymbols) +* [kucoin](/exchanges/kucoin.md#kucoinwatchorderbookforsymbols) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchorderbookforsymbols) +* [okx](/exchanges/okx.md#okxwatchorderbookforsymbols) +* [oxfun](/exchanges/oxfun.md#oxfunwatchorderbookforsymbols) +* [toobit](/exchanges/toobit.md#toobitwatchorderbookforsymbols) + +--- + + + +## watchOrders +watches information on multiple orders made by the user + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacawatchorders) +* [apex](/exchanges/apex.md#apexwatchorders) +* [ascendex](/exchanges/ascendex.md#ascendexwatchorders) +* [backpack](/exchanges/backpack.md#backpackwatchorders) +* [bingx](/exchanges/bingx.md#bingxwatchorders) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwatchorders) +* [bitget](/exchanges/bitget.md#bitgetwatchorders) +* [bitmart](/exchanges/bitmart.md#bitmartwatchorders) +* [bitmex](/exchanges/bitmex.md#bitmexwatchorders) +* [bitrue](/exchanges/bitrue.md#bitruewatchorders) +* [bitstamp](/exchanges/bitstamp.md#bitstampwatchorders) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchorders) +* [biofin](/exchanges/biofin.md#biofinwatchorders) +* [bybit](/exchanges/bybit.md#bybitwatchorders) +* [cex](/exchanges/cex.md#cexwatchorders) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchorders) +* [coincatch](/exchanges/coincatch.md#coincatchwatchorders) +* [coinex](/exchanges/coinex.md#coinexwatchorders) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchorders) +* [defx](/exchanges/defx.md#defxwatchorders) +* [deribit](/exchanges/deribit.md#deribitwatchorders) +* [derive](/exchanges/derive.md#derivewatchorders) +* [exmo](/exchanges/exmo.md#exmowatchorders) +* [gate](/exchanges/gate.md#gatewatchorders) +* [hashkey](/exchanges/hashkey.md#hashkeywatchorders) +* [hollaex](/exchanges/hollaex.md#hollaexwatchorders) +* [htx](/exchanges/htx.md#htxwatchorders) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidwatchorders) +* [kucoin](/exchanges/kucoin.md#kucoinwatchorders) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchorders) +* [lbank](/exchanges/lbank.md#lbankwatchorders) +* [mexc](/exchanges/mexc.md#mexcwatchorders) +* [modetrade](/exchanges/modetrade.md#modetradewatchorders) +* [okcoin](/exchanges/okcoin.md#okcoinwatchorders) +* [okx](/exchanges/okx.md#okxwatchorders) +* [onetrading](/exchanges/onetrading.md#onetradingwatchorders) +* [oxfun](/exchanges/oxfun.md#oxfunwatchorders) +* [phemex](/exchanges/phemex.md#phemexwatchorders) +* [probit](/exchanges/probit.md#probitwatchorders) +* [toobit](/exchanges/toobit.md#toobitwatchorders) +* [upbit](/exchanges/upbit.md#upbitwatchorders) +* [whitebit](/exchanges/whitebit.md#whitebitwatchorders) +* [woo](/exchanges/woo.md#woowatchorders) +* [woofipro](/exchanges/woofipro.md#woofiprowatchorders) + +--- + + + +## watchOrdersForSymbols +watches information on multiple orders made by the user across multiple symbols + +**Kind**: instance +**Returns**: Array<object> - a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [blofin](/exchanges/blofin.md#blofinwatchordersforsymbols) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchordersforsymbols) + +--- + + + +## watchPosition +watch open positions for a specific symbol + +**Kind**: instance +**Returns**: object - a [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string, undefined | unified market symbol | +| params | object | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchposition) + +--- + + + +## watchPositions +watch all open positions + +**Kind**: instance +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexwatchpositions) +* [backpack](/exchanges/backpack.md#backpackwatchpositions) +* [bitget](/exchanges/bitget.md#bitgetwatchpositions) +* [bitmart](/exchanges/bitmart.md#bitmartwatchpositions) +* [bitmex](/exchanges/bitmex.md#bitmexwatchpositions) +* [blofin](/exchanges/blofin.md#blofinwatchpositions) +* [bybit](/exchanges/bybit.md#bybitwatchpositions) +* [coincatch](/exchanges/coincatch.md#coincatchwatchpositions) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchpositions) +* [defx](/exchanges/defx.md#defxwatchpositions) +* [gate](/exchanges/gate.md#gatewatchpositions) +* [hashkey](/exchanges/hashkey.md#hashkeywatchpositions) +* [htx](/exchanges/htx.md#htxwatchpositions) +* [modetrade](/exchanges/modetrade.md#modetradewatchpositions) +* [okx](/exchanges/okx.md#okxwatchpositions) +* [oxfun](/exchanges/oxfun.md#oxfunwatchpositions) +* [toobit](/exchanges/toobit.md#toobitwatchpositions) +* [woo](/exchanges/woo.md#woowatchpositions) +* [woofipro](/exchanges/woofipro.md#woofiprowatchpositions) + +--- + + + +## watchTicker +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacawatchticker) +* [apex](/exchanges/apex.md#apexwatchticker) +* [backpack](/exchanges/backpack.md#backpackwatchticker) +* [bingx](/exchanges/bingx.md#bingxwatchticker) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwatchticker) +* [bitget](/exchanges/bitget.md#bitgetwatchticker) +* [bithumb](/exchanges/bithumb.md#bithumbwatchticker) +* [bitmart](/exchanges/bitmart.md#bitmartwatchticker) +* [bitmex](/exchanges/bitmex.md#bitmexwatchticker) +* [bitopro](/exchanges/bitopro.md#bitoprowatchticker) +* [bittrade](/exchanges/bittrade.md#bittradewatchticker) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchticker) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomwatchticker) +* [blofin](/exchanges/blofin.md#blofinwatchticker) +* [bybit](/exchanges/bybit.md#bybitwatchticker) +* [cex](/exchanges/cex.md#cexwatchticker) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchticker) +* [coincatch](/exchanges/coincatch.md#coincatchwatchticker) +* [coinex](/exchanges/coinex.md#coinexwatchticker) +* [coinone](/exchanges/coinone.md#coinonewatchticker) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchticker) +* [defx](/exchanges/defx.md#defxwatchticker) +* [deribit](/exchanges/deribit.md#deribitwatchticker) +* [derive](/exchanges/derive.md#derivewatchticker) +* [exmo](/exchanges/exmo.md#exmowatchticker) +* [gate](/exchanges/gate.md#gatewatchticker) +* [hahskey](/exchanges/hahskey.md#hahskeywatchticker) +* [htx](/exchanges/htx.md#htxwatchticker) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidwatchticker) +* [kucoin](/exchanges/kucoin.md#kucoinwatchticker) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchticker) +* [lbank](/exchanges/lbank.md#lbankwatchticker) +* [mexc](/exchanges/mexc.md#mexcwatchticker) +* [modetrade](/exchanges/modetrade.md#modetradewatchticker) +* [ndax](/exchanges/ndax.md#ndaxwatchticker) +* [okcoin](/exchanges/okcoin.md#okcoinwatchticker) +* [okx](/exchanges/okx.md#okxwatchticker) +* [onetrading](/exchanges/onetrading.md#onetradingwatchticker) +* [oxfun](/exchanges/oxfun.md#oxfunwatchticker) +* [phemex](/exchanges/phemex.md#phemexwatchticker) +* [probit](/exchanges/probit.md#probitwatchticker) +* [toobit](/exchanges/toobit.md#toobitwatchticker) +* [upbit](/exchanges/upbit.md#upbitwatchticker) +* [whitebit](/exchanges/whitebit.md#whitebitwatchticker) +* [woo](/exchanges/woo.md#woowatchticker) +* [woofipro](/exchanges/woofipro.md#woofiprowatchticker) + +--- + + + +## watchTickers +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexwatchtickers) +* [backpack](/exchanges/backpack.md#backpackwatchtickers) +* [bitget](/exchanges/bitget.md#bitgetwatchtickers) +* [bithumb](/exchanges/bithumb.md#bithumbwatchtickers) +* [bitmart](/exchanges/bitmart.md#bitmartwatchtickers) +* [bitmex](/exchanges/bitmex.md#bitmexwatchtickers) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchtickers) +* [blofin](/exchanges/blofin.md#blofinwatchtickers) +* [bybit](/exchanges/bybit.md#bybitwatchtickers) +* [cex](/exchanges/cex.md#cexwatchtickers) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchtickers) +* [coincatch](/exchanges/coincatch.md#coincatchwatchtickers) +* [coinex](/exchanges/coinex.md#coinexwatchtickers) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchtickers) +* [defx](/exchanges/defx.md#defxwatchtickers) +* [deribit](/exchanges/deribit.md#deribitwatchtickers) +* [exmo](/exchanges/exmo.md#exmowatchtickers) +* [gate](/exchanges/gate.md#gatewatchtickers) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidwatchtickers) +* [kucoin](/exchanges/kucoin.md#kucoinwatchtickers) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchtickers) +* [mexc](/exchanges/mexc.md#mexcwatchtickers) +* [modetrade](/exchanges/modetrade.md#modetradewatchtickers) +* [okx](/exchanges/okx.md#okxwatchtickers) +* [onetrading](/exchanges/onetrading.md#onetradingwatchtickers) +* [oxfun](/exchanges/oxfun.md#oxfunwatchtickers) +* [phemex](/exchanges/phemex.md#phemexwatchtickers) +* [toobit](/exchanges/toobit.md#toobitwatchtickers) +* [upbit](/exchanges/upbit.md#upbitwatchtickers) +* [whitebit](/exchanges/whitebit.md#whitebitwatchtickers) +* [woo](/exchanges/woo.md#woowatchtickers) +* [woofipro](/exchanges/woofipro.md#woofiprowatchtickers) + +--- + + + +## watchTrades +watches information on multiple trades made in a market + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacawatchtrades) +* [apex](/exchanges/apex.md#apexwatchtrades) +* [ascendex](/exchanges/ascendex.md#ascendexwatchtrades) +* [backpack](/exchanges/backpack.md#backpackwatchtrades) +* [bingx](/exchanges/bingx.md#bingxwatchtrades) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwatchtrades) +* [bitget](/exchanges/bitget.md#bitgetwatchtrades) +* [bithumb](/exchanges/bithumb.md#bithumbwatchtrades) +* [bitmart](/exchanges/bitmart.md#bitmartwatchtrades) +* [bitmex](/exchanges/bitmex.md#bitmexwatchtrades) +* [bitopro](/exchanges/bitopro.md#bitoprowatchtrades) +* [bitstamp](/exchanges/bitstamp.md#bitstampwatchtrades) +* [bittrade](/exchanges/bittrade.md#bittradewatchtrades) +* [bitvavo](/exchanges/bitvavo.md#bitvavowatchtrades) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomwatchtrades) +* [blofin](/exchanges/blofin.md#blofinwatchtrades) +* [bybit](/exchanges/bybit.md#bybitwatchtrades) +* [cex](/exchanges/cex.md#cexwatchtrades) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewatchtrades) +* [coincatch](/exchanges/coincatch.md#coincatchwatchtrades) +* [coincheck](/exchanges/coincheck.md#coincheckwatchtrades) +* [coinex](/exchanges/coinex.md#coinexwatchtrades) +* [coinone](/exchanges/coinone.md#coinonewatchtrades) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchtrades) +* [defx](/exchanges/defx.md#defxwatchtrades) +* [deribit](/exchanges/deribit.md#deribitwatchtrades) +* [derive](/exchanges/derive.md#derivewatchtrades) +* [exmo](/exchanges/exmo.md#exmowatchtrades) +* [gate](/exchanges/gate.md#gatewatchtrades) +* [gemini](/exchanges/gemini.md#geminiwatchtrades) +* [hashkey](/exchanges/hashkey.md#hashkeywatchtrades) +* [hollaex](/exchanges/hollaex.md#hollaexwatchtrades) +* [htx](/exchanges/htx.md#htxwatchtrades) +* [independentreserve](/exchanges/independentreserve.md#independentreservewatchtrades) +* [kucoin](/exchanges/kucoin.md#kucoinwatchtrades) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchtrades) +* [lbank](/exchanges/lbank.md#lbankwatchtrades) +* [luno](/exchanges/luno.md#lunowatchtrades) +* [mexc](/exchanges/mexc.md#mexcwatchtrades) +* [modetrade](/exchanges/modetrade.md#modetradewatchtrades) +* [ndax](/exchanges/ndax.md#ndaxwatchtrades) +* [okcoin](/exchanges/okcoin.md#okcoinwatchtrades) +* [okx](/exchanges/okx.md#okxwatchtrades) +* [oxfun](/exchanges/oxfun.md#oxfunwatchtrades) +* [phemex](/exchanges/phemex.md#phemexwatchtrades) +* [probit](/exchanges/probit.md#probitwatchtrades) +* [toobit](/exchanges/toobit.md#toobitwatchtrades) +* [upbit](/exchanges/upbit.md#upbitwatchtrades) +* [whitebit](/exchanges/whitebit.md#whitebitwatchtrades) +* [woo](/exchanges/woo.md#woowatchtrades) +* [woofipro](/exchanges/woofipro.md#woofiprowatchtrades) + +--- + + + +## watchTradesForSymbols +get the list of most recent trades for a list of symbols + +**Kind**: instance +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [apex](/exchanges/apex.md#apexwatchtradesforsymbols) +* [ascendex](/exchanges/ascendex.md#ascendexwatchtradesforsymbols) +* [backpack](/exchanges/backpack.md#backpackwatchtradesforsymbols) +* [bitget](/exchanges/bitget.md#bitgetwatchtradesforsymbols) +* [bitmart](/exchanges/bitmart.md#bitmartwatchtradesforsymbols) +* [bitmex](/exchanges/bitmex.md#bitmexwatchtradesforsymbols) +* [blofin](/exchanges/blofin.md#blofinwatchtradesforsymbols) +* [bybit](/exchanges/bybit.md#bybitwatchtradesforsymbols) +* [coinbase](/exchanges/coinbase.md#coinbasewatchtradesforsymbols) +* [coincatch](/exchanges/coincatch.md#coincatchwatchtradesforsymbols) +* [coinex](/exchanges/coinex.md#coinexwatchtradesforsymbols) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwatchtradesforsymbols) +* [defx](/exchanges/defx.md#defxwatchtradesforsymbols) +* [deribit](/exchanges/deribit.md#deribitwatchtradesforsymbols) +* [gate](/exchanges/gate.md#gatewatchtradesforsymbols) +* [gemini](/exchanges/gemini.md#geminiwatchtradesforsymbols) +* [kucoin](/exchanges/kucoin.md#kucoinwatchtradesforsymbols) +* [kucoinfutures](/exchanges/kucoinfutures.md#kucoinfutureswatchtradesforsymbols) +* [okx](/exchanges/okx.md#okxwatchtradesforsymbols) +* [oxfun](/exchanges/oxfun.md#oxfunwatchtradesforsymbols) +* [toobit](/exchanges/toobit.md#toobitwatchtradesforsymbols) +* [upbit](/exchanges/upbit.md#upbitwatchtradesforsymbols) + +--- + + + +## withdraw +make a withdrawal + +**Kind**: instance +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | a memo for the transaction | +| params | object | No | extra parameters specific to the exchange API endpoint | + +##### Supported exchanges +* [alpaca](/exchanges/alpaca.md#alpacawithdraw) +* [backpack](/exchanges/backpack.md#backpackwithdraw) +* [bigone](/exchanges/bigone.md#bigonewithdraw) +* [binance](/exchanges/binance.md#binancewithdraw) +* [bingx](/exchanges/bingx.md#bingxwithdraw) +* [bitbank](/exchanges/bitbank.md#bitbankwithdraw) +* [bitfinex](/exchanges/bitfinex.md#bitfinexwithdraw) +* [bitflyer](/exchanges/bitflyer.md#bitflyerwithdraw) +* [bitget](/exchanges/bitget.md#bitgetwithdraw) +* [bithumb](/exchanges/bithumb.md#bithumbwithdraw) +* [bitmart](/exchanges/bitmart.md#bitmartwithdraw) +* [bitmex](/exchanges/bitmex.md#bitmexwithdraw) +* [bitopro](/exchanges/bitopro.md#bitoprowithdraw) +* [bitrue](/exchanges/bitrue.md#bitruewithdraw) +* [bitso](/exchanges/bitso.md#bitsowithdraw) +* [bitstamp](/exchanges/bitstamp.md#bitstampwithdraw) +* [bittrade](/exchanges/bittrade.md#bittradewithdraw) +* [bitvavo](/exchanges/bitvavo.md#bitvavowithdraw) +* [blockchaincom](/exchanges/blockchaincom.md#blockchaincomwithdraw) +* [btcmarkets](/exchanges/btcmarkets.md#btcmarketswithdraw) +* [bybit](/exchanges/bybit.md#bybitwithdraw) +* [coinbase](/exchanges/coinbase.md#coinbasewithdraw) +* [coinbaseexchange](/exchanges/coinbaseexchange.md#coinbaseexchangewithdraw) +* [coinbaseinternational](/exchanges/coinbaseinternational.md#coinbaseinternationalwithdraw) +* [coincatch](/exchanges/coincatch.md#coincatchwithdraw) +* [coinex](/exchanges/coinex.md#coinexwithdraw) +* [coinmate](/exchanges/coinmate.md#coinmatewithdraw) +* [coinsph](/exchanges/coinsph.md#coinsphwithdraw) +* [cryptocom](/exchanges/cryptocom.md#cryptocomwithdraw) +* [defx](/exchanges/defx.md#defxwithdraw) +* [deribit](/exchanges/deribit.md#deribitwithdraw) +* [digifinex](/exchanges/digifinex.md#digifinexwithdraw) +* [exmo](/exchanges/exmo.md#exmowithdraw) +* [foxbit](/exchanges/foxbit.md#foxbitwithdraw) +* [gate](/exchanges/gate.md#gatewithdraw) +* [gemini](/exchanges/gemini.md#geminiwithdraw) +* [hashkey](/exchanges/hashkey.md#hashkeywithdraw) +* [hibachi](/exchanges/hibachi.md#hibachiwithdraw) +* [hitbtc](/exchanges/hitbtc.md#hitbtcwithdraw) +* [hollaex](/exchanges/hollaex.md#hollaexwithdraw) +* [htx](/exchanges/htx.md#htxwithdraw) +* [hyperliquid](/exchanges/hyperliquid.md#hyperliquidwithdraw) +* [independentreserve](/exchanges/independentreserve.md#independentreservewithdraw) +* [indodax](/exchanges/indodax.md#indodaxwithdraw) +* [kraken](/exchanges/kraken.md#krakenwithdraw) +* [kucoin](/exchanges/kucoin.md#kucoinwithdraw) +* [lbank](/exchanges/lbank.md#lbankwithdraw) +* [mercado](/exchanges/mercado.md#mercadowithdraw) +* [mexc](/exchanges/mexc.md#mexcwithdraw) +* [modetrade](/exchanges/modetrade.md#modetradewithdraw) +* [ndax](/exchanges/ndax.md#ndaxwithdraw) +* [novadax](/exchanges/novadax.md#novadaxwithdraw) +* [okcoin](/exchanges/okcoin.md#okcoinwithdraw) +* [okx](/exchanges/okx.md#okxwithdraw) +* [oxfun](/exchanges/oxfun.md#oxfunwithdraw) +* [phemex](/exchanges/phemex.md#phemexwithdraw) +* [poloniex](/exchanges/poloniex.md#poloniexwithdraw) +* [probit](/exchanges/probit.md#probitwithdraw) +* [tokocrypto](/exchanges/tokocrypto.md#tokocryptowithdraw) +* [toobit](/exchanges/toobit.md#toobitwithdraw) +* [upbit](/exchanges/upbit.md#upbitwithdraw) +* [wavesexchange](/exchanges/wavesexchange.md#wavesexchangewithdraw) +* [whitebit](/exchanges/whitebit.md#whitebitwithdraw) +* [woo](/exchanges/woo.md#woowithdraw) +* [woofipro](/exchanges/woofipro.md#woofiprowithdraw) +* [xt](/exchanges/xt.md#xtwithdraw) +* [yobit](/exchanges/yobit.md#yobitwithdraw) +* [zaif](/exchanges/zaif.md#zaifwithdraw) +* [zonda](/exchanges/zonda.md#zondawithdraw) + +--- + + + +## withdrawWs +make a withdrawal + +**Kind**: instance +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + +##### Supported exchanges +* [bitvavo](/exchanges/bitvavo.md#bitvavowithdrawws) diff --git a/docs/ccxt/wiki/ccxt.pro.manual.md b/docs/ccxt/wiki/ccxt.pro.manual.md new file mode 100644 index 0000000..f3cb379 --- /dev/null +++ b/docs/ccxt/wiki/ccxt.pro.manual.md @@ -0,0 +1,1318 @@ +# Manual + +CCXT Pro is a free part of CCXT that adds support for WebSocket streaming: https://github.com/ccxt/ccxt/issues/15171 + +The CCXT Pro stack is built upon [CCXT](https://ccxt.com) and extends the core CCXT classes, using: + +- JavaScript prototype-level mixins +- Python multiple inheritance +- PHP Traits + +The CCXT Pro heavily relies on the transpiler of CCXT for [multilanguage support](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#multilanguage-support). + +``` + User + + +-------------------------------------------------------------+ + | CCXT Pro | + +------------------------------+------------------------------+ + | Public . Private | + +=============================================================+ + │ . | + │ The Unified CCXT Pro API | + | . | + | loadMarkets . watchBalance | + | watchTicker . watchOrders | + | watchTickers . watchMyTrades | + | watchOrderBook . watchPositions | + | watchOHLCV . createOrderWs | + | watchStatus . editOrderWs | + | watchTrades . cancelOrderWs | + │ watchOHLCVForSymbols . cancelOrdersWs | + │ watchTradesForSymbols . cancelAllOrdersWs | + │ watchOrderBookForSymbols . | + │ . | + +=============================================================+ + │ unWatch | + │ (to stop **watch** method) | + +=============================================================+ + │ . | + | The Underlying Exchange-Specific APIs | + | (Derived Classes And Their Implementations) | + │ . | + +=============================================================+ + │ . | + | CCXT Pro Base Exchange Class | + │ . | + +=============================================================+ + + +-------------------------------------------------------------+ + | | + | CCXT | + | | + +=============================================================+ +``` + +## Exchanges +The CCXT Pro library currently supports the following 64 cryptocurrency exchange markets and WebSocket trading APIs: + +|logo |id |name |ver |type |certified |pro | +|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|-----------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------:|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------| +| [![alpaca](https://github.com/user-attachments/assets/e9476df8-a450-4c3e-ab9a-1a7794219e1b)](https://alpaca.markets) | alpaca | [Alpaca](https://alpaca.markets) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://alpaca.markets/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![apex](https://github.com/user-attachments/assets/fef8f2f7-4265-46aa-965e-33a91881cb00)](https://omni.apex.exchange/trade) | apex | [Apex](https://omni.apex.exchange/trade) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api-docs.pro.apex.exchange) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![ascendex](https://github.com/user-attachments/assets/55bab6b9-d4ca-42a8-a0e6-fac81ae557f1)](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | ascendex | [AscendEX](https://ascendex.com/en-us/register?inviteCode=EL6BXBQM) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://ascendex.github.io/ascendex-pro-api/#ascendex-pro-api-documentation) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![backpack](https://github.com/user-attachments/assets/cc04c278-679f-4554-9f72-930dd632b80f)](https://backpack.exchange/join/ccxt) | backpack | [Backpack](https://backpack.exchange/join/ccxt) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.backpack.exchange/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bequant](https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867)](https://bequant.io/referral/dd104e3bee7634ec) | bequant | [Bequant](https://bequant.io/referral/dd104e3bee7634ec) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.bequant.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binance](https://github.com/user-attachments/assets/e9419b93-ccb0-46aa-9bff-c883f096274b)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binance | [Binance](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://developers.binance.com/en) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binancecoinm](https://github.com/user-attachments/assets/387cfc4e-5f33-48cd-8f5c-cd4854dabf0c)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binancecoinm | [Binance COIN-M](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://binance-docs.github.io/apidocs/delivery/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binanceus](https://github.com/user-attachments/assets/a9667919-b632-4d52-a832-df89f8a35e8c)](https://www.binance.us/?ref=35005074) | binanceus | [Binance US](https://www.binance.us/?ref=35005074) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/binance-us/binance-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![binanceusdm](https://github.com/user-attachments/assets/871cbea7-eebb-4b28-b260-c1c91df0487a)](https://accounts.binance.com/en/register?ref=D7YA7CLY) | binanceusdm | [Binance USDⓈ-M](https://accounts.binance.com/en/register?ref=D7YA7CLY) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://binance-docs.github.io/apidocs/futures/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bingx](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/253675376-6983b72e-4999-4549-b177-33b374c195e3.jpg)](https://bingx.com/invite/OHETOM) | bingx | [BingX](https://bingx.com/invite/OHETOM) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://bingx-api.github.io/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitfinex](https://github.com/user-attachments/assets/4a8e947f-ab46-481a-a8ae-8b20e9b03178)](https://www.bitfinex.com) | bitfinex | [Bitfinex](https://www.bitfinex.com) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitfinex.com/v2/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitget](https://github.com/user-attachments/assets/fbaa10cc-a277-441d-a5b7-997dd9a87658)](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | bitget | [Bitget](https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitget.com/api-doc/common/intro) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bithumb](https://github.com/user-attachments/assets/c9e0eefb-4777-46b9-8f09-9d7f7c4af82d)](https://www.bithumb.com) | bithumb | [Bithumb](https://www.bithumb.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidocs.bithumb.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitmart](https://github.com/user-attachments/assets/0623e9c4-f50e-48c9-82bd-65c3908c3a14)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitmex](https://github.com/user-attachments/assets/c78425ab-78d5-49d6-bd14-db7734798f04)](https://www.bitmex.com/app/register/NZTR1q) | bitmex | [BitMEX](https://www.bitmex.com/app/register/NZTR1q) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.bitmex.com/app/apiOverview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitopro](https://github.com/user-attachments/assets/affc6337-b95a-44bf-aacd-04f9722364f6)](https://www.bitopro.com) | bitopro | [BitoPro](https://www.bitopro.com) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://github.com/bitoex/bitopro-offical-api-docs/blob/master/v3-1/rest-1/rest.md) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitrue](https://github.com/user-attachments/assets/67abe346-1273-461a-bd7c-42fa32907c8e)](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | bitrue | [Bitrue](https://www.bitrue.com/affiliate/landing?cn=600000&inviteCode=EZWETQE) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://github.com/Bitrue-exchange/bitrue-official-api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitstamp](https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024)](https://www.bitstamp.net) | bitstamp | [Bitstamp](https://www.bitstamp.net) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.bitstamp.net/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bittrade](https://user-images.githubusercontent.com/1294454/85734211-85755480-b705-11ea-8b35-0b7f1db33a2f.jpg)](https://www.bittrade.co.jp/register/?invite_code=znnq3) | bittrade | [BitTrade](https://www.bittrade.co.jp/register/?invite_code=znnq3) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://api-doc.bittrade.co.jp) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bitvavo](https://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8)](https://bitvavo.com/?a=24F34952F7) | bitvavo | [Bitvavo](https://bitvavo.com/?a=24F34952F7) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.bitvavo.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![blockchaincom](https://github.com/user-attachments/assets/975e3054-3399-4363-bcee-ec3c6d63d4e8)](https://blockchain.com) | blockchaincom | [Blockchain.com](https://blockchain.com) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://api.blockchain.com/v3) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![blofin](https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b)](https://blofin.com/register?referral_code=f79EsS) | blofin | [BloFin](https://blofin.com/register?referral_code=f79EsS) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://blofin.com/docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![bybit](https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://trade.cex.io/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbaseexchange](https://github.com/ccxt/ccxt/assets/43336371/34a65553-88aa-4a38-a714-064bd228b97e)](https://coinbase.com/) | coinbaseexchange | [Coinbase Exchange](https://coinbase.com/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.cloud.coinbase.com/exchange/docs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coincatch](https://github.com/user-attachments/assets/3d49065f-f05d-4573-88a2-1b5201ec6ff3)](https://partner.coincatch.cc/bg/92hy70391729607848548) | coincatch | [CoinCatch](https://partner.coincatch.cc/bg/92hy70391729607848548) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://coincatch.github.io/github.io/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.coinex.com/api/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![cryptocom](https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg)](https://crypto.com/exch/kdacthrnxt) | cryptocom | [Crypto.com](https://crypto.com/exch/kdacthrnxt) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![deribit](https://user-images.githubusercontent.com/1294454/41933112-9e2dd65a-798b-11e8-8440-5bab2959fcb8.jpg)](https://www.deribit.com/reg-1189.4038) | deribit | [Deribit](https://www.deribit.com/reg-1189.4038) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.deribit.com/v2) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![derive](https://github.com/user-attachments/assets/f835b95f-033a-43dd-b6bb-24e698fc498c)](https://www.derive.xyz/invite/3VB0B) | derive | [derive](https://www.derive.xyz/invite/3VB0B) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.derive.xyz/docs/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![gate](https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85)](https://www.gate.io/signup/2436035) | gate | [Gate.io](https://www.gate.io/signup/2436035) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://www.gate.io/docs/developers/apiv4/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![gemini](https://user-images.githubusercontent.com/1294454/27816857-ce7be644-6096-11e7-82d6-3c257263229c.jpg)](https://gemini.com/) | gemini | [Gemini](https://gemini.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.gemini.com/rest-api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hashkey](https://github.com/user-attachments/assets/6dd6127b-cc19-4a13-9b29-a98d81f80e98)](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | hashkey | [HashKey Global](https://global.hashkey.com/en-US/register/invite?invite_code=82FQUN) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://hashkeyglobal-apidoc.readme.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hollaex](https://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpg)](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | hollaex | [HollaEx](https://pro.hollaex.com/signup?affiliation_code=QSWA6G) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://apidocs.hollaex.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![htx](https://user-images.githubusercontent.com/1294454/76137448-22748a80-604e-11ea-8069-6e389271911d.jpg)](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | htx | [HTX](https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://huobiapi.github.io/docs/spot/v1/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![hyperliquid](https://github.com/ccxt/ccxt/assets/43336371/b371bc6c-4a8c-489f-87f4-20a913dd8d4b)](https://app.hyperliquid.xyz/) | hyperliquid | [Hyperliquid](https://app.hyperliquid.xyz/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![independentreserve](https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg)](https://www.independentreserve.com) | independentreserve | [Independent Reserve](https://www.independentreserve.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://www.independentreserve.com/API) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kraken](https://user-images.githubusercontent.com/51840849/76173629-fc67fb00-61b1-11ea-84fe-f2de582f58a3.jpg)](https://www.kraken.com) | kraken | [Kraken](https://www.kraken.com) | [![API Version 0](https://img.shields.io/badge/0-lightgray)](https://docs.kraken.com/rest/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![krakenfutures](https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg)](https://futures.kraken.com/) | krakenfutures | [Kraken Futures](https://futures.kraken.com/) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.kraken.com/api/docs/futures-api/trading/market-data/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kucoin](https://user-images.githubusercontent.com/51840849/87295558-132aaf80-c50e-11ea-9801-a2fb0c57c799.jpg)](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | kucoin | [KuCoin](https://www.kucoin.com/ucenter/signup?rcode=E5wkqe) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://docs.kucoin.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![kucoinfutures](https://user-images.githubusercontent.com/1294454/147508995-9e35030a-d046-43a1-a006-6fabd981b554.jpg)](https://futures.kucoin.com/?rcode=E5wkqe) | kucoinfutures | [KuCoin Futures](https://futures.kucoin.com/?rcode=E5wkqe) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.kucoin.com/futures) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![lbank](https://user-images.githubusercontent.com/1294454/38063602-9605e28a-3302-11e8-81be-64b1e53c4cfb.jpg)](https://www.lbank.com/login/?icode=7QCY) | lbank | [LBank](https://www.lbank.com/login/?icode=7QCY) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://www.lbank.com/en-US/docs/index.html) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![luno](https://user-images.githubusercontent.com/1294454/27766607-8c1a69d8-5ede-11e7-930c-540b5eb9be24.jpg)](https://www.luno.com/invite/44893A) | luno | [luno](https://www.luno.com/invite/44893A) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.luno.com/en/api) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![mexc](https://user-images.githubusercontent.com/1294454/137283979-8b2a818d-8633-461b-bfca-de89e8c446b2.jpg)](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | mexc | [MEXC Global](https://www.mexc.com/register?inviteCode=mexc-1FQ1GNu1) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://mexcdevelop.github.io/apidocs/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![modetrade](https://github.com/user-attachments/assets/cec2b7f1-3b2b-4502-971b-447ee1937d6b)](https://trade.mode.network?ref=MODETRADE) | modetrade | [Mode Trade](https://trade.mode.network?ref=MODETRADE) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](undefined) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![myokx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.my.okx.com/join/CCXT2023) | myokx | [MyOKX (EEA)](https://www.my.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://my.okx.com/docs-v5/en/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![ndax](https://user-images.githubusercontent.com/1294454/108623144-67a3ef00-744e-11eb-8140-75c6b851e945.jpg)](https://one.ndax.io/bfQiSL) | ndax | [NDAX](https://one.ndax.io/bfQiSL) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://apidoc.ndax.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![okcoin](https://user-images.githubusercontent.com/51840849/87295551-102fbf00-c50e-11ea-90a9-462eebba5829.jpg)](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | okcoin | [OKCoin](https://www.okcoin.com/account/register?flag=activity&channelId=600001513) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okcoin.com/docs/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![okx](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.okx.com/join/CCXT2023) | okx | [OKX](https://www.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://www.okx.com/docs-v5/en/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![okxus](https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg)](https://www.app.okx.com/join/CCXT2023) | okxus | [OKX (US)](https://www.app.okx.com/join/CCXT2023) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://app.okx.com/docs-v5/en/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![onetrading](https://github.com/ccxt/ccxt/assets/43336371/bdbc26fd-02f2-4ca7-9f1e-17333690bb1c)](https://onetrading.com/) | onetrading | [One Trading](https://onetrading.com/) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.onetrading.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![oxfun](https://github.com/ccxt/ccxt/assets/43336371/6a196124-c1ee-4fae-8573-962071b61a85)](https://ox.fun/register?shareAccountId=5ZUD4a7G) | oxfun | [OXFUN](https://ox.fun/register?shareAccountId=5ZUD4a7G) | [![API Version 3](https://img.shields.io/badge/3-lightgray)](https://docs.ox.fun/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![p2b](https://github.com/ccxt/ccxt/assets/43336371/8da13a80-1f0a-49be-bb90-ff8b25164755)](https://p2pb2b.com?referral=ee784c53) | p2b | [p2b](https://p2pb2b.com?referral=ee784c53) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![paradex](https://github.com/user-attachments/assets/84628770-784e-4ec4-a759-ec2fbb2244ea)](https://app.paradex.trade/r/ccxt24) | paradex | [Paradex](https://app.paradex.trade/r/ccxt24) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.api.testnet.paradex.trade/) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![phemex](https://user-images.githubusercontent.com/1294454/85225056-221eb600-b3d7-11ea-930d-564d2690e3f6.jpg)](https://phemex.com/register?referralCode=EDNVJ) | phemex | [Phemex](https://phemex.com/register?referralCode=EDNVJ) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://phemex-docs.github.io/#overview) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![poloniex](https://user-images.githubusercontent.com/1294454/27766817-e9456312-5ee6-11e7-9b3c-b628ca5626a5.jpg)](https://poloniex.com/signup?c=UBFZJRPJ) | poloniex | [Poloniex](https://poloniex.com/signup?c=UBFZJRPJ) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://api-docs.poloniex.com/spot/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![probit](https://user-images.githubusercontent.com/51840849/79268032-c4379480-7ea2-11ea-80b3-dd96bb29fd0d.jpg)](https://www.probit.com/r/34608773) | probit | [ProBit](https://www.probit.com/r/34608773) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs-en.probit.com) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![upbit](https://user-images.githubusercontent.com/1294454/49245610-eeaabe00-f423-11e8-9cba-4b0aed794799.jpg)](https://upbit.com) | upbit | [Upbit](https://upbit.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.upbit.com/docs/%EC%9A%94%EC%B2%AD-%EC%88%98-%EC%A0%9C%ED%95%9C) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![whitebit](https://user-images.githubusercontent.com/1294454/66732963-8eb7dd00-ee66-11e9-849b-10d9282bb9e0.jpg)](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | whitebit | [WhiteBit](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://github.com/whitebit-exchange/api-docs) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![woo](https://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpg)](https://woox.io/register?ref=DIJT0CNL) | woo | [WOO X](https://woox.io/register?ref=DIJT0CNL) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.woox.io/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![woofipro](https://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1)](https://dex.woo.org/en/trade?ref=CCXT) | woofipro | [WOOFI PRO](https://dex.woo.org/en/trade?ref=CCXT) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://orderly.network/docs/build-on-evm/building-on-evm) | ![DEX - Distributed EXchange](https://img.shields.io/badge/DEX-blue.svg "DEX - Distributed EXchange") | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | +| [![xt](https://user-images.githubusercontent.com/14319357/232636712-466df2fc-560a-4ca4-aab2-b1d954a58e24.jpg)](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | xt | [XT](https://www.xt.com/en/accounts/register?ref=9PTM9VW) | [![API Version 4](https://img.shields.io/badge/4-lightgray)](https://doc.xt.com/) | ![CEX – Centralized EXchange](https://img.shields.io/badge/CEX-green.svg "CEX – Centralized EXchange") | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | + +This is the list of exchanges in CCXT Pro with support for WebSockets APIs. This list will be updated with new exchanges on a regular basis. + +Full list of exchanges available in CCXT via REST: [Supported Cryptocurrency Exchange Markets](https://github.com/ccxt/ccxt/#supported-cryptocurrency-exchange-markets). + +## Usage + +```diff +- this part of the doc is under heavy development right now +- there may be some typos, mistakes and missing info here and there +- contributions, pull requests and feedback appreciated +``` + +## Prerequisites + +The best way to understand CCXT Pro is to make sure you grasp the entire CCXT Manual and practice standard CCXT first. CCXT Pro borrows from CCXT. The two libraries share a lot of commonalities, including: + +- the concepts of public API and private authenticated API +- markets, symbols, currency codes and ids +- unified data structures and formats, orderbooks, trades, orders, candles, timeframes, ... +- exceptions and error mappings +- authentication and API keys (for private feeds and calls) +- configuration options + +The CCXT Pro audience consists mostly of professional algorithmic traders and developers. In order to work efficiently with this library the user is required to be well-familiar with the concepts of streaming. One has to understand the underlying differences between connection-based streaming APIs ([WebSocket](https://en.wikipedia.org/wiki/WebSocket), CCXT Pro) and request-response based APIs ([REST](https://en.wikipedia.org/wiki/Representational_state_transfer), CCXT). + +The general async-style flow for a CCXT application is as follows: + +```javascript + +// a RESTful orderbook polling request-response loop + +while (condition) { + + try { + + // fetch some of the public data + orderbook = await exchange.fetchOrderBook (symbol, limit) + + // do something or react somehow based on that data + // ... + + } catch (e) { + + // handle errors + } +} +``` + +In CCXT Pro each public and private unified RESTful method having a `fetch*` prefix also has a corresponding stream-based counterpart method prefixed with `watch*`, as follows: + +- Public API + - `fetchStatus` → `watchStatus` + - `fetchOrderBook` → `watchOrderBook` + - `fetchOrderBookForSymbols` → `watchOrderBookForSymbols` + - `fetchTicker` → `watchTicker` + - `fetchTickers` → `watchTickers` + - `fetchOHLCV` → `watchOHLCV` + - `fetchOHLCVForSymbols` → `watchOHLCVForSymbols` + - `fetchTrades` → `watchTrades` + - `fetchTradesForSymbols` → `watchTradesForSymbols` + - `fetchBidsAsks` → `watchBidsAsks` + - `fetchLiquidations` → `watchLiquidations` + - `fetchLiquidationsForSymbols` → `watchLiquidationsForSymbols` +- Private API + - `fetchBalance` → `watchBalance` + - `fetchOrders` → `watchOrders` + - `fetchOrdersForSymbols` → `watchOrdersForSymbols` + - `fetchMyTrades` → `watchMyTrades` + - `fetchPosition` → `watchPosition` + - `fetchPositions` → `watchPositions` + - `fetchLiquidations` → `watchLiquidations` + - `fetchMyLiquidations` → `watchMyLiquidations` + - `fetchMyLiquidationsForSymbols` → `watchMyLiquidationsForSymbols` + - `fetchFundingRates` → `watchFundingRates` +- REST alternatives + - `fetchTrades` → `fetchTradesWs` + - `createOrder` → `createOrderWs` + - `editOrder` → `editOrderWs` + - `cancelOrder` → `cancelOrderWs` + - `cancelOrders` → `cancelOrdersWs` + - `cancelAllOrders` → `cancelAllOrdersWs` + - etc ... +- unWatch (stops background subscription for `watch`-ed methods) + - `unWatchOrderBook` + - `unWatchOrderBooksForSymbols` + - `unWatchTrades` + - `unWatchTradesForSymbols` + - `unWatchOHLCVForSymbols` + - `unWatchOrderBookForSymbols` + - `unWatchPositions` + - `unWatchTickers` + - `unWatchMyTrades` + - `unWatchTicker` + - `unWatchOHLCV` + - `unWatchOrders` + +The Unified CCXT Pro Streaming API inherits CCXT usage patterns to make migration easier. + +The general async-style flow for a CCXT Pro application (as opposed to a CCXT application above) is shown below: + +```javascript + +// a stream-based (WebSocket) orderbook feed loop + +while (condition) { + + try { + + // watch some of the public data + orderbook = await exchange.watchOrderBook (symbol, limit) + + // do something or react somehow based on that data + // ... + + } catch (e) { + + // handle errors + } +} +``` + +That usage pattern is usually wrapped up into a core business-logic method called _"a `tick()` function"_, since it reiterates a reaction to the incoming events (aka _ticks_). From the two examples above it is obvious that the generic usage pattern in CCXT Pro and CCXT is identical. + +Many of the CCXT rules and concepts also apply to CCXT Pro: + +- CCXT Pro will load markets and will cache markets upon the first call to a unified API method +- CCXT Pro will call CCXT RESTful methods under the hood if necessary +- CCXT Pro will throw standard CCXT exceptions where necessary +- ... + +## Streaming Specifics + +Despite of the numerous commonalities, streaming-based APIs have their own specifics, because of their connection-based nature. + +Having a connection-based interface implies connection-handling mechanisms. Connections are managed by CCXT Pro transparently to the user. Each exchange instance manages its own set of connections. + +Upon your first call to any `watch*()` method the library will establish a connection to a specific stream/resource of the exchange and will maintain it. If the connection already exists – it is reused. The library will handle the subscription request/response messaging sequences as well as the authentication/signing if the requested stream is private. + +The library will also watch the status of the uplink and will keep the connection alive. Upon a critical exception, a disconnect or a connection timeout/failure, the next iteration of the tick function will call the `watch` method that will trigger a reconnection. This way the library handles disconnections and reconnections for the user transparently. CCXT Pro applies the necessary rate-limiting and exponential backoff reconnection delays. All of that functionality is enabled by default and can be configured via exchange properties, as usual. + +Most of the exchanges only have a single base URL for streaming APIs (usually, WebSocket, starting with `ws://` or `wss://`). Some of them may have more than one URL for each stream, depending on the feed in question. + +Exchanges' Streaming APIs can be classified into two different categories: + +- *sub* or *subscribe* allows receiving only +- *pub* or *publish* allows sending and receiving + +### Sub + +A *sub* interface usually allows to subscribe to a stream of data and listen for it. Most of exchanges that do support WebSockets will offer a *sub* type of API only. The *sub* type includes streaming public market data. Sometimes exchanges also allow subcribing to private user data. After the user subscribes to a data feed the channel effectively starts working one-way sending updates from the exchange towards the user continuously. + +Commonly appearing types of public data streams: + +- order book (most common) - updates on added, edited and deleted orders (aka *change deltas*) +- ticker updates upon changing of 24 hour stats +- fills feed (also common) - a live stream of public trades +- ohlcv candlestick feed +- heartbeat +- exchange chat/trollbox + +Less common types of private user data streams: + +- the stream of private trades of the user +- live order updates +- balance updates +- custom streams +- exchange-specific and other streams + +### Pub + +A *pub* interface usually allows users to send data requests towards the server. This usually includes common user actions, like: + +- placing orders +- canceling orders +- placing withdrawal requests +- posting chat/trollbox messages +- etc + +**Some exchanges do not offer a *pub* WS API, they will offer *sub* WS API only.** However, there are exchanges that have a complete Streaming API as well. In most cases a user cannot operate effectively having just the Streaming API. Exchanges will stream public market data *sub*, and the REST API is still needed for the *pub* part where missing. + +### unWatch + +Each `watchX` method establishes a subscription with a stream and will continuously get updates from the exchange. Even if you stop getting the return value from the `watchX` method, the stream will keep sending that, which is handled and stored in the background. To stop those background subscriptions, you should use `unWatch` method (eg. `watchTrades` -> `unWatchTrades`). + +### Incremental Data Structures + +In many cases due to a unidirectional nature of the underlying data feeds, the application listening on the client-side has to keep a local snapshot of the data in memory and merge the updates received from the exchange server into the local snapshot. The updates coming from the exchange are also often called _deltas_, because in most cases those updates will contain just the changes between two states of the data and will not include the data that has not changed making it necessary to store the locally cached current state S of all relevant data objects. + +All of that functionality is handled by CCXT Pro for the user. To work with CCXT Pro, the user does not have to track or manage subscriptions and related data. CCXT Pro will keep a cache of structures in memory to handle the underlying hassle. + +Each incoming update says which parts of the data have changed and the receiving side "increments" local state S by merging the update on top of current state S and moves to next local state S'. In terms of CCXT Pro that is called _"incremental state"_ and the structures involved in the process of storing and updating the cached state are called _"incremental structures"_. CCXT Pro introduces several new base classes to handle the incremental state where necessary. + +The incremental structures returned from the unified methods of CCXT Pro are often one of two types: + +1. JSON-decoded object (`object` in JavaScript, `dict` in Python, `array()` in PHP). This type may be returned from public and private methods like `watchOrderBook`, `watchTicker`, `watchBalance`, `watchOrder`, etc. +2. An array/list of objects (usually sorted in chronological order). This type may be returned from methods like `watchOHLCV`, `watchTrades`, `watchMyTrades`, `watchOrders`, etc. + +The unified methods returning arrays like `watchOHLCV`, `watchTrades`, `watchMyTrades`, `watchOrders`, are based on the caching layer. The user has to understand the inner workings of the caching layer to work with it efficiently. + +The cache is a fixed-size deque aka array/list with two ends. The CCXT Pro library has a reasonable limit on the number of objects stored in memory. By default the caching array structures will store up to 1000 entries of each type (1000 most recent trades, 1000 most recent candles, 1000 most recent orders). The allowed maximum number can be configured by the user upon instantiation or later: + +```python +ccxtpro.binance({ + 'options': { + 'tradesLimit': 1000, + 'OHLCVLimit': 1000, + 'ordersLimit': 1000, + }, +}) + +# or + +exchange.options['tradesLimit'] = 1000 +exchange.options['OHLCVLimit'] = 1000 +exchange.options['ordersLimit'] = 1000 +``` + +The cache limits have to be set prior to calling any watch-methods and cannot change during a program run. + +When there is space left in the cache, new elements are simply appended to the end of it. If there's not enough room to fit a new element, the oldest element is deleted from the beginning of the cache to free some space. Thus, for example, the cache grows from 0 to 1000 most recent trades and then stays at 1000 most recent trades max, constantly renewing the stored data with each new update incoming from the exchange. It reminds a sliding frame window or a sliding door, that looks like shown below: + +``` + past > ------------------ > time > - - - - - - - - > future + + + sliding frame + of 1000 most + recent trades + +-----------------+ + | | + |===========+=====| ++----------------+------| | | - - - - - + - - - - - - - - + - - - +| | | | | | | +0 1000 | 2000 | 3000 4000 ... +| | | | | | | ++----------------+------| | | - - - - - + - - - - - - - - + - - - + |===========+=====| + | | + +---+---------+---+ + | | + since ^ ^ limit + + date-based pagination arguments + are always applied + within the cached frame +``` + +The user can configure the cache limits using the `exchange.options` as was shown above. Do not confuse the cache limits with the pagination limit. + +**Note, that the `since` and `limit` [date-based pagination](Manual#date-based-pagination) params have a different meaning and are always applied within the cached window!** If the user specifies a `since` argument to the `watchTrades()` call, CCXT Pro will return all cached trades having `timestamp >= since`. If the user does not specify a `since` argument, CCXT pro will return cached trades from the beginning of the sliding window. If the user specifies a `limit` argument, the library will return up to `limit` candles starting from `since` or from the beginning of the cache. For that reason the user cannot paginate beyond the cached frame due to the WebSocket real-time specifics. + +```python +exchange.options['tradesLimit'] = 5 # set the size of the cache to 5 + +# this call will return up to 5 cached trades +await exchange.watchTrades (symbol) + +# the following call will return the first 2 of up to 5 cached trades +await exchange.watchTrades (symbol, since=None, limit=2) + +# this call will first filter cached trades by trade['timestamp'] >= since +# and will return the first 2 of up to 5 cached trades that pass the filter +since = exchange.iso8601('2020-01-01T00:00:00Z') +limit = 2 +await exchange.watchTrades (symbol, since, limit) +``` + +#### newUpdates mode + +If you want to always get just the most recent trade, **you should instantiate the exchange with the newUpdates flag set to true**. + +```python +exchange = ccxtpro.binance({'newUpdates': True}) +while True: + trades = await exchange.watchTrades (symbol) + print(trades) +``` + +The newUpdates mode continues to utilize the sliding cache in the background, but the user will only be given the new updates. This is because some exchanges use incremental structures, so we need to keep a cache of objects as the exchange may only provide partial information such as status updates. + +The result from the newUpdates mode will be one or more updates that have occurred since the last time `exchange.watchMethod` resolved. CCXT Pro can return one or more orders that were updated since the previous call. The result of calling `exchange.watchOrders` will look like shown below: + +```javascript +[ + order, // see https://github.com/ccxt/ccxt/wiki/Manual#order-structure + order, + order, + ... +] +``` + +*Deprecation Warning*: in the future `newUpdates: true` will be the default mode and you will have to set newUpdates to false to get the sliding cache. + +#### **JavaScript** +```javascript +const ccxtpro = require ('ccxt').pro +console.log ('CCXT version', ccxtpro.version) +console.log ('Supported exchanges:', ccxtpro.exchanges) +``` +#### **Python** +```python +import ccxt.pro as ccxtpro +print('CCXT version', ccxtpro.__version__) +print('Supported exchanges:', ccxtpro.exchanges) +``` +#### **PHP** +```php +use \ccxt\pro; // optional, since you can use fully qualified names +echo 'CCXT version ', \ccxt\pro\Exchange::VERSION, "\n"; +echo 'Supported exchanges: ', json_encode(\ccxt\pro\Exchange::$exchanges), "\n"; +``` + + +The imported CCXT Pro module wraps the CCXT inside itself – every exchange instantiated via CCXT Pro has all the CCXT methods as well as the additional functionality. + +## Instantiation + +CCXT Pro is designed for async/await style syntax and relies heavily on async primitives such as *promises* and *futures*. + +Creating a CCXT Pro exchange instance is pretty much identical to creating a CCXT exchange instance. + + +#### **JavaScript** +```javascript +const ccxt = require ('ccxt').pro +const exchange = new ccxtpro.binance ({ newUpdates: false }) +``` + +#### **Python** + +The Python implementation of CCXT Pro relies on builtin [asyncio](https://docs.python.org/3/library/asyncio.html) and [Event Loop](https://docs.python.org/3/library/asyncio-eventloop.html) in particular. In Python it is possible to supply an asyncio's event loop instance in the constructor arguments as shown below (identical to `ccxt.async support`): + +```python +import ccxt.pro as ccxtpro +from asyncio import run + +async def main(): + exchange = ccxtpro.kraken({'newUpdates': False}) + while True: + orderbook = await exchange.watch_order_book('BTC/USD') + print(orderbook['asks'][0], orderbook['bids'][0]) + await exchange.close() + + +run(main()) +``` +#### **PHP** + +In PHP the async primitives are borrowed from [ReactPHP](https://reactphp.org). The PHP implementation of CCXT Pro relies on [Promise](https://github.com/reactphp/promise) and [EventLoop](https://github.com/reactphp/event-loop) in particular. In PHP the user is required to supply a ReactPHP's event loop instance in the constructor arguments as shown below: + +```php +error_reporting(E_ALL); +date_default_timezone_set('UTC'); +require_once 'vendor/autoload.php'; + +$exchange = new \ccxt\pro\kucoin(array( 'newUpdates' => false )); +``` + +#### **C#/Dotnet** + +```c# +using ccxt.pro; + + public async static Task Watch() + { + var exchange = new binance(); + while (true) + { + var trades = await exchange.WatchTrades("BTC/USDT"); + Console.WriteLine("Trades: " + JsonConvert.SerializeObject(trades, Formatting.Indented)); + } + } +``` + + + +## Exchange Properties + +Every CCXT Pro instance contains all properties of the underlying CCXT instance. Apart from the standard CCXT properties, the CCXT Pro instance includes the following: + +```javascript +{ + 'has': { // an associative array of extended exchange capabilities + 'ws': true, // only available in CCXT Pro + 'watchOrderBook': true, + 'watchTicker': true, + 'watchTickers': true, + 'watchTrades': true, + 'watchMyTrades': true, + 'watchOHLCV': true, + 'watchBalance': true, + 'watchPositions': true, + 'createOrderWs': true, + 'editOrderWs': true, + 'cancelOrderWs': true, + 'cancelOrdersWs': false, + 'cancelAllOrdersWs': true, + 'fetchOrderWs': true, + 'fetchOrdersWs': true, + 'fetchBalanceWs': true, + 'fetchMyTradesWs': true, + ... + }, + 'urls': { + 'api': { // will contain a streaming API base URL, depending on the underlying protocol + 'ws': 'wss://ws.exchange.com', // https://en.wikipedia.org/wiki/WebSocket + 'signalr': 'https://signalr.exchange.com' // https://en.wikipedia.org/wiki/SignalR + 'socketio': 'wss://socket.exchange.io' // https://socket.io + }, + }, + 'version': '1.21', + 'streaming': { + 'keepAlive': 30000, // integer keep-alive rate in milliseconds + 'maxPingPongMisses': 2.0, // how many ping pong misses to drop and reconnect + ... // other streaming options + }, + // incremental data structures + 'orderbooks': {}, // incremental order books indexed by symbol + 'ohlcvs': {}, // standard CCXT OHLCVs indexed by symbol by timeframe + 'balance': {}, // a standard CCXT balance structure, accounts indexed by currency code + 'orders': {}, // standard CCXT order structures indexed by order id + 'trades': {}, // arrays of CCXT trades indexed by symbol + 'tickers': {}, // standard CCXT tickers indexed by symbol + 'transactions': {}, // standard CCXT deposits and withdrawals indexed by id or txid + ... +} +``` + +## Unified API + +The Unified CCXT Pro API encourages direct control flow for better codestyle, more readable and architecturally superior code compared to using EventEmitters and callbacks. The latter is considered an outdated approach nowadays since it requires inversion of control (people aren't used to inverted thinking). + +CCXT Pro goes with the modern approach and it is designed for the async syntax. Under the hood, CCXT Pro will still have to use inverted control flow sometimes because of the dependencies and the WebSocket libs that can't do otherwise. + +The same is true not only for JS/ES6 but also for Python 3 async code as well. In PHP the async primitives are borrowed from [ReactPHP](https://reactphp.org/). + +Modern async syntax allows you to combine and split the execution into parallel pathways and then merge them, group them, prioritize them, and what not. With promises one can easily convert from direct async-style control flow to inverted callback-style control flow, back and forth. + +### Real-Time vs Throttling + +CCXT Pro supports two modes of tick function loops – the real-time mode and the throttling mode. Both of them are shown below in pseudocode: + +```javascript +// real-time mode +const limit = 5 // optional +while (true) { + try { + const orderbook = await exchange.watchOrderBook (symbol, limit) + // your reaction to the update takes place here + // you arrive here after receiving the update from the exchange in real time + console.log (orderbook) // every update + } catch (e) { + console.log (e) + // throw e // uncomment to stop the loop on exceptions + } +} +``` + +```javascript +// throttling mode +const limit = 5 // optional +// await is optional, alternatively you can launch it in bg without await +await exchange.watchOrderBook (symbol, limit) +while (true) { + // your reaction takes place here + // you arrive here every 100 ms regardless of whether there was an update or not + // in throttling mode offloading the orderbook with .limit () is required + console.log (exchange.orderbooks[symbol].limit (limit)) + await exchange.sleep (100) // every 100 ms +} +``` + +In **real-time mode** CCXT Pro will return the result as soon as each new delta arrives from the exchange. The general logic of a unified call in a real-time loop is to await for the next delta and immediately return the unified result structure to the user, over and over again. This is useful when reaction time is critical, or has to be as fast as possible. + +However, the real-time mode requires programming experience with async flows when it comes to synchronizing multiple parallel tick loops. Apart from that, the exchanges can stream a very large number of updates during periods of high activity or high volatility. Therefore the user developing a real-time algorithm has to make sure that the userland code is capable of consuming data that fast. Working in real-time mode may be more demanding for resources sometimes. + +In **throttling mode** CCXT Pro will receive and manage the data in the background. The user is responsible for calling the results from time to time when necessary. The general logic of the throttling loop is to sleep for most of the time and wake up to check the results occasionally. This is usually done at some fixed frequency, or, _"frame rate"_. The code inside a throttling loop is often easier to synchronize across multiple exchanges. The rationing of time spent in a throttled loop also helps reduce resource usage to a minimum. This is handy when your algorithm is heavy and you want to control the execution precisely to avoid running it too often. + +The obvious downside of the throttling mode is being less reactive or responsive to updates. When a trading algorithm has to wait some number milliseconds before being executed – an update or two may arrive sooner than that time expires. In throttling mode the user will only check for those updates upon next wakeup (loop iteration), so the reaction lag may vary within some number of milliseconds over time. + +## Public Methods + +### watchOrderBook + +The `watchOrderBook`'s interface is identical to [fetchOrderBook](https://github.com/ccxt/ccxt/wiki/Manual#order-book). It accepts three arguments: + +- `symbol` – string, a unified CCXT symbol, required +- `limit` – integer, the max number of bids/asks returned, optional +- `params` – assoc dictionary, optional overrides as described in [Overriding Unified API Params](https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params) + +In general, the exchanges can be divided in two categories: + +1. the exchanges that support limited orderbooks (streaming just the top part of the stack of orders) +2. the exchanges that stream full orderbooks only + +If the exchange accepts a limiting argument, the `limit` argument is sent towards the exchange upon subscribing to the orderbook stream over a WebSocket connection. The exchange will then send only the specified amount of orders which helps reduce the traffic. Some exchanges may only accept certain values of `limit`, like 10, 25, 50, 100 and so on. + +If the underlying exchange does not accept a limiting argument, the limiting is done on the client side. + +The `limit` argument does not guarantee that the number of bids or asks will always be equal to `limit`. It designates the upper boundary or the maximum, so at some moment in time there may be less than `limit` bids or asks, but never more than `limit` bids or asks. This is the case when the exchange does not have enough orders on the orderbook, or when one of the top orders in the orderbook gets matched and removed from the orderbook, leaving less than `limit` entries on either bids side or asks side. The free space in the orderbook usually gets quickly filled with new data. + +#### **JavaScript** +```javascript +if (exchange.has['watchOrderBook']) { + while (true) { + try { + const orderbook = await exchange.watchOrderBook (symbol, limit, params) + console.log (new Date (), symbol, orderbook['asks'][0], orderbook['bids'][0]) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchOrderBook']: + while True: + try: + orderbook = await exchange.watch_order_book(symbol, limit, params) + print(exchange.iso8601(exchange.milliseconds()), symbol, orderbook['asks'][0], orderbook['bids'][0]) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` +#### **PHP** +```php +if ($exchange->has['watchOrderBook']) { + $exchange::execute_and_run(function() use ($exchange, $symbol, $limit, $params) { + while (true) { + try { + $orderbook = yield $exchange->watch_order_book($symbol, $limit, $params); + echo date('c'), ' ', $symbol, ' ', json_encode(array($orderbook['asks'][0], $orderbook['bids'][0])), "\n"; + } catch (Exception $e) { + echo get_class($e), ' ', $e->getMessage(), "\n"; + } + } + }); +} +``` + + +#### watchOrderBookForSymbols + +Similar to `watchOrderBook` but accepts an array of symbols so you can subscribe to multiple orderbooks in a single message. + + +#### **JavaScript** +```javascript +if (exchange.has['watchOrderBookForSymbols']) { + while (true) { + try { + const orderbook = await exchange.watchOrderBookForSymbols (['BTC/USDT', 'LTC/USDT'], limit, params) + console.log (new Date (), symbol, orderbook['asks'][0], orderbook['bids'][0]) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchOrderBookForSymbols']: + while True: + try: + orderbook = await exchange.watchOrderBookForSymbols(['BTC/USDT', 'LTC/USDT'], limit, params) + print(exchange.iso8601(exchange.milliseconds()), symbol, orderbook['asks'][0], orderbook['bids'][0]) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` + + +### watchTicker +Some exchanges allow different topics to listen to tickers (ie: bookTicker). You can set this in `exchange.options['watchTicker']['name']` +```javascript +// JavaScript +if (exchange.has['watchTicker']) { + while (true) { + try { + const ticker = await exchange.watchTicker (symbol, params) + console.log (new Date (), ticker) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` + +```python +# Python +if exchange.has['watchTicker']: + while True: + try: + ticker = await exchange.watch_ticker(symbol, params) + print(exchange.iso8601(exchange.milliseconds()), ticker) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` +#### **PHP** +```php +if ($exchange->has['watchTicker']) { + $exchange::execute_and_run(function() use ($exchange, $symbol, $params) { + while (true) { + try { + $ticker = yield $exchange->watch_ticker($symbol, $params); + echo date('c'), ' ', json_encode($ticker), "\n"; + } catch (Exception $e) { + echo get_class($e), ' ', $e->getMessage(), "\n"; + } + } + }); +} +``` + + +### watchTickers + + +#### **JavaScript** +```javascript +if (exchange.has['watchTickers']) { + while (true) { + try { + const tickers = await exchange.watchTickers (symbols, params) + console.log (new Date (), tickers) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchTickers']: + while True: + try: + tickers = await exchange.watch_tickers(symbols, params) + print(exchange.iso8601(exchange.milliseconds()), tickers) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` +#### **PHP** +```php +if ($exchange->has['watchTickers']) { + $exchange::execute_and_run(function() use ($exchange, $symbols, $params) { + while (true) { + try { + $tickers = yield $exchange->watch_tickers($symbols, $params); + echo date('c'), ' ', json_encode($tickers), "\n"; + } catch (Exception $e) { + echo get_class($e), ' ', $e->getMessage(), "\n"; + } + } + }); +} +``` + + +### watchOHLCV + +A very common misconception about WebSockets is that WS OHLCV streams can somehow speed up a trading strategy. +If the purpose of your app is to implement OHLCV-trading or a speculative algorithmic strategy, **consider the following carefully**. + +In general, there's two types of trading data used in the algorithms: + +- 1st-order real-time data like orderbooks and trades +- 2nd-order non-real-time data like tickers, ohlcvs, etc + +When developers say _"real-time"_, that usually means pseudo real-time, or, put simply, _"as fast and as close to real time as possible"_. + +The 2nd-order data is **always** calculated from the 1st-order data. OHLCVs are calculated from aggregated trades. Tickers are calculated from trades and orderbooks. + +Some exchanges do the calculation of OHLCVs (2nd order data) for you on the exchange side and send you updates over WS (Binance). Other exchanges don't really think that is necessary, for a reason. + +Obviously, it takes time to calculate 2nd-order OHLCV candles from trades. Apart from that sending the calculated candle back to all connected users also takes time. Additional delays can happen during periods of high volatility if an exchange is traded very actively under high load. + +There is no strict guarantee on how much time it will take from the exchange to calculate the 2nd order data and stream it to you over WS. The delays and lags on OHLCV candles can vary significantly from exchange to exchange. For example, an exchange can send an OHLCV update ~30 seconds after the actual closing of a corresponding period. Other exchanges may send the current OHLCV updates at a regular intervals (say, once every 100ms), while in reality trades can happen much more frequently. + +Most people use WS to avoid any sorts of delays and have real-time data. So, in most cases it is much better to not wait for the exchange. Recalculating the 2nd order data from 1st order data on your own may be much faster and that can lower the unnecessary delays. Therefore it does not make much sense to use WS for watching just the OHLCV candles from the exchange. Developers would rather `watch_trades()` instead and recalculate the OHLCV candles using CCXT's built-in methods like `build_ohlcvc()`. + +```python +# Python +exchange = ccxtpro.binance() +if not exchange.has['watchOHLCV']: + while True: + try: + trades = await exchange.watch_trades(symbol) + ohlcvc = exchange.build_ohlcvc(trades, '1m') + print(ohlcvc) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` + +That explains why some exchanges reasonably think that OHLCVs are not necessary in the WS context, cause users can calculate that information in the userland much faster having just a WS stream of realtime 1st-order trades. + +If your application is not very time-critical, you can still subscribe to OHLCV streams, for charting purposes. If the underlying `exchange.has['watchOHLCV']`, you can `watchOHLCV()/watch_ohlcv()` as shown below: + + +#### **JavaScript** +```javascript +if (exchange.has['watchOHLCV']) { + while (true) { + try { + const candles = await exchange.watchOHLCV (symbol, timeframe, since, limit, params) + console.log (new Date (), candles) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchOHLCV']: + while True: + try: + candles = await exchange.watch_ohlcv(symbol, timeframe, since, limit, params) + print(exchange.iso8601(exchange.milliseconds()), candles) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` +#### **PHP** +```php +if ($exchange->has['watchOHLCV']) { + $exchange::execute_and_run(function() use ($exchange, $symbol, $timeframe, $since, $limit, $params) { + while (true) { + try { + $candles = yield $exchange->watch_ohlcv($symbol, $timeframe, $since, $limit, $params); + echo date('c'), ' ', $symbol, ' ', $timeframe, ' ', json_encode($candles), "\n"; + } catch (Exception $e) { + echo get_class($e), ' ', $e->getMessage(), "\n"; + } + } + }); +} +``` + + + +### watchOHLCVForSymbols + +Similar to `watchOHLCV` but allows multiple subscriptions of symbols and timeframes + +#### **JavaScript** +```javascript +if (exchange.has['watchOHLCVForSymbols']) { + while (true) { + try { + const subscriptions = [[ + ['BTC/USDT', '1d'], + ['LTC/USDT', '5m'], + ['ETH/USDT', '1h'] + ]] + const candles = await exchange.watchOHLCVForSymbols (subscriptions, since, limit, params) + console.log (new Date (), candles) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchOHLCVForSymbols']: + while True: + try: + subscriptions = [[ + ['BTC/USDT', '1d'], + ['LTC/USDT', '5m'], + ['ETH/USDT', '1h'] + ]] + candles = await exchange.watch_ohlcv_for_symbols(subscriptions, since, limit, params) + print(exchange.iso8601(exchange.milliseconds()), candles) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` + + + +### watchTrades + +#### **JavaScript** +```javascript +// JavaScript +if (exchange.has['watchTrades']) { + while (true) { + try { + const trades = await exchange.watchTrades (symbol, since, limit, params) + console.log (new Date (), trades) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchTrades']: + while True: + try: + trades = await exchange.watch_trades(symbol, since, limit, params) + print(exchange.iso8601(exchange.milliseconds()), trades) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` +#### **PHP** +```php +if ($exchange->has['watchTrades']) { + $exchange::execute_and_run(function() use ($exchange, $symbol, $since, $limit, $params) { + while (true) { + try { + $trades = yield $exchange->watch_trades($symbol, $since, $limit, $params); + echo date('c'), ' ', json_encode($trades), "\n"; + } catch (Exception $e) { + echo get_class($e), ' ', $e->getMessage(), "\n"; + } + } + }); +} +``` + +### watchTradesForSymbols + +Similar to `watchTrades` but allows subscribing to multiple symbols in a single call. + + +#### **JavaScript** +```javascript +if (exchange.has['watchTradesForSymbols']) { + while (true) { + try { + const trades = await exchange.watchTradesForSymbols (['LTC/USDT', 'BTC/USDT'], since, limit, params) + console.log (new Date (), trades) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchTradesForSymbols']: + while True: + try: + trades = await exchange.watchTradesForSymbols(['LTC/USDT', 'BTC/USDT'], since, limit, params) + print(exchange.iso8601(exchange.milliseconds()), trades) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` + + +## Private Methods + +In most cases the authentication logic is borrowed from CCXT since the exchanges use the same keypairs and signing algorithms for REST APIs and WebSocket APIs. See [API Keys Setup](https://github.com/ccxt/ccxt/wiki/Manual#api-keys-setup) for more details. + +### watchBalance + +#### **JavaScript** +```javascript +if (exchange.has['watchBalance']) { + while (true) { + try { + const balance = await exchange.watchBalance (params) + console.log (new Date (), balance) + } catch (e) { + console.log (e) + // stop the loop on exception or leave it commented to retry + // throw e + } + } +} +``` +#### **Python** +```python +if exchange.has['watchBalance']: + while True: + try: + balance = await exchange.watch_balance(params) + print(exchange.iso8601(exchange.milliseconds()), balance) + except Exception as e: + print(e) + # stop the loop on exception or leave it commented to retry + # raise e +``` +#### **PHP** +```php +if ($exchange->has['watchBalance']) { + $exchange::execute_and_run(function() use ($exchange, $params) { + while (true) { + try { + $balance = yield $exchange->watch_balance($params); + echo date('c'), ' ', json_encode($balance), "\n"; + } catch (Exception $e) { + echo get_class($e), ' ', $e->getMessage(), "\n"; + } + } + }); +} +``` + + +### watchOrders + + +#### **JavaScript** +```javascript +watchOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` +#### **Python** +```python +watch_orders(symbol=None, since=None, limit=None, params={}) +``` +#### **PHP** +```php +watch_orders($symbol = null, $since = null, $lmit = null, $params = array()); +``` + +#### **C#/.NET** + +```c# +public async Task> WatchOrders(string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) +``` + + +### watchMyTrades + +#### **JavaScript** +```javascript +watchMyTrades (symbol = undefined, since = undefined, limit = undefined, params = {}) +``` +#### **Python** +```python +watch_my_trades(symbol=None, since=None, limit=None, params={}) +``` +#### **PHP** +```php +watch_my_trades($symbol = null, $since = null, $lmit = null, $params = array()); +``` + +#### **C#/.NET** + +```c# +public async Task> WatchMyTrades(string symbol = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) + +``` + + +### watchPositions +watch all open positions and returns a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + + +#### **JavaScript** +```javascript +watchPositions (symbols = undefined, since = undefined, limit = undefined, params = {}) +``` +#### **Python** +```python +watch_positions(symbols=None, since=None, limit=None, params={}) +``` +#### **PHP** +```php +watch_positions($symbols = null, $since = null, $lmit = null, $params = array()); +``` + +#### **C#/.NET** + +```c# +public async Task> WatchPositions(List symbols = null, Int64? since2 = 0, Int64? limit2 = 0, Dictionary parameters = null) +``` + + +### createOrderWs + +#### **TypeScript** +```typescript +createOrderWs (symbol: string, type: OrderType, side: OrderSide, amount: number, price: number = undefined, params = {}) +``` +#### **Python** +```python +create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Optional[float] = None, params={}) +``` +#### **PHP** +```php +create_order_ws(string $symbol, string $type, string $side, float $amount, ?float $price = null, $params = array ()) +``` + +#### **C#/.NET** + +```c# + public async Task CreateOrderWs(string symbol, string type, string side, float amount, float? price2 = 0, Dictionary parameters = null) +``` + +### editOrderWs + +#### **TypeScript** +```typescript +// JavaScript +editOrderWs (id, symbol: string, type: OrderType, side: OrderSide, amount: number, price: number = undefined, params = {}) +``` +#### **Python** +```python +edit_order_ws(self, id, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Optional[float] = None, params={}) +``` +#### **PHP** +```php +edit_order_ws(string id, string $symbol, string $type, string $side, float $amount, ?float $price = null, $params = array ()) +``` + + +### cancelOrderWs + +#### **TypeScript** +```typescript +cancelOrderWs(id: string, symbol: string = undefined, params = {}) +``` +#### **Python** +```python +cancel_order_ws(self, id, symbol: str, params={}) +``` +#### **PHP** + +```php +cancel_order_ws(string $id, string $symbol, $params = array ()) +``` + + +### cancelOrdersWs + +#### **TypeScript** +```typescript +cancelOrdersWs(ids: string[], symbol: string = undefined, params = {}) +``` +#### **Python** + +```python +cancel_orders_ws(self, ids, symbol: str, params={}) +``` +#### **PHP** +```php +cancel_orders_ws(string[] $ids, string $symbol, $params = array ()) +``` + + +### cancelAllOrdersWs + +#### **TypeScript** +```typescript +cancelAllOrdersWs(symbol: string = undefined, params = {}) +``` +#### **Python** +```python +cancel_all_orders_ws(self, symbol: str, params={}) +``` +#### **PHP** +```php +cancel_all_orders_ws(string $symbol, $params = array ()) +``` + + +### watchTransactions + +```diff +- this method is a work in progress now (may be unavailable) +``` + +### Custom handler + +If you want to have an access to raw incoming messages and use your custom handlers, you can override exchange's `handleMessage/handle_message` method, like: + +A) By inheritance: + + +#### **JavaScript** +```javascript +class myExchange extends ccxt.pro.coinbase { + handleMessage (wsClient, data) { + console.log("Raw incoming message:", message) // this is the raw update + super.handleMessage(wsClient, data); + // your extra logic here + } +} +const ex = new myExchange(); +ex.watchTicker('BTC/USDT'); +``` +#### **Python** +```python + +class my_exchange(ccxt.pro.coinbase): + def handle_message(self, client, message): + print("Raw incoming message:", message) # this is the raw update + super().handle_message(client, message) + # your extra logic here + +async def example(): + ex = my_exchange() + await ex.watch_ticker('BTC/USDT') + +asyncio.run(example()) +``` +#### **PHP** +```php +class myBinance extends \ccxt\pro\binance { + public function __construct($options = array()) { + parent::__construct($options); + } + + // your custom handler + public function handle_message($ws, $message) { + parent::handle_message($ws, $message); // trigger original `handleMessage` + if ($your_condition) { + // execute your additional code + } + } +} + +$ex = new myBinance(); +$ex->watch_ticker('BTC/USDT'); + +``` + + +B) by overriding the method: + + +#### **JavaScript** +```javascript +function myHandler(ws, data, orignal_handler){ + orignal_handler(ws, data); // trigger original `handleMessage` + if (your_condition) { + // execute your additional code + } +} + +const ex = new ccxt.pro.binance(); +const original_handler = ex.handleMessage.bind(ex); +ex.handleMessage = (ws, data) => myHandler(ws, data, original_handler); +ex.watchTicker('BTC/USDT'); +``` +#### **Python** +```python + +def myHandler(instance, ws, data, original_handle_message): + original_handle_message(ws, data) # trigger original `handleMessage` + if your_condition: + # execute your additional code + +async def example(): + e = ccxt.pro.binance() + original_handle_message = e.handle_message + e.handle_message = lambda ws, data: myHandler(e, ws, data, original_handle_message) + await e.watch_ticker('BTC/USDT') + +asyncio.run(example()) +``` + + + +### Error Handling + +In case of an error the CCXT Pro will throw a standard CCXT exception, see [Error Handling](https://docs.ccxt.com/#/README?id=error-handling) for more details. diff --git a/docs/ccxt/wiki/ccxt.pro.md b/docs/ccxt/wiki/ccxt.pro.md new file mode 100644 index 0000000..f51c66e --- /dev/null +++ b/docs/ccxt/wiki/ccxt.pro.md @@ -0,0 +1,44 @@ +# CCXT Pro + +CCXT supports WebSockets (`Pro` part) for many exchanges. + +- [User Manual](ccxt.pro.manual) + - [Architecture Overview](ccxt.pro.manual#overview) + - [Prerequisites](ccxt.pro.manual#prerequisites) + - [Streaming Specifics](ccxt.pro.manual#streaming-specifics) + - [Linking](ccxt.pro.manual#linking) + - [Instantiation](ccxt.pro.manual#instantiation) + - [Exchange Properties](ccxt.pro.manual#exchange-properties) + - [Unified API](ccxt.pro.manual#unified-api) + - [Public Methods](ccxt.pro.manual#public-methods) + - [Market Data](ccxt.pro.manual#market-data) + - [`watchOrderBook (symbol, limit, params)`](ccxt.pro.manual#watchOrderBook) + - [`watchOrderBookForSymbols (symbols, limit, params)`](ccxt.pro.manual#watchOrderBookForSymbols) + - [`watchTicker (symbol, params)`](ccxt.pro.manual#watchTicker) + - [`watchTickers (symbols, params)`](ccxt.pro.manual#watchTickers) + - [`watchOHLCV (symbol, timeframe, since, limit, params)`](ccxt.pro.manual#watchOHLCV) + - [`watchOHLCVForSymbols (symbolsAndTimeframes, since, limit, params)`](ccxt.pro.manual#watchOHLCVForSymbols) + - [`watchTrades (symbol, since, limit, params)`](ccxt.pro.manual#watchTrades) + - [`watchTradesForSymbols (symbols, since, limit, params)`](ccxt.pro.manual#watchTradesForSymbols) + - [`watchBidsAsks (symbols, params)`](ccxt.pro.manual#watchBidsAsks) + - [`watchLiquidations (symbol, since, limit, params)`](ccxt.pro.manual#watchBidsAsks) + - [`watchLiquidationsForSymbols (symbols, since, limit, params)`](ccxt.pro.manual#watchForSymbols) + - [Private Methods](ccxt.pro.manual#private-methods) + - [Authentication](ccxt.pro.manual#authentication) + - [Trading](ccxt.pro.manual#trading) + - [`watchBalance (params)`](ccxt.pro.manual#watchBalance) + - [`watchOrders (symbol, since, limit, params)`](ccxt.pro.manual#watchOrders) + - [`watchOrdersForSymbols (symbols, since, limit, params)`](ccxt.pro.manual#watchOrdersForSymbols) + - [`watchPosition (symbol, since, limit, params)`](ccxt.pro.manual#watchPosition) + - [`watchPositions (symbols, since, limit, params)`](ccxt.pro.manual#watchPositions) + - [`watchMyTrades (symbol, since, limit, params)`](https://github.com/ccxt-dev/ccxt/wiki/ccxt.pro/Manual#watchMyTrades) + - [`watchDepositsWithdrawals (code, limit, params)`](https://github.com/ccxt/ccxt/wiki/Manual#watchDepositsWithdrawals) + - [`watchMyLiquidations (symbols, since, limit, params)`](https://github.com/ccxt/ccxt/wiki/Manual#watchMyLiquidations) + - [`watchMyLiquidationsForSymbols (symbols, since, limit, params)`](https://github.com/ccxt/ccxt/wiki/Manual#watchMyLiquidationsForSymbols) + - REST alternatives: + In addition to above methods, some major exchanges also support websocket methods for REST methods, like `createOrderWs` (which has same signature as `createOrder`). You can find them in `exchange.has` dictionary. + - [UnWatch](ccxt.pro.manual#unwatch) (for stopping **watch** methods). +- [Error Handling](ccxt.pro.manual#error-handling) +- [Troubleshooting](https://github.com/ccxt/ccxt/wiki/Manual#troubleshooting) +- [How To Submit An Issue](https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-submit-an-issue) +- [Usage Examples](https://github.com/ccxt/ccxt/tree/master/examples) diff --git a/docs/ccxt/wiki/examples/js/README.md b/docs/ccxt/wiki/examples/js/README.md new file mode 100644 index 0000000..ceace53 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/README.md @@ -0,0 +1,303 @@ + + +# [<-](Examples?id=javascript) + +# CCXT JavaScript Examples + +These examples might require the following super-useful high-quality Node.js modules by [xpl](https://github.com/xpl): + +- [ansicolor](https://github.com/xpl/ansicolor): A quality JavaScript library for the ANSI color/style management ([ansicolor @ npm](https://npmjs.com/package/ansicolor)) +- [as-table](https://github.com/xpl/as-table): A simple function that prints objects as ASCII tables ([as-table @ npm](https://npmjs.com/package/as-table)) +- [ololog](https://github.com/xpl/ololog): Platform-agnostic logging with blackjack and hookers ([ololog @ npm](https://npmjs.com/package/ololog)) + +All of the modules above are installed with the ccxt library devDependencies by npm automatically. + +To run the ccxt JavaScript examples from any folder type in console: + +```shell +node path/to/example.js # substitute for actual filename here +``` + + +- [Advanced Error Handling](./examples/js/advanced-error-handling.md) + +- [Aggregate Orderbook](./examples/js/aggregate-orderbook.md) + +- [Apex Example](./examples/js/apex-example.md) + +- [Arbitrage Pairs](./examples/js/arbitrage-pairs.md) + +- [Basic Chart](./examples/js/basic-chart.md) + +- [Basic Orderbook Polling](./examples/js/basic-orderbook-polling.md) + +- [Bcc Vs Bch](./examples/js/bcc-vs-bch.md) + +- [Benchmark](./examples/js/benchmark.md) + +- [Binance Fetch All Deposits](./examples/js/binance-fetch-all-deposits.md) + +- [Binance Fetch Ohlcv Many Symbols Async Await](./examples/js/binance-fetch-ohlcv-many-symbols-async-await.md) + +- [Binance Fetch Ohlcv Many Symbols Promise Then Callbacks](./examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.md) + +- [Binance Fetchticker Delivery Vs Future](./examples/js/binance-fetchTicker-delivery-vs-future.md) + +- [Binance Futures Transfer From Sub Account To Master](./examples/js/binance-futures-transfer-from-sub-account-to-master.md) + +- [Binance Margin Stop Order](./examples/js/binance-margin-stop-order.md) + +- [Binance Server Time](./examples/js/binance-server-time.md) + +- [Binance Universal Transfer](./examples/js/binance-universal-transfer.md) + +- [Bitfinex Fetch Trades](./examples/js/bitfinex-fetch-trades.md) + +- [Bitfinex2 Fetch Trades](./examples/js/bitfinex2-fetch-trades.md) + +- [Bitmex Browser Cors Proxy](./examples/js/bitmex-browser-cors-proxy.md) + +- [Bitpanda Fetchmytrades Reduce](./examples/js/bitpanda-fetchMyTrades-reduce.md) + +- [Bitrue Fetch Balance](./examples/js/bitrue-fetch-balance.md) + +- [Bitstamp Private Api](./examples/js/bitstamp-private-api.md) + +- [Bitstamp Public Api](./examples/js/bitstamp-public-api.md) + +- [Bittrex Balance](./examples/js/bittrex-balance.md) + +- [Bittrex Fetch Closed Orders History](./examples/js/bittrex-fetch-closed-orders-history.md) + +- [Blockchaincom Withdrawal](./examples/js/blockchaincom-withdrawal.md) + +- [Build Ohlcv Bars](./examples/js/build-ohlcv-bars.md) + +- [Builtin Rate Limiting Rest Poller](./examples/js/builtin-rate-limiting-rest-poller.md) + +- [Bybit Trailing](./examples/js/bybit-trailing.md) + +- [Bybit Updated](./examples/js/bybit-updated.md) + +- [Coinbase Fetch All Balances](./examples/js/coinbase-fetch-all-balances.md) + +- [Coinex Fetch All Deposit Addresses Using Fetchdepositaddress](./examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.md) + +- [Coinex Futures](./examples/js/coinex-futures.md) + +- [Coinone Fetch Tickers](./examples/js/coinone-fetch-tickers.md) + +- [Coinone Markets](./examples/js/coinone-markets.md) + +- [Compare Two Exchanges Capabilities](./examples/js/compare-two-exchanges-capabilities.md) + +- [Cors Proxy](./examples/js/cors-proxy.md) + +- [Create Order Handle Errors](./examples/js/create-order-handle-errors.md) + +- [Create Order Position With Takeprofit Stoploss](./examples/js/create-order-position-with-takeprofit-stoploss.md) + +- [Create Order With Retry](./examples/js/create-order-with-retry.md) + +- [Create Order Ws Example](./examples/js/create-order-ws-example.md) + +- [Create Orders Example](./examples/js/create-orders-example.md) + +- [Create Trailing Amount Order](./examples/js/create-trailing-amount-order.md) + +- [Create Trailing Percent Order](./examples/js/create-trailing-percent-order.md) + +- [Credentials](./examples/js/credentials.md) + +- [Custom Proxy Agent For Js](./examples/js/custom-proxy-agent-for-js.md) + +- [Custom Proxy Url](./examples/js/custom-proxy-url.md) + +- [Delta Maintenance Margin Rate Max Leverage](./examples/js/delta-maintenance-margin-rate-max-leverage.md) + +- [Env Variables](./examples/js/env-variables.md) + +- [Error Handling](./examples/js/error-handling.md) + +- [Exchange Capabilities](./examples/js/exchange-capabilities.md) + +- [Exchanges By Volume](./examples/js/exchanges-by-volume.md) + +- [Exchanges](./examples/js/exchanges.md) + +- [Fetch All Balances](./examples/js/fetch-all-balances.md) + +- [Fetch All Tickers To Files 2](./examples/js/fetch-all-tickers-to-files-2.md) + +- [Fetch All Tickers To Files](./examples/js/fetch-all-tickers-to-files.md) + +- [Fetch Balance](./examples/js/fetch-balance.md) + +- [Fetch Create Deposit Address](./examples/js/fetch-create-deposit-address.md) + +- [Fetch First Ohlcv Timestamp](./examples/js/fetch-first-ohlcv-timestamp.md) + +- [Fetch From Many Exchanges Simultaneously](./examples/js/fetch-from-many-exchanges-simultaneously.md) + +- [Fetch Funding Rate History](./examples/js/fetch-funding-rate-history.md) + +- [📂 Fetch Futures](https://github.com/ccxt/ccxt/tree/master/./examples/js/fetch-futures) + +- [Fetch Ohlcv From To Mark Index Premium](./examples/js/fetch-ohlcv-from-to-mark-index-premium.md) + +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/js/fetch-ohlcv-many-exchanges-continuosly.md) + +- [Fetch Ohlcv](./examples/js/fetch-ohlcv.md) + +- [Fetch Okex Futures](./examples/js/fetch-okex-futures.md) + +- [Fetch Orders](./examples/js/fetch-orders.md) + +- [Fetch Ticker From Multiple Exchanges](./examples/js/fetch-ticker-from-multiple-exchanges.md) + +- [Fetch Ticker Where Available](./examples/js/fetch-ticker-where-available.md) + +- [📂 Fetch Tickers](https://github.com/ccxt/ccxt/tree/master/./examples/js/fetch-tickers) + +- [Gateio Create Batch Order](./examples/js/gateio-create-batch-order.md) + +- [Gateio Futures](./examples/js/gateio-futures.md) + +- [Gateio Open Close Contract](./examples/js/gateio-open-close-contract.md) + +- [Gateio Swaps](./examples/js/gateio-swaps.md) + +- [Gdax Fetch Trades Pagination](./examples/js/gdax-fetch-trades-pagination.md) + +- [Hibachi Example](./examples/js/hibachi-example.md) + +- [Hitbtc2 Withdraw](./examples/js/hitbtc2-withdraw.md) + +- [How To Import One Exchange Esm](./examples/js/how-to-import-one-exchange-esm.md) + +- [Huobi Futures](./examples/js/huobi-futures.md) + +- [Huobi Open Close Contract](./examples/js/huobi-open-close-contract.md) + +- [Huobi Swaps](./examples/js/huobi-swaps.md) + +- [Huobipro Market Buy Sell Fetch Trading Limits](./examples/js/huobipro-market-buy-sell-fetch-trading-limits.md) + +- [Hybridcjsexample](./examples/js/hybridCJSExample.md) + +- [Hybridesmexample](./examples/js/hybridESMExample.md) + +- [Idex Fetch Balance](./examples/js/idex-fetch-balance.md) + +- [Instantiate All At Once](./examples/js/instantiate-all-at-once.md) + +- [Instantiate All From Json](./examples/js/instantiate-all-from-json.md) + +- [Kraken Create And Close Position](./examples/js/kraken-create-and-close-position.md) + +- [Kraken Fetch Order Trades](./examples/js/kraken-fetch-order-trades.md) + +- [Kraken Margin Trading](./examples/js/kraken-margin-trading.md) + +- [Kucoin Rate Limit](./examples/js/kucoin-rate-limit.md) + +- [Latoken Example](./examples/js/latoken-example.md) + +- [Live Orderbook](./examples/js/live-orderbook.md) + +- [Live Ticker](./examples/js/live-ticker.md) + +- [Live Tickers](./examples/js/live-tickers.md) + +- [Load All Contracts](./examples/js/load-all-contracts.md) + +- [Load All Symbols At Once](./examples/js/load-all-symbols-at-once.md) + +- [Load All Tickers At Once](./examples/js/load-all-tickers-at-once.md) + +- [Load Markets To Files](./examples/js/load-markets-to-files.md) + +- [Looping Over All Symbols Of Specific Exchanges](./examples/js/looping-over-all-symbols-of-specific-exchanges.md) + +- [Looping Over Specific Symbols Of All Exchanges](./examples/js/looping-over-specific-symbols-of-all-exchanges.md) + +- [Margin Loan Borrow Buy Sell Repay](./examples/js/margin-loan-borrow-buy-sell-repay.md) + +- [Market Status And Currency Status](./examples/js/market-status-and-currency-status.md) + +- [Ohlcv Console Chart](./examples/js/ohlcv-console-chart.md) + +- [Okex Fetch Closed Orders Archive](./examples/js/okex-fetch-closed-orders-archive.md) + +- [Okex Transfer](./examples/js/okex-transfer.md) + +- [Okx Poll Fetch My Trades](./examples/js/okx-poll-fetch-my-trades.md) + +- [Okx Poll Rate Limit](./examples/js/okx-poll-rate-limit.md) + +- [Order Book Extra Level Depth Param](./examples/js/order-book-extra-level-depth-param.md) + +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/js/phemex-create-order-position-with-takeprofit-stoploss.md) + +- [Poll Ohlcv](./examples/js/poll-ohlcv.md) + +- [Poloniex Fetch Order Books](./examples/js/poloniex-fetch-order-books.md) + +- [Poloniex Limits Amount Min](./examples/js/poloniex-limits-amount-min.md) + +- [Proxy Round Robin](./examples/js/proxy-round-robin.md) + +- [Proxy Usage](./examples/js/proxy-usage.md) + +- [Sample Local Proxy Server With Cors](./examples/js/sample-local-proxy-server-with-cors.md) + +- [Search All Exchanges](./examples/js/search-all-exchanges.md) + +- [Shared Load Markets](./examples/js/shared-load-markets.md) + +- [Sort Swap Markets By Hourly Price Change](./examples/js/sort-swap-markets-by-hourly-price-change.md) + +- [Symbols](./examples/js/symbols.md) + +- [Theocean](./examples/js/theocean.md) + +- [Tickers](./examples/js/tickers.md) + +- [Validate Paginated Data](./examples/js/validate-paginated-data.md) + +- [Watch Ohlcv For Symbols](./examples/js/watch-OHLCV-For-Symbols.md) + +- [Watch Ohlcv](./examples/js/watch-OHLCV.md) + +- [Watch Orderbook For Symbols](./examples/js/watch-OrderBook-For-Symbols.md) + +- [Watch Trades For Symbols](./examples/js/watch-Trades-For-Symbols.md) + +- [Watch Tickers](./examples/js/watch-tickers.md) + +- [Watchohlcvforsymbols](./examples/js/watchOHLCVForSymbols.md) + +- [Watchorderbookforsymbols](./examples/js/watchOrderBookForSymbols.md) + +- [Watchpositions Many Exchanges Continuosly.d](./examples/js/watchPositions-many-exchanges-continuosly.d.md) + +- [Watchpositions Many Exchanges Continuosly.d.ts](./examples/js/watchPositions-many-exchanges-continuosly.d.ts.md) + +- [Watchpositions Many Exchanges Continuosly](./examples/js/watchPositions-many-exchanges-continuosly.md) + +- [Watchpositions.d](./examples/js/watchPositions.d.md) + +- [Watchpositions.d.ts](./examples/js/watchPositions.d.ts.md) + +- [Watchpositions](./examples/js/watchPositions.md) + +- [Watchpositionsforsymbols.d](./examples/js/watchPositionsForSymbols.d.md) + +- [Watchpositionsforsymbols.d.ts](./examples/js/watchPositionsForSymbols.d.ts.md) + +- [Watchpositionsforsymbols](./examples/js/watchPositionsForSymbols.md) + +- [Watchtradesforsymbols](./examples/js/watchTradesForSymbols.md) + +- [Withdraw From One Exchange To Another](./examples/js/withdraw-from-one-exchange-to-another.md) + diff --git a/docs/ccxt/wiki/examples/js/advanced-error-handling.md b/docs/ccxt/wiki/examples/js/advanced-error-handling.md new file mode 100644 index 0000000..1babeb8 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/advanced-error-handling.md @@ -0,0 +1,45 @@ +- [Advanced Error Handling](./examples/js/) + + + ```javascript + "use strict"; + +const ccxt = require ('../../ccxt.js'); + +// instantiate the exchange +let exchange = new ccxt.coinbasepro ({ + 'apiKey': 'XXXXXXXXXXXXXX', + 'secret': 'YYYYYYYYYYYYYY', +}); + +async function checkOrders(){ + try { + // fetch orders + let orders = await exchange.fetchOrders ('BTC/USDT'); + // output the result + console.log (exchange.id, 'fetched orders', orders); + } catch (e) { + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + console.log ('[DDoS Protection] ' + e.message); + } else if (e instanceof ccxt.RequestTimeout) { + console.log ('[Request Timeout] ' + e.message); + } else if (e instanceof ccxt.AuthenticationError) { + console.log ('[Authentication Error] ' + e.message); + } else if (e instanceof ccxt.ExchangeNotAvailable) { + console.log ('[Exchange Not Available Error] ' + e.message); + } else if (e instanceof ccxt.ExchangeError) { + console.log ('[Exchange Error] ' + e.message); + } else if (e instanceof ccxt.NetworkError) { + console.log ('[Network Error] ' + e.message); + } else { + // you can throw it if you want to stop the execution + // console.log ('[Exception ' + e.constructor.name + '] ' + e.message); + throw e; + } + } +} + +// for demonstrational purposes, we use 1000 ms interval +setInterval(checkOrders, 1000); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/aggregate-orderbook.md b/docs/ccxt/wiki/examples/js/aggregate-orderbook.md new file mode 100644 index 0000000..8729e03 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/aggregate-orderbook.md @@ -0,0 +1,59 @@ +- [Aggregate Orderbook](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +const aggregateOrderBookSide = function (orderbookSide, precision = undefined) { + const result = [] + const amounts = {} + for (let i = 0; i < orderbookSide.length; i++) { + const ask = orderbookSide[i] + let price = ask[0] + if (precision !== undefined) { + price = ccxt.decimalToPrecision (price, ccxt.ROUND, precision, ccxt.TICK_SIZE) + } + amounts[price] = (amounts[price] || 0) + ask[1] + } + Object.keys (amounts).forEach (price => { + result.push ([ + parseFloat (price), + amounts[price] + ]) + }) + return result +} + +const aggregateOrderBook = function (orderbook, precision = undefined) { + let asks = aggregateOrderBookSide(orderbook['asks'], precision) + let bids = aggregateOrderBookSide(orderbook['bids'], precision) + return { + 'asks': ccxt.sortBy (asks, 0), + 'bids': ccxt.sortBy (bids, 0, true), + 'timestamp': orderbook['timestamp'], + 'datetime': orderbook['datetime'], + 'nonce': orderbook['nonce'], + }; +} + +;(async () => { + + const exchange = new ccxt.coinbasepro() + + await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for verbose debug output + + // level 2 (default) + const orderbook = await exchange.fetchOrderBook('BTC/USD') + + // or level 3 + // const orderbook = await exchange.fetchOrderBook('BTC/USD', undefined, { 'level': 3 }) + + const step = 0.5 // 0.01, 0.1, 0.5, 1.0, 2.5, 5.0, 10.0 + console.log (aggregateOrderBook (orderbook, step)) + +})(); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/apex-example.md b/docs/ccxt/wiki/examples/js/apex-example.md new file mode 100644 index 0000000..38944ca --- /dev/null +++ b/docs/ccxt/wiki/examples/js/apex-example.md @@ -0,0 +1,103 @@ +- [Apex Example](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.apex({ + 'apiKey': 'your api Key', + 'secret': 'your api secret', + 'walletAddress': 'your eth address', + 'options': { + 'accountId': 'your account id', + 'passphrase': 'your api passphrase', + 'seeds': 'your zklink omni seed', + 'brokerId': '', + }, + }); + exchange.setSandboxMode (true) + const fetchTime = await exchange.fetchTime(); + console.log(fetchTime); + //const transfer = await exchange.transfer('USDT', 1.1); + //console.log(transfer); + //const transferFromContract = await exchange.transfer('USDT', 1.2, 'contract', 'spot'); + //console.log(transferFromContract); + //const fetchCurrencies = await exchange.fetchCurrencies(); + //console.log(fetchCurrencies); + //const fetchBalance = await exchange.fetchBalance(); + //console.log(fetchBalance); + //const fetchMarkets = await exchange.fetchMarkets(); + //console.log(fetchMarkets); + //const fetchTicker = await exchange.fetchTicker('BTC-USDT'); + //console.log(fetchTicker); + //const fetchTickers = await exchange.fetchTickers(); + //console.log(fetchTickers); + //const fetchTrades = await exchange.fetchTrades('BTC-USDT'); + //console.log(fetchTrades); + //const fetchOHLCV = await exchange.fetchOHLCV('BTC-USDT','1m', undefined, 200); + //console.log(fetchOHLCV); + //const fechOrderBook = await exchange.fetchOrderBook('BTC-USDT'); + //console.log(fechOrderBook); + //const fetchOpenInterest = await exchange.fetchOpenInterest('BTC-USDT'); + //console.log(fetchOpenInterest); + + //const fetchTransfers = await exchange.fetchTransfers(); + //console.log(fetchTransfers); + //const fetchTransfer = await exchange.fetchTransfer(); + //console.log(fetchTransfer); + + //const createOrderRes1 = await exchange.createOrder('BTC-USDT', 'LIMIT', 'SELL', 0.001, 100000, {'reduceOnly':true}); + //console.log(createOrderRes1); + const createOrderRes1 = await exchange.createOrder('BTC-USDT', 'STOP_LIMIT', 'BUY', 0.001, 100000, {'triggerPriceType':'INDEX', 'triggerPrice':'10100'}); + console.log(createOrderRes1); + + const fetchOpenOrders = await exchange.fetchOpenOrders(); + console.log(fetchOpenOrders); + //const fetchOpenOrder = await exchange.fetchOrder(undefined,undefined,{"clientOrderId":'apexomni-615910568987983964-1741322302826-253839'}); + //console.log(fetchOpenOrder); + //const cancelOrder = await exchange.cancelOrder('685707935650677596'); + //console.log(cancelOrder); + //const cancelOrder1 = await exchange.cancelOrder(undefined,undefined,{"clientOrderId":'apexomni-615910568987983964-1741324574601-908656'}); + //console.log(cancelOrder1); + //const cancelAllOrders = await exchange.cancelAllOrders(); + //console.log(cancelAllOrders); + + //const setLeverage = await exchange.setLeverage(5,'BTC-USDT'); + //console.log(setLeverage); + + //const fetchPositions = await exchange.fetchPositions(); + //console.log(fetchPositions); + + //const fetchOrder = await exchange.fetchOrder('685781264227107164'); + //console.log(fetchOrder); + + //const fetchOrderTrades = await exchange.fetchOrderTrades('685781264227107164'); //{"clientOrderId":'apexomni-615910568987983964-1741339789276-640091'} + //console.log(fetchOrderTrades); + + + let since = exchange.milliseconds () - 86400000*1; // -1 day from now + let allTrades = []; + let page = 0; + while (since < exchange.milliseconds ()) { + const params = { + 'page': page, // exchange-specific non-unified parameter name + } + const trades = await exchange.fetchFundingHistory ('BTC-USDT', since, 20, params) + if (trades.length) { + allTrades = allTrades.concat (trades) + page++ + } else { + break + } + } + allTrades = exchange.sortBy(allTrades, 'timestamp'); + + + const createOrderRes = await exchange.createOrder('BTC-USDT', 'LIMIT', 'BUY', 0.001, 70000, {'reduceOnly':true,'postOnly':true}); + console.log(createOrderRes); + console.log('end'); +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/arbitrage-pairs.md b/docs/ccxt/wiki/examples/js/arbitrage-pairs.md new file mode 100644 index 0000000..927077a --- /dev/null +++ b/docs/ccxt/wiki/examples/js/arbitrage-pairs.md @@ -0,0 +1,135 @@ +- [Arbitrage Pairs](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import fs from 'fs'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'), keysGlobal = 'keys.json', keysLocal = 'keys.local.json', keysFile = fs.existsSync (keysLocal) ? keysLocal : (fs.existsSync (keysGlobal) ? keysGlobal : false), config = keysFile ? require ('../../' + keysFile) : {}; + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'id1'.green, 'id2'.yellow, 'id3'.blue, '...') + printSupportedExchanges () +} + +let printExchangeSymbolsAndMarkets = function (exchange) { + log (getExchangeSymbols (exchange)) + log (getExchangeMarketsTable (exchange)) +} + +let getExchangeMarketsTable = (exchange) => { + return asTable.configure ({ delimiter: ' | ' }) (Object.values (markets)) +} + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)); + +let proxies = [ + '', // no proxy by default + 'https://crossorigin.me/', + 'https://cors-anywhere.herokuapp.com/', +] + +;(async function main () { + + if (process.argv.length > 3) { + + let ids = process.argv.slice (2) + let exchanges = {} + + log (ids.join (', ').yellow) + + // load all markets from all exchanges + for (let id of ids) { + + let settings = config[id] || {} + + // instantiate the exchange by id + let exchange = new ccxt[id] (ccxt.extend ({ + // verbose, + // 'proxy': 'https://cors-anywhere.herokuapp.com/', + }, settings)) + + // save it in a dictionary under its id for future use + exchanges[id] = exchange + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + // basic round-robin proxy scheduler + let currentProxy = 0 + let maxRetries = proxies.length + + for (let numRetries = 0; numRetries < maxRetries; numRetries++) { + + try { // try to load exchange markets using current proxy + + exchange.proxy = proxies[currentProxy] + await exchange.loadMarkets () + + } catch (e) { // rotate proxies in case of connectivity errors, catch all other exceptions + + // swallow connectivity exceptions only + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + log.bright.yellow ('[DDoS Protection Error] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow ('[Timeout Error] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow ('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow ('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow ('[Exchange Error] ' + e.message) + } else { + throw e; // rethrow all other exceptions + } + + // retry next proxy in round-robin fashion in case of error + currentProxy = ++currentProxy % proxies.length + } + } + + log (id.green, 'loaded', exchange.symbols.length.toString ().green, 'markets') + } + + log ('Loaded all markets'.green) + + // get all unique symbols + let uniqueSymbols = ccxt.unique (ccxt.flatten (ids.map (id => exchanges[id].symbols))) + + // filter out symbols that are not present on at least two exchanges + let arbitrableSymbols = uniqueSymbols + .filter (symbol => + ids.filter (id => + (exchanges[id].symbols.indexOf (symbol) >= 0)).length > 1) + .sort ((id1, id2) => (id1 > id2) ? 1 : ((id2 > id1) ? -1 : 0)) + + // print a table of arbitrable symbols + let table = arbitrableSymbols.map (symbol => { + let row = { symbol } + for (let id of ids) + if (exchanges[id].symbols.indexOf (symbol) >= 0) + row[id] = id + return row + }) + + log (asTable.configure ({ delimiter: ' | ' }) (table)) + + } else { + + printUsage () + + } + + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/basic-chart.md b/docs/ccxt/wiki/examples/js/basic-chart.md new file mode 100644 index 0000000..e6efa21 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/basic-chart.md @@ -0,0 +1,34 @@ +- [Basic Chart](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asciichart from 'asciichart'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async function main () { + + // experimental, not yet implemented for all exchanges + // your contributions are welcome ;) + + const index = 4 // [ timestamp, open, high, low, close, volume ] + const ohlcv = await new ccxt.okcoin ().fetchOHLCV ('BTC/USD', '15m') + const lastPrice = ohlcv[ohlcv.length - 1][index] // closing price + const series = ohlcv.map (x => x[index]) // closing price + const bitcoinRate = ('₿ = $' + lastPrice).green + const chart = asciichart.plot (series, { height: 15, padding: ' ' }) + log.yellow ("\n" + chart, bitcoinRate, "\n") + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/basic-orderbook-polling.md b/docs/ccxt/wiki/examples/js/basic-orderbook-polling.md new file mode 100644 index 0000000..740bc0f --- /dev/null +++ b/docs/ccxt/wiki/examples/js/basic-orderbook-polling.md @@ -0,0 +1,18 @@ +- [Basic Orderbook Polling](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +const id = 'huobipro', exchange = new ccxt[id] ({ enableRateLimit: true }), symbol = 'ETH/BTC';(async function main () { + + await exchange.loadMarkets () + + for (let i = 0; i < 2000; i++) { + + const orderbook = await exchange.fetchOrderBook (symbol) + console.log (new Date (), i, symbol, orderbook.asks[0], orderbook.bids[0]) + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bcc-vs-bch.md b/docs/ccxt/wiki/examples/js/bcc-vs-bch.md new file mode 100644 index 0000000..022bbe1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bcc-vs-bch.md @@ -0,0 +1,121 @@ +- [Bcc Vs Bch](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog' +import config from '../../keys.json'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)) + +let proxies = [ + '', // no proxy by default + 'https://crossorigin.me/', + 'https://cors-anywhere.herokuapp.com/', +] + +;(async function main () { + + let ids = ccxt.exchanges + let exchanges = {} + + // instantiate all exchanges + ccxt.exchanges.forEach (id => { + if (id in ccxt) + exchanges[id] = new (ccxt)[id] ({ + verbose: false, + substituteCommonCurrencyCodes: true, + }) + }) + + // set up api keys appropriately + for (let id in config) { + if (id in exchanges) + for (let key in config[id]) + exchanges[id][key] = config[id][key] + } + + log (ids.join (', ').yellow) + + // load all markets from all exchanges + + await Promise.all (ids.map (async id => { + + let exchange = exchanges[id] + + // basic round-robin proxy scheduler + let currentProxy = 0 + let maxRetries = proxies.length + + for (let numRetries = 0; numRetries < maxRetries; numRetries++) { + + try { // try to load exchange markets using current proxy + + exchange.proxy = proxies[currentProxy] + await exchange.loadMarkets () + + } catch (e) { // rotate proxies in case of connectivity errors, catch all other exceptions + + // swallow connectivity exceptions only + if ((e instanceof ccxt.DDoSProtection) || e.message.includes ('ECONNRESET')) { + log.bright.yellow (exchange.id + ' [DDoS Protection]') + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id + ' [Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id + ' [Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id + ' [Exchange Not Available] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id + ' [Exchange Error] ' + e.message) + } else { + throw e; // rethrow all other exceptions + } + + // retry next proxy in round-robin fashion in case of error + currentProxy = ++currentProxy % proxies.length + } + } + + if (exchange.symbols) + log (id.green, 'loaded', exchange.symbols.length.toString ().green, 'markets') + + })) + + log ('Loaded all markets'.green) + + let table = ccxt.exchanges.map (id => { + console.log (id) + let exchange = exchanges[id] + if (exchange.currencies) { + let hasBCC = exchange.currencies.includes ('BCC') + let hasBCH = exchange.currencies.includes ('BCH') + let hasBoth = (hasBCC && hasBCH) + return { + id, + 'BCC': hasBoth ? id.green : (hasBCC ? id.yellow : ''), + 'BCH': hasBCH ? id.green : '', + } + } else { + return { + 'id': id.red, + 'BCC': '', + 'BCH': '', + } + } + }) + + log (asTable.configure ({ delimiter: ' | ' }) (table)) + + process.exit () + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/benchmark.md b/docs/ccxt/wiki/examples/js/benchmark.md new file mode 100644 index 0000000..43817b4 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/benchmark.md @@ -0,0 +1,110 @@ +- [Benchmark](./examples/js/) + + + ```javascript + import { spawn } from 'child_process'; +import asTable from 'as-table'; +import ccxt, { version } from '../../js/ccxt.js'; +const stats = (times) => { + // calculate statistics + const sum = times.reduce((a, b) => a + b, 0); + const avg = Math.round(sum / times.length); + const min = Math.min(...times); + const max = Math.max(...times); + times.sort((a, b) => a - b); + const median = times.length % 2 === 0 ? (times[times.length / 2 - 1] + times[times.length / 2]) / 2 : times[Math.floor(times.length / 2)]; + return { min, 'average': avg, max, median, 'iterations': times.length }; +}; +async function benchmark(exchangeId, method, args, verbose = false, minIterations = 10, argsv = '') { + const exchange = new ccxt.pro[exchangeId]({}); + const languages = ['js', 'py', 'php', 'cs']; + const commands = languages.map((language) => ({ + 'language': language, + 'method': method, + 'command': `npm run cli.${language} ${exchangeId} ${method} ${args.join(' ')} -- ${argsv} --poll`, + })); + const wsMethod = method + 'Ws'; + if (exchange.has[wsMethod]) { + const wsCommands = languages.map((language) => ({ + 'language': language, + 'method': wsMethod, + 'command': `npm run cli.${language} ${exchangeId} ${wsMethod} ${args.join(' ')} -- ${argsv} --poll`, + })); + commands.push(...wsCommands); + } + const regex = /iteration (\d+) passed in (\d+) ms/g; + async function runCommand(command) { + if (verbose) { + console.log(exchange.iso8601(new Date().getTime()), ' running command:', command); + } + return new Promise((resolve, reject) => { + const [cmd, ...args] = command.split(' '); + const child = spawn(cmd, args); + const matches = []; + const language = command.slice(8, 15); + child.stdout.on('data', (data) => { + const message = data.toString(); + matches.push(...Array.from(message.matchAll(regex))); + const match = matches[matches.length - 1]; + if (match && match[1] && match[2]) { + const iteration = parseInt(match[1]); + const time = parseInt(match[2]); + if (iteration <= minIterations) { + if (verbose) { + console.log(exchange.iso8601(new Date().getTime()), `${language} iteration ${iteration} passed in ${time} ms`); + } + } + else { + const times = matches.map((m) => parseInt(m[2])); + child.kill(); + if (verbose) { + console.log(exchange.iso8601(new Date().getTime()), `killed process - ${language} iteration ${iteration} passed in ${time} ms`); + } + resolve({ times }); + } + } + }); + child.stderr.on('data', (data) => { + const message = data.toString(); + console.error(exchange.iso8601(new Date().getTime()), `command ${command} failed. stderr: ${message}`); + const times = matches.map((m) => parseInt(m[2])); + resolve({ times }); + }); + child.on('close', (code) => { + const times = matches.map((m) => parseInt(m[2])); + resolve({ times }); + console.log(exchange.iso8601(new Date().getTime()), `${language} child process exited with code ${code}`); + }); + child.on('error', (err) => { + console.error(exchange.iso8601(new Date().getTime()), `command ${command} failed. error: ${err}`); + reject(err); + }); + }); + } + const benchmarks = []; + const results = await Promise.all(commands.map((c) => runCommand(c.command))); + for (let i = 0; i < results.length; i++) { + const result = results[i]; + benchmarks.push({ 'language': commands[i].language, 'method': commands[i].method, ...stats(result.times) }); + } + if (verbose) { + const rawResults = results.map((r, i) => ({ 'language': commands[i].language, 'method': commands[i].method, ...stats(r.times), 'times': r.times })); + console.log(rawResults); + } + console.log(asTable(benchmarks)); +} +const [_, , exchangeId, methodName, ...params] = process.argv.filter((x) => !x.startsWith('--')); +const verbose = process.argv.includes('--verbose'); +const minIterationsString = process.argv.find((x) => x.startsWith('--min-iterations='))?.slice(18); +const minIterations = minIterationsString ? parseInt(minIterationsString) : 10; +const argsv = process.argv.filter((x) => x.startsWith('--') && !x.startsWith('--min-iterations')).join(' '); +console.log((new Date()).toISOString()); +console.log('Node.js:', process.version); +console.log('CCXT v' + version); +const start = new Date().getTime(); +await benchmark(exchangeId, methodName, params, verbose, minIterations, argsv); +const end = new Date().getTime(); +console.log((new Date().toISOString()), 'Total time:', end - start, 'ms'); +process.exit(0); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-fetch-all-deposits.md b/docs/ccxt/wiki/examples/js/binance-fetch-all-deposits.md new file mode 100644 index 0000000..0b7f17d --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-fetch-all-deposits.md @@ -0,0 +1,50 @@ +- [Binance Fetch All Deposits](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +(async function main () { + + const exchange = new ccxt.binance ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) + + await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging + + const ninetyDays = 90 * 24 * 60 * 60 * 1000; + let startTime = exchange.parse8601 ('2018-01-01T00:00:00') + const now = exchange.milliseconds () + const currencyCode = undefined // any currency + + let allTransactions = [] + + while (startTime < now) { + + const endTime = startTime + ninetyDays + + const transactions = await exchange.fetchDeposits (currencyCode, startTime, undefined, { + 'endTime': endTime, + }) + if (transactions.length) { + const lastTransaction = transactions[transactions.length - 1] + startTime = lastTransaction['timestamp'] + 1 + allTransactions = allTransactions.concat (transactions) + } else { + startTime = endTime; + } + } + + console.log ('Fetched', allTransactions.length, 'transactions') + for (let i = 0; i < allTransactions.length; i++) { + const transaction = allTransactions[i] + console.log (i, transaction['datetime'], transaction['txid'], transaction['currency'], transaction['amount']) + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-async-await.md b/docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-async-await.md new file mode 100644 index 0000000..eeac5f5 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-async-await.md @@ -0,0 +1,39 @@ +- [Binance Fetch Ohlcv Many Symbols Async Await](./examples/js/) + + + ```javascript + 'use strict'; + +const ccxt = require ('../../js/ccxt.js') + +console.log('CCXT Version:', ccxt.version) + +async function symbolLoop (exchange, symbol, timeframe) { + while (true) { + try { + const ohlcvs = await exchange.fetchOHLCV (symbol, timeframe) + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, ohlcvs.length, 'OHLCV candles received') + // await exchange.sleep (60 * 1000) // sleep if necessary, though not required + } catch (e) { + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, e.constructor.name, e.message) + } + } +} + +async function main () { + const exchange = new ccxt.binance () + await exchange.loadMarkets () + // exchange.verbose = true // uncomment for debugging purposes if necessary + const symbols = [ + 'BTC/USDT', // unified symbols used here as opposed to exchange-specific market ids + 'ETH/USDT', // more about unified symbols vs exchange-specific ids here: + 'ADA/USDT', // https://github.com/ccxt/ccxt/wiki/Manual#markets + ] + const timeframe = '1m' + const loops = symbols.map (symbol => symbolLoop (exchange, symbol, timeframe)) + await Promise.all (loops) +} + + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.md b/docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.md new file mode 100644 index 0000000..4e0b779 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.md @@ -0,0 +1,38 @@ +- [Binance Fetch Ohlcv Many Symbols Promise Then Callbacks](./examples/js/) + + + ```javascript + 'use strict'; + +const ccxt = require ('../../js/ccxt.js') + +console.log('CCXT Version:', ccxt.version) + +function symbolLoop (exchange, symbol, timeframe) { + exchange.fetchOHLCV (symbol, timeframe).then (ohlcvs => { + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, ohlcvs.length, 'OHLCV candles received') + setTimeout (() => symbolLoop (exchange, symbol, timeframe), 0) + }).catch (e => { + console.log (exchange.iso8601 (exchange.milliseconds ()), exchange.id, symbol, e.constructor.name, e.message) + setTimeout (() => symbolLoop (exchange, symbol, timeframe), 0) + }) +} + +function main () { + const exchange = new ccxt.binance () + // exchange.verbose = true // uncomment for debugging purposes if necessary + const symbols = [ + 'BTC/USDT', // unified symbols used here as opposed to exchange-specific market ids + 'ETH/USDT', // more about unified symbols vs exchange-specific ids here: + 'ADA/USDT', // https://github.com/ccxt/ccxt/wiki/Manual#markets + ] + const timeframe = '1m' + exchange.loadMarkets ().then (markets => { + for (const symbol of symbols) { + setTimeout (() => symbolLoop (exchange, symbol, timeframe), 0) + } + }) +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-fetchTicker-delivery-vs-future.md b/docs/ccxt/wiki/examples/js/binance-fetchTicker-delivery-vs-future.md new file mode 100644 index 0000000..2cdbc80 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-fetchTicker-delivery-vs-future.md @@ -0,0 +1,36 @@ +- [Binance Fetchticker Delivery Vs Future](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +async function fetchTickers (exchange) { + let tickers = undefined + try { + // await exchange.loadMarkets () // optional + tickers = await exchange.fetchTickers () + } catch (e) { + console.error (e.constructor.name, e.message) + } + return tickers +} + +(async () => { + + const future = new ccxt.binance ({ options: { defaultType: 'future' }}) + const delivery = new ccxt.binance ({ options: { defaultType: 'delivery' }}) + + // ... + + const futureTickers = await fetchTickers (future); + console.log (futureTickers) + + console.log ('-------------------------------------------') + + const deliveryTickers = await fetchTickers (delivery); + console.log (deliveryTickers) + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-futures-transfer-from-sub-account-to-master.md b/docs/ccxt/wiki/examples/js/binance-futures-transfer-from-sub-account-to-master.md new file mode 100644 index 0000000..12571eb --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-futures-transfer-from-sub-account-to-master.md @@ -0,0 +1,47 @@ +- [Binance Futures Transfer From Sub Account To Master](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +// https://github.com/ccxt/ccxt/issues/10181 + +async function main () { + + const exchange = new ccxt.binance ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) + + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes + + const fromEmail = 'sender@example.com' // edit for your values + , toEmail = 'receiver@example.com' // edit for your values + , code = 'USDT' // edit for your values + , amount = 100 // edit for your values + , futuresType = 1 // 1 for USDT-margined futures,2 for coin-margined futures + + const currency = exchange.currency (code); + + const response = await exchange.sapiPostSubAccountFuturesInternalTransfer ({ + 'fromEmail': fromEmail, // sender email + 'toEmail': toEmail, // recipient email + 'futuresType': futuresType, // 1 for USDT-margined futures,2 for coin-margined futures + 'asset': currency['id'], + 'amount': exchange.currencyToPrecision (code, amount), + }) + + console.log (response) + +} + +main () + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-margin-stop-order.md b/docs/ccxt/wiki/examples/js/binance-margin-stop-order.md new file mode 100644 index 0000000..10a9181 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-margin-stop-order.md @@ -0,0 +1,45 @@ +- [Binance Margin Stop Order](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'options': { + 'defaultType': 'margin', + }, + }) + + const markets = await exchange.loadMarkets () + + exchange.verbose = true // uncomment for debugging purposes if necessary + + const symbol = 'BTC/USDT' + const type = 'STOP_LOSS_LIMIT' + const side = 'buy' + const amount = YOUR_AMOUNT_HERE + const price = YOUR_PRICE_HERE + const params = { + 'stopPrice': YOUR_STOP_PRICE_HERE, + 'timeInForce': 'GTC', + } + + try { + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + } catch (e) { + console.log (e.constructor.name, e.message) + } +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-server-time.md b/docs/ccxt/wiki/examples/js/binance-server-time.md new file mode 100644 index 0000000..fe05589 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-server-time.md @@ -0,0 +1,40 @@ +- [Binance Server Time](./examples/js/) + + + ```javascript + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' + +const log = ololog.configure ({ locate: false }) + +const binance = new ccxt['binance'] () +const recvWindow = binance.options.recvWindow +const aheadWindow = 1000 + +async function test () { + const localStartTime = Date.now () + const { serverTime } = await binance.publicGetTime () + const localFinishTime = Date.now () + const estimatedLandingTime = (localFinishTime + localStartTime) / 2 + + const diff = serverTime - estimatedLandingTime + + log (`request departure time: ${binance.iso8601 (localStartTime)}`) + log (`response arrival time: ${binance.iso8601 (localFinishTime)}`) + log (`server time: ${binance.iso8601 (serverTime)}`) + log (`request landing time (est): ${binance.iso8601 (estimatedLandingTime)}, ${Math.abs (diff)} ms ${Math.sign (diff) > 0 ? 'behind' : 'ahead of'} server`) + log ('\n') + + if (diff < -aheadWindow) { + log.error.red (`your request will likely be rejected if local time is ahead of the server's time for more than ${aheadWindow} ms \n`) + } + + if (diff > recvWindow) { + log.error.red (`your request will likely be rejected if local time is behind server time for more than ${recvWindow} ms\n`) + } +} + +test (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/binance-universal-transfer.md b/docs/ccxt/wiki/examples/js/binance-universal-transfer.md new file mode 100644 index 0000000..5de68db --- /dev/null +++ b/docs/ccxt/wiki/examples/js/binance-universal-transfer.md @@ -0,0 +1,22 @@ +- [Binance Universal Transfer](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +(async () => { + + // apiKey must have universal transfer permissions + const binance = new ccxt.binance ({ + "apiKey": "", + "secret": "", + }) + + console.log (await binance.transfer ('USDT', 1, 'spot', 'future')) + const transfers = await binance.fetchTransfers (); + console.log ('got ', transfers.length, ' transfers') + console.log (await binance.transfer ('USDT', 1, 'spot', 'cross')) // For transfer to cross margin wallet + console.log (await binance.transfer ('USDT', 1, 'spot', 'ADA/USDT')) // For transfer to an isolated margin wallet +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bitfinex-fetch-trades.md b/docs/ccxt/wiki/examples/js/bitfinex-fetch-trades.md new file mode 100644 index 0000000..d93993c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bitfinex-fetch-trades.md @@ -0,0 +1,40 @@ +- [Bitfinex Fetch Trades](./examples/js/) + + + ```javascript + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import asTable from 'as-table'; + +// ---------------------------------------------------------------------------- + +const // ---------------------------------------------------------------------------- +table = asTable.configure ({ delimiter: ' | ' });(async () => { + + const exchange = new ccxt.bitfinex ({ + 'verbose': process.argv.includes ('--verbose'), + 'timeout': 60000, + }) + + try { + + const response = await exchange.fetchTrades ('ETH/BTC', 1518983548636 - 2 * 24 * 60 * 60 * 1000) + log (table (response)) + log (response.length.toString (), 'trades') + log.green ('Succeeded.') + + } catch (e) { + + log.dim ('--------------------------------------------------------') + log (e.constructor.name, e.message) + log.dim ('--------------------------------------------------------') + log.dim (exchange.last_http_response) + log.error ('Failed.') + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bitfinex2-fetch-trades.md b/docs/ccxt/wiki/examples/js/bitfinex2-fetch-trades.md new file mode 100644 index 0000000..18b979b --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bitfinex2-fetch-trades.md @@ -0,0 +1,40 @@ +- [Bitfinex2 Fetch Trades](./examples/js/) + + + ```javascript + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; + +// ---------------------------------------------------------------------------- + +const // ---------------------------------------------------------------------------- +table = asTable.configure ({ delimiter: ' | ' });(async () => { + + const exchange = new ccxt.bitfinex2 ({ + 'verbose': process.argv.includes ('--verbose'), + 'timeout': 60000, + }) + + try { + + const response = await exchange.fetchTrades ('ETH/BTC', 1518983548636 - 2 * 24 * 60 * 60 * 1000) + log (table (response)) + log (response.length.toString (), 'trades') + log.green ('Succeeded.') + + } catch (e) { + + log.dim ('--------------------------------------------------------') + log (e.constructor.name, e.message) + log.dim ('--------------------------------------------------------') + log.dim (exchange.last_http_response) + log.error ('Failed.') + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bitmex-browser-cors-proxy.md b/docs/ccxt/wiki/examples/js/bitmex-browser-cors-proxy.md new file mode 100644 index 0000000..6c4210e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bitmex-browser-cors-proxy.md @@ -0,0 +1,13 @@ +- [Bitmex Browser Cors Proxy](./examples/js/) + + + ```javascript + // JavaScript CORS Proxy +// Save this in a file like cors.js and run with `node cors [port]` +// It will listen for your requests on the port you pass in command line or port 8080 by default +let port = (process.argv.length > 2) ? parseInt (process.argv[2]) : 8080 // default +require ('cors-anywhere').createServer ({ + setHeaders: { 'origin': 'https://www.bitmex.com' } +}).listen (port, '0.0.0.0') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bitpanda-fetchMyTrades-reduce.md b/docs/ccxt/wiki/examples/js/bitpanda-fetchMyTrades-reduce.md new file mode 100644 index 0000000..d7eff06 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bitpanda-fetchMyTrades-reduce.md @@ -0,0 +1,41 @@ +- [Bitpanda Fetchmytrades Reduce](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +const bitpanda = new ccxt.bitpanda ({ + "apiKey": "INSERTYOURAPIKEY" +}) + + +// output +` +fetching USDT/EUR trades on bitpanda +--------------------------------------------- +maker volume 6621.81 USDT maker fee 5.62 USDT +taker volume 2544.82 USDT taker fee 3.27 USDT + +sold 9166.63 USDT for 7802.38 EUR +bought 0.00 USDT for 0.00 EUR +` + +;(async () => { + const market = { + symbol: 'USDT/EUR', + base: 'USDT', + quote: 'EUR', + } + console.log ('fetching', market.symbol, 'trades on bitpanda') + console.log ('---------------------------------------------') + const trades = await bitpanda.fetchMyTrades ('USDT/EUR') + const makers = trades.filter (x => x.takerOrMaker === 'maker') + const takers = trades.filter (x => x.takerOrMaker === 'taker') + console.log ('maker volume', makers.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'maker fee', makers.reduce ((a, b) => a + b.fee['cost'], 0).toFixed (2), market.base) + console.log ('taker volume', takers.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'taker fee', takers.reduce ((a, b) => a + b.fee['cost'], 0).toFixed (2), market.base) + const sells = trades.filter (x => x.side === 'sell') + const buys = trades.filter (x => x.side === 'buy') + console.log ('\nsold', sells.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'for', sells.reduce ((a, b) => a + b.cost, 0).toFixed (2), market.quote) + console.log ('bought', buys.reduce ((a, b) => a + b.amount, 0).toFixed (2), market.base, 'for', buys.reduce ((a, b) => a + b.cost, 0).toFixed (2), market.quote) +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bitrue-fetch-balance.md b/docs/ccxt/wiki/examples/js/bitrue-fetch-balance.md new file mode 100644 index 0000000..0cdce15 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bitrue-fetch-balance.md @@ -0,0 +1,34 @@ +- [Bitrue Fetch Balance](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +async function main () { + + console.log ('CCXT Version:', ccxt.version) + + const exchange = new ccxt.bitrue ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }) + + await exchange.loadMarkets () + + exchange.verbose = true + + try { + + const balance = await exchange.fetchBalance () + console.log (balance) + + } catch (e) { + console.log (e.constructor.name, e.message); + } +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bitstamp-private-api.md b/docs/ccxt/wiki/examples/js/bitstamp-private-api.md new file mode 100644 index 0000000..72f9390 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bitstamp-private-api.md @@ -0,0 +1,120 @@ +- [Bitstamp Private Api](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure({ locate: false }) + +ansicolor.nice + + ;(async () => { + let apiUrl = 'https://www.bitstamp.net/api'; + + // instantiate the exchange + let exchange = new ccxt.bitstamp({ + 'apiKey': 'APIKEY', + 'secret': 'APISECRET', + 'uid': 'ACCOUNTID', + 'urls': { + 'api': { + 'public': apiUrl, + 'private': apiUrl, + 'v1': apiUrl + } + } + }) + + try { + // fetch account balance from the exchange + let balance = await exchange.fetchBalance() + log('balance'.green, balance.total) + + // fetch fees + let singleFee = await exchange.fetchTradingFee('BTC/USD') + log('fee'.green, 'BTC/USD', singleFee) + let tradingFees = await exchange.fetchTradingFees() + log('tradingFees'.green, tradingFees) + let fundingFees = await exchange.fetchFundingFees() + log('fundingFees'.green, fundingFees) + let fees = await exchange.fetchFees() + log('fees'.green, fees) + + // my trades + let myTrades = await exchange.fetchMyTrades('BTC/USD', undefined, 5) + log('myTrades'.green, asTable(myTrades)) + + // user transactions + let transactions = await exchange.fetchTransactions() + log('Transactions'.green, asTable(transactions)) + + // ledger + let ledger = await exchange.fetchLedger() + log('Ledger'.green, asTable(ledger)) + + // deposits + let deposits = await exchange.fetchDeposits() + log('Deposits'.green, asTable(deposits)) + + // create new limit order + let newOrder = await exchange.createOrder('BTC/USD', 'limit', 'buy', 0.01, 8000) + console.log('New limit order'.green, newOrder); + + // open orders + let openOrders = await exchange.fetchOpenOrders() + log('Open orders'.green, asTable(openOrders)) + + // order data + let orderData = await exchange.fetchOrder(newOrder.id) + console.log('Order data'.green, orderData); + + // cancel order + let canceledOrder = await exchange.cancelOrder(newOrder.id) + console.log('Canceled order'.green, canceledOrder); + + // create market order + let marketOrder = await exchange.createOrder('BTC/USD', 'market', 'buy', 0.01) + console.log('New market order'.green, marketOrder); + + // open orders + let secondOpenOrders = await exchange.fetchOpenOrders() + log('Open orders'.green, asTable(secondOpenOrders)) + + // deposit address + let paxDeposit = await exchange.fetchDepositAddress("XLM") + log('Pax deposit address'.green, paxDeposit) + + // withdrawal + let ethWithdraw = await exchange.withdraw("ETH", 0.01, "0x6c28cb9dd2f4e3bb6f56c822bc306f3b8a3e7c08") + log('ETH withdrawal'.green, ethWithdraw) + + // withdrawals + let withdrawals = await exchange.fetchWithdrawals() + log('Withdrawals'.green, asTable(withdrawals)) + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection || e.message.includes('ECONNRESET')) { + log.bright.yellow('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow('[Network Error] ' + e.message) + } else { + throw e; + } + } + + })() +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bitstamp-public-api.md b/docs/ccxt/wiki/examples/js/bitstamp-public-api.md new file mode 100644 index 0000000..06d9fb7 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bitstamp-public-api.md @@ -0,0 +1,44 @@ +- [Bitstamp Public Api](./examples/js/) + + + ```javascript + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import asTable from 'as-table'; + + +const table = asTable.configure ({ delimiter: ' | ' }), id = 'bitstamp', exchange = new ccxt[id] ({ enableRateLimit: true }), symbol = 'BTC/USD';(async function main () { + + // Markets data + const markets = await exchange.fetchMarkets () + console.log('Total number of markets: ', Object.keys(markets).length); + + // Currencies + const currencies = await exchange.fetchCurrencies () + console.log('Currencies: ', JSON.stringify(currencies)); + + // Order book data + const orderbook = await exchange.fetchOrderBook (symbol) + console.log ('Order book ', symbol, orderbook.asks[0], orderbook.bids[0]) + + // Ticker + const ticker = await exchange.fetchTicker (symbol) + console.log ('Ticker ', symbol, " bid ", ticker.bid, " ask ", ticker.ask) + + // Trades + const response = await exchange.fetchTrades (symbol, null, 10) + log (table (response)) + + // OHLC data + const candles = await exchange.fetchOHLCV (symbol, '1m', undefined, 10); + const first = candles[0] + const last = candles[candles.length - 1] + console.log ( + 'Fetched', candles.length, symbol, 'candles', + 'from', exchange.iso8601 (first[0]), + 'to', exchange.iso8601 (last[0]) + ) + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bittrex-balance.md b/docs/ccxt/wiki/examples/js/bittrex-balance.md new file mode 100644 index 0000000..d82148d --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bittrex-balance.md @@ -0,0 +1,55 @@ +- [Bittrex Balance](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog' + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)) + +;(async () => { + + // instantiate the exchange + let exchange = new ccxt.bittrex ({ + "apiKey": "471b47a06c384e81b24072e9a8739064", + "secret": "694025686e9445589787e8ca212b4cff", + }) + + + try { + + // fetch account balance from the exchange + let balance = await exchange.fetchBalance () + + // output the result + log (exchange.name.green, 'balance', balance) + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + log.bright.yellow ('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow ('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow ('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow ('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow ('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow ('[Network Error] ' + e.message) + } else { + throw e; + } + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bittrex-fetch-closed-orders-history.md b/docs/ccxt/wiki/examples/js/bittrex-fetch-closed-orders-history.md new file mode 100644 index 0000000..e562e7b --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bittrex-fetch-closed-orders-history.md @@ -0,0 +1,75 @@ +- [Bittrex Fetch Closed Orders History](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; +import asTable from 'as-table'; + + +const { noLocate } = ololog; +const log = noLocate; + +const exchange = new ccxt.bittrex ({ + 'enableRateLimit': true, + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + });(async () => { + + await exchange.loadMarkets () + + const symbol = 'ETH/BTC' + , market = exchange.markets[symbol] + , startingDate = '2017-01-01T00:00:00' + , now = exchange.milliseconds () + + log.bright.green ('\nFetching history for:', symbol, '\n') + + let allOrders = [] + let since = exchange.parse8601 (startingDate) + + while (since < now) { + + try { + + log.bright.blue ('Fetching history for', symbol, 'since', exchange.iso8601 (since)) + const orders = await exchange.fetchClosedOrders (symbol, since) + log.green.dim ('Fetched', orders.length, 'orders') + + allOrders = allOrders.concat (orders) + + if (orders.length) { + + const lastOrder = orders[orders.length - 1] + since = lastOrder['timestamp'] + 1 + + } else { + + break // no more orders left for this symbol, move to next one + } + + } catch (e) { + + log.red.unlimited (e) + + } + } + + // omit the following keys for a compact table output + // otherwise it won't fit into the screen width + const omittedKeys = [ + 'info', + 'timestamp', + 'lastTradeTimestamp', + 'fee', + ] + + log.yellow (asTable (allOrders.map (order => exchange.omit (order, omittedKeys)))) + log.green ('Fetched', allOrders.length, symbol, 'orders in total') + + // do whatever you want to do with them, calculate profit loss, etc... + +}) () + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/blockchaincom-withdrawal.md b/docs/ccxt/wiki/examples/js/blockchaincom-withdrawal.md new file mode 100644 index 0000000..d0703b1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/blockchaincom-withdrawal.md @@ -0,0 +1,65 @@ +- [Blockchaincom Withdrawal](./examples/js/) + + + ```javascript + "use strict"; + +const ccxt = require('../../ccxt.js') +const asTable = require('as-table') +const log = require('ololog').configure({ locate: false }) + + +const exchange = new ccxt.blockchaincom({ + 'secret': 'YOUR_API_SECRET', +}) + +// blockchaincom specific internal beneficiary id +const address = 'BENEFICIARY_ID'; + + +(async () => { + + const markets = await exchange.loadMarkets () + + try { + const code = 'USDT' + const amount = 5 + + // fetch withdrawal beneficiary ids + const whiteList = await exchange.privateGetWhitelistCurrency({'currency': code}) + log('Withdrawl Whitelist', whiteList) + // + // [ + // { + // "whitelistId":"adcd73fb-9ba6-41o7-8c0d-7013482cb88f", // unique id for each beneficiary, to be passed in as address into withdraw () + // "name":"John Doe", + // "currency":"USDT" + // } + // ] + // + + // withdrawal + let withdrawal = await exchange.withdraw(code, amount, address, undefined); + log('Withdrawal', withdrawal) + + } catch (e) { + if (e instanceof ccxt.DDoSProtection || e.message.includes('ECONNRESET')) { + log('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log('[Network Error] ' + e.message) + } else { + throw e; + } + } + +})() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/build-ohlcv-bars.md b/docs/ccxt/wiki/examples/js/build-ohlcv-bars.md new file mode 100644 index 0000000..38e728e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/build-ohlcv-bars.md @@ -0,0 +1,54 @@ +- [Build Ohlcv Bars](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// Bulding OHLCV array from trades (executions) data is a bit tricky. For example, if you want to build 100 ohlcv bars of 1-minute timeframe, then you have to fetch the 100 minutes of trading data. So, higher timeframe bars require more trading data (i.e. building 100 bars of 1-day timeframe OHLCV would require massive amount of trading data, which might not be desirable for user, because of data-usage rate limits) +async function example_with_fetch_trades() { + const exch = new ccxt.binance({}); + const timeframe = '1m'; + const symbol = 'OGN/USDT'; + const since = exch.milliseconds() - 1000 * 60 * 30; // last 30 mins + const limit = 1000; + const trades = await exch.fetchTrades(symbol, since, limit); + const generatedBars = exch.buildOHLCVC(trades, timeframe, since, limit); + // you can ignore 6th index ("count" field) from ohlcv entries, which is not part of OHLCV standard structure and is just added internally by `buildOHLCVC` method + console.log('[REST] Constructed', generatedBars.length, 'bars from trades: ', generatedBars); +} +async function example_with_watch_trades() { + const exch = new ccxt.pro.binance({}); + const timeframe = '1m'; + const symbol = 'DOGE/USDT'; + const limit = 1000; + const since = exch.milliseconds() - 10 * 60 * 1000 * 1000; // last 10 hrs + let collectedTrades = []; + const collectedBars = []; + while (true) { + const wsTrades = await exch.watchTrades(symbol, since, limit, {}); + collectedTrades = collectedTrades.concat(wsTrades); + const generatedBars = exch.buildOHLCVC(collectedTrades, timeframe, since, limit); + // Note: first bar would be partially constructed bar and its 'open' & 'high' & 'low' prices (except 'close' price) would probably have different values compared to real bar on chart, because the first obtained trade timestamp might be somewhere in the middle of timeframe period, so the pre-period would be missing because we would not have trades data. To fix that, you can get older data with `fetchTrades` to fill up bars till start bar. + for (let i = 0; i < generatedBars.length; i++) { + const bar = generatedBars[i]; + const barTimestamp = bar[0]; + const collectedBarsLength = collectedBars.length; + const lastCollectedBarTimestamp = collectedBarsLength > 0 ? collectedBars[collectedBarsLength - 1][0] : 0; + if (barTimestamp === lastCollectedBarTimestamp) { + // if timestamps are same, just updarte the last bar + collectedBars[collectedBarsLength - 1] = bar; + } + else if (barTimestamp > lastCollectedBarTimestamp) { + collectedBars.push(bar); + // remove the trades from saved array, which were till last collected bar's open timestamp + collectedTrades = exch.filterBySinceLimit(collectedTrades, barTimestamp); + } + } + // Note: first bar would carry incomplete values, please read comment in "buildOHLCVCFromWatchTrades" method definition for further explanation + console.log('[WS] Constructed', collectedBars.length, 'bars from', symbol, 'trades: ', collectedBars); + } +} +await example_with_fetch_trades(); +await example_with_watch_trades(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/builtin-rate-limiting-rest-poller.md b/docs/ccxt/wiki/examples/js/builtin-rate-limiting-rest-poller.md new file mode 100644 index 0000000..3d0c596 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/builtin-rate-limiting-rest-poller.md @@ -0,0 +1,30 @@ +- [Builtin Rate Limiting Rest Poller](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import { nice as ansi } from 'ansicolor'; +import asTable from 'as-table'; + +const exchange = new ccxt.coinbasepro () +const repeat = 100 + +async function test (symbol) { + + for (let i = 0; i < repeat; i++) { + let ticker = await exchange.fetchTicker (symbol) + log (exchange.id.green, exchange.iso8601 (exchange.milliseconds ()), ticker['datetime'], symbol.green, ticker['last']) + } +} + +const concurrent = [ + test ('BTC/USD'), + test ('ETH/BTC'), + test ('ETH/USD') +] + +Promise.all (concurrent) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bybit-trailing.md b/docs/ccxt/wiki/examples/js/bybit-trailing.md new file mode 100644 index 0000000..3553810 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bybit-trailing.md @@ -0,0 +1,67 @@ +- [Bybit Trailing](./examples/js/) + + + ```javascript + 'use strict'; + +const ccxt = require ('../../ccxt'); + +console.log ('CCXT Version:', ccxt.version) + +const exchange = new ccxt.bybit({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_KEY', +}) + +// exchange.set_sandbox_mode(true) // enable sandbox mode + +// Example 1 :: Swap : open position and set trailing stop and close it +async function example1 () { + exchange['options']['defaultType'] = 'swap'; // very important set swap as default type + await exchange.loadMarkets (); + + const symbol = 'LTC/USDT:USDT'; + const market = exchange.market(symbol); + + // fetch swap balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create order and open position + const type = 'market'; + const side = 'buy'; + const amount = 0.1 + const price = undefined; + const createOrder = await exchange.createOrder (symbol, type, side, amount, price); + console.log ('Created order id:', createOrder['id']) + + // set trailing stop + const rawSide = 'Buy'; // or 'Sell' + const trailing_stop = 30; // YOUR TRAILING STOP HERE + const trailingParams = { + 'symbol': market['id'], + 'side': rawSide, + 'trailing_stop': trailing_stop + } + const trailing_response = await exchange.privatePostPrivateLinearPositionTradingStop (trailingParams); + console.log(trailing_response) + + // check opened position + const symbols = [ symbol ]; + const positions = await exchange.fetchPositions (symbols); + console.log (positions) + + // Close position by issuing a order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, type, side, amount, price, params); + console.log (closePositionOrder); +} + +async function main () { + await example1 (); +} + +main (); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/bybit-updated.md b/docs/ccxt/wiki/examples/js/bybit-updated.md new file mode 100644 index 0000000..0223e8e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/bybit-updated.md @@ -0,0 +1,159 @@ +- [Bybit Updated](./examples/js/) + + + ```javascript + 'use strict'; + +const ccxt = require ('../../dist/cjs/ccxt.js'); + +console.log ('CCXT Version:', ccxt.version) + +const exchange = new ccxt.bybit ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +// Example 1: Spot : fetch balance, create order, cancel it and check canceled orders +async function example1 () { + exchange['options']['defaultType'] = 'spot'; // very important set spot as default type + + await exchange.loadMarkets (); + + // fetch spot balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create order + const symbol = 'LTC/USDT'; + const createOrder = await exchange.createOrder (symbol, 'limit', 'buy', 50, 0.1); + console.log ('Created order id:', createOrder['id']) + + // cancel order + const cancelOrder = await exchange.cancelOrder (createOrder['id'], symbol); + + // Check canceled orders (bybit does not have a single endpoint to check orders + // we have to choose whether to check open or closed orders and call fetchOpenOrders + // or fetchClosedOrders respectively + const canceledOrders = await exchange.fetchClosedOrders (symbol); + console.log (canceledOrders); +} + +// ----------------------------------------------------------------------------------------- + +// Example 2 :: Swap : fetch balance, open a position and close it +async function example2 () { + exchange['options']['defaultType'] = 'swap'; // very important set swap as default type + await exchange.loadMarkets (); + + // fetch swap balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create order and open position + const symbol = 'LTC/USDT:USDT'; + const createOrder = await exchange.createOrder (symbol, 'market', 'buy', 0.1); + console.log ('Created order id:', createOrder['id']) + + // check opened position + const symbols = [ symbol ]; + const positions = await exchange.fetchPositions (symbols); + console.log (positions) + + // Close position by issuing a order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, 'market', 'sell', 0.1, undefined, params); + console.log (closePositionOrder); +} + +// ----------------------------------------------------------------------------------------- + +// Example 3 :: USDC Swap : fetch balance, open a position and close it +async function example3 () { + exchange['options']['defaultType'] = 'swap'; // very important set swap as default type + await exchange.loadMarkets (); + + // fetch USDC swap balance + // when no symbol is available we can show our intent + // of using USDC endpoints by either using defaultSettle in options or + // settle in params + // Using Options: exchange['options']['defaultSettle'] = 'USDC'; + // Using params: + const balanceParams = { + 'settle': 'USDC' + } + const balance = await exchange.fetchBalance (balanceParams); + console.log (balance) + + // create order and open position + // taking into consideration that USDC markets do not support + // market orders + const symbol = 'BTC/USD:USDC'; + const amount = 0.1; + const price = 29940 // adjust this accordingly + const createOrder = await exchange.createOrder (symbol, 'limit', 'buy', amount, price); + console.log ('Created order id:', createOrder['id']) + + // check if the order was filled and the position opened + const symbols = [ symbol ]; + const positions = await exchange.fetchPositions (symbols); + console.log (positions) + + // close position (assuming it was already opened) by issuing an order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, 'limit', 'sell', amount, price, params); + console.log (closePositionOrder); +} + +// ----------------------------------------------------------------------------------------- + +// Example 4 :: Future : fetch balance, create stop-order and check open stop-orders +async function example4 () { + exchange['options']['defaultType'] = 'future'; // very important set future as default type + await exchange.loadMarkets (); + + // fetch future balance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // create stop-order + const symbol = 'ETH/USD:ETH-220930'; + const amount = 10; // in USD for inverse futures + const price = 1200; + const side = 'buy'; + const type = 'limit'; + const stopOrderParams = { + 'position_idx': 0, // 0 One-Way Mode, 1 Buy-side, 2 Sell-side, default = 0 + 'stopPrice': 1000, // mandatory for stop orders + 'basePrice': 1100 // mandatory for stop orders + } + const stopOrder = await exchange.createOrder (symbol, type, side, amount, price, stopOrderParams); + console.log ('Created order id:', stopOrder['id']) + + // check opened stop-order + const openOrderParams = { + 'stop': true + } + const openOrders = await exchange.fetchOpenOrders (symbol, undefined, undefined, openOrderParams); + console.log (openOrders) + + // Cancell open stop-order + const cancelOrder = await exchange.cancelOrder (stopOrder['id'], symbol, openOrderParams); + console.log (cancelOrder); +} + +// ----------------------------------------------------------------------------------------- + +async function main () { + await example1 (); + await example2 (); + await example3 (); + await example4 (); + +} + +main (); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/coinbase-fetch-all-balances.md b/docs/ccxt/wiki/examples/js/coinbase-fetch-all-balances.md new file mode 100644 index 0000000..25be05a --- /dev/null +++ b/docs/ccxt/wiki/examples/js/coinbase-fetch-all-balances.md @@ -0,0 +1,44 @@ +- [Coinbase Fetch All Balances](./examples/js/) + + + ```javascript + "use strict"; + +const ccxt = require ('../../js/ccxt.js') + +console.log ('CCXT Version:', ccxt.version) + +async function fetchAllBalances (exchange) { + const params = {} + let balance = {} + while (true) { + const response = await exchange.fetchBalance (params) + balance = exchange.extend (balance, response) + const info = exchange.safeValue (response, 'info', {}) + const pagination = exchange.safeValue (info, 'pagination', {}) + const startingAfter = exchange.safeString (pagination, 'next_starting_after') + if (startingAfter !== undefined) { + params['starting_after'] = startingAfter + } else { + break + } + } + return balance +} + +async function main () { + const exchange = new ccxt.coinbase ({ + // Value is the "name" field in the api_key.json file Coinbase will offer for download + apiKey: 'organizations/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/apiKeys/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + // This is the "privateKey" field in that JSON file + secret: '-----BEGIN EC PRIVATE KEY-----\nxxx...xxx==\n-----END EC PRIVATE KEY-----', + }) + const markets = await exchange.loadMarkets () + // coinbase.verbose = true // uncomment for debugging purposes if necessary + const balance = await fetchAllBalances (exchange) + console.log (balance) +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.md b/docs/ccxt/wiki/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.md new file mode 100644 index 0000000..585ac98 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.md @@ -0,0 +1,53 @@ +- [Coinex Fetch All Deposit Addresses Using Fetchdepositaddress](./examples/js/) + + + ```javascript + "use strict"; + +const ccxt = require ('../../ccxt') + +console.log ('CCXT Version:', ccxt.version) + +// https://github.com/ccxt/ccxt/issues/15405 + +async function main () { + + const exchange = new ccxt.coinex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + + // exchange.verbose = true // uncomment for debugging purposes + + await exchange.loadMarkets (); + const addresses = {}; + const promises = []; + + async function fetchDepositAddress (currency, network) { + try { + const response = await exchange.fetchDepositAddress(currency, { 'network': network }); + addresses[currency][network] = response['address'] + } + catch (err) { + console.error(err) + } + } + + const currencies = Object.keys (exchange.currencies); + + for (const currency of currencies) { + const networks = Object.keys (exchange.currencies[currency]['networks']); + for (const network of networks) { + addresses[currency] = {}; + promises.push (fetchDepositAddress (currency, network)); + } + } + + await Promise.all (promises); + + console.log (addresses) +}; + +main (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/coinex-futures.md b/docs/ccxt/wiki/examples/js/coinex-futures.md new file mode 100644 index 0000000..11427f1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/coinex-futures.md @@ -0,0 +1,80 @@ +- [Coinex Futures](./examples/js/) + + + ```javascript + 'use strict'; + +const ccxt = require ('../../ccxt'); + +console.log ('CCXT Version:', ccxt.version) + +let exchange = new ccxt.coinex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +// Example 1 :: Swap : fetch balance, create a limit swap order with leverage +async function example1 () { + exchange['options']['defaultType'] = 'swap'; + exchange.options['defaultMarginMode'] = 'cross' // or isolated + await exchange.loadMarkets (); + + const symbol = 'ADA/USDT:USDT'; + + // fetchBalance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // set the desired leverage (has to be made before placing the order and for a specific symbol) + const leverage = 8; + const leverage_response = await exchange.setLeverage(leverage, symbol) + + // create limit order + const amount = 50; + const price = 0.3 // adjust this accordingly + const createOrder = await exchange.createOrder (symbol, 'limit', 'buy', amount, price); + console.log ('Created order id:', createOrder['id']) +} + +// Example 2 :: Swap :: open a position and close it +async function example2 () { + exchange['options']['defaultType'] = 'swap'; + exchange.options['defaultMarginMode'] = 'cross' // or isolated + await exchange.loadMarkets (); + + const symbol = 'ADA/USDT:USDT'; + + // fetchBalance + const balance = await exchange.fetchBalance (); + console.log (balance) + + // set the desired leverage (has to be made before placing the order and for a specific symbol) + const leverage = 8; + const leverage_response = await exchange.setLeverage(leverage, symbol) + + // create market order and open position + const amount = 50; + const createOrder = await exchange.createOrder (symbol, 'market', 'buy', amount); + console.log ('Created order id:', createOrder['id']) + + // check if the order was filled and the position opened + const position = await exchange.fetchPositions (symbol); + console.log (position) + + // close position (assuming it was already opened) by issuing an order in the opposite direction + const params = { + 'reduce_only': true + } + const closePositionOrder = await exchange.createOrder (symbol, 'market', 'sell', amount, undefined, params); + console.log (closePositionOrder); +} + +// ----------------------------------------------------------------------------------------- + +async function main () { + await example1 (); + await example2 (); +} + +main (); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/coinone-fetch-tickers.md b/docs/ccxt/wiki/examples/js/coinone-fetch-tickers.md new file mode 100644 index 0000000..7ab874a --- /dev/null +++ b/docs/ccxt/wiki/examples/js/coinone-fetch-tickers.md @@ -0,0 +1,60 @@ +- [Coinone Fetch Tickers](./examples/js/) + + + ```javascript + + +import { nice as ansi } from 'ansicolor'; +import ololog from 'ololog'; +import asTable from 'as-table'; + +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +const table = asTable.configure ({ + delimiter: ' | '.dim, + right: true, + }); + +const exchange = new ccxt.coinone ({ + 'verbose': process.argv.includes ('--verbose'), +}) + +let printTickersAsTable = function (exchange, tickers) { + log (exchange.id.green, exchange.iso8601 (exchange.milliseconds ())) + log ('Fetched', Object.values (tickers).length.toString ().green, 'tickers:') + log (table (ccxt.sortBy (Object.values (tickers), 'symbol', false))) +} + +async function fetchAllAndPrint () { + const tickers = await exchange.fetchTickers () + log ('---------------------------------------- fetchTickers ----------------------------------------') + printTickersAsTable (exchange, tickers) +} + +async function fetchOneByOneAndPrint () { + const markets = await exchange.loadMarkets () + const symbols = Object.keys (markets) + const tickers = [] + + log ('---------------------------------------- fetchTicker (one by one) ----------------------------------------') + + for (let i = 0; i < symbols.length; i++) { + const ticker = await exchange.fetchTicker (symbols[i]) + tickers.push (ticker) + log (`${i+1} / ${symbols.length}`) + log ('\u001b[1A'.repeat (2)) // cursor up + } + + printTickersAsTable (exchange, tickers) +} + +(async () => { + await fetchAllAndPrint () + log ('\n') + await fetchOneByOneAndPrint () +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/coinone-markets.md b/docs/ccxt/wiki/examples/js/coinone-markets.md new file mode 100644 index 0000000..ce8767e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/coinone-markets.md @@ -0,0 +1,22 @@ +- [Coinone Markets](./examples/js/) + + + ```javascript + + +import log from 'ololog'; +import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.coinone ({ + 'verbose': process.argv.includes ('--verbose'), +}) + +;(async function main () { + + const markets = await exchange.loadMarkets () + log (markets) + log ('\n' + exchange['name'] + ' supports ' + Object.keys (markets).length + ' pairs') + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/compare-two-exchanges-capabilities.md b/docs/ccxt/wiki/examples/js/compare-two-exchanges-capabilities.md new file mode 100644 index 0000000..e03e619 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/compare-two-exchanges-capabilities.md @@ -0,0 +1,42 @@ +- [Compare Two Exchanges Capabilities](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const prefix = '-'; + const exchange_1 = new ccxt.okx(); + const exchange_2 = new ccxt.htx(); + const keys_1 = Object.keys(exchange_1.has); + const keys_2 = Object.keys(exchange_2.has); + // check missing from exchange-1 + console.log('### checking missing functionalities from exchange-1:', exchange_1.id); + for (let i = 0; i < keys_2.length; i++) { + const key = keys_2[i]; + if (exchange_2.has[key]) { + if (!keys_1.includes(key)) { + console.log(prefix, key, 'does not exist in', exchange_1.id, 'as opposed to', exchange_2.id); + } + else if (exchange_2.has[key] !== exchange_1.has[key]) { + console.log(prefix, key, '> ', exchange_1.id, ':', exchange_1.has[key], ',', exchange_2.id, ':', exchange_2.has[key]); + } + } + } + // check missing from exchange-2 + console.log('### checking missing functionalities from exchange-2:', exchange_2.id); + for (let i = 0; i < keys_1.length; i++) { + const key = keys_1[i]; + if (exchange_1.has[key]) { + if (!keys_2.includes(key)) { + console.log(prefix, key, 'does not exist in', exchange_2.id, 'as opposed to', exchange_1.id); + } + else if (exchange_1.has[key] !== exchange_2.has[key]) { + console.log(prefix, key, '> ', exchange_2.id, ':', exchange_2.has[key], ',', exchange_1.id, ':', exchange_1.has[key]); + } + } + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/cors-proxy.md b/docs/ccxt/wiki/examples/js/cors-proxy.md new file mode 100644 index 0000000..5c8fe9c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/cors-proxy.md @@ -0,0 +1,11 @@ +- [Cors Proxy](./examples/js/) + + + ```javascript + // JavaScript CORS Proxy +// Save this in a file like cors.js and run with `node cors [port]` +// It will listen for your requests on the port you pass in command line or port 8080 by default +let port = (process.argv.length > 2) ? parseInt (process.argv[2]) : 8080 // default +require ('cors-anywhere').createServer ().listen (port, '0.0.0.0') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/create-order-handle-errors.md b/docs/ccxt/wiki/examples/js/create-order-handle-errors.md new file mode 100644 index 0000000..33037fa --- /dev/null +++ b/docs/ccxt/wiki/examples/js/create-order-handle-errors.md @@ -0,0 +1,61 @@ +- [Create Order Handle Errors](./examples/js/) + + + ```javascript + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- + +(async () => { + + const exchange = new ccxt.bittrex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'verbose': false, // set to true to see more debugging output + 'timeout': 60000, + }) + + // try to load markets first, retry on request timeouts until it succeeds: + + while (true) { + + try { + + await exchange.loadMarkets (); + break; + + } catch (e) { + + if (e instanceof ccxt.RequestTimeout) + console.log (exchange.iso8601 (Date.now ()), e.constructor.name, e.message) + } + } + + const symbol = 'ETH/BTC' + const orderType = 'limit' + const side = 'sell' + const amount = 0.321; + const price = 0.123; + + // try just one attempt to create an order + + try { + + const response = await exchange.createOrder (symbol, orderType, side, amount, price); + console.log (response); + console.log ('Succeeded'); + + } catch (e) { + + console.log (exchange.iso8601 (Date.now ()), e.constructor.name, e.message) + console.log ('Failed'); + + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/js/create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..27b0639 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,77 @@ +- [Create Order Position With Takeprofit Stoploss](./examples/js/) + + + ```javascript + // @ts-nocheck +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +console.log('CCXT Version:', ccxt.version); +// ------------------------------------------------------------------------------ +async function example() { + // at this moment, only OKX support embedded stop-loss & take-profit orders in unified manner. other exchanges are being added actively and will be available soon. + const exchange = new ccxt.okx({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + "password": "YOUR_API_PASSWORD", // if exchange does not require password, comment out this line + }); + const symbol = 'DOGE/USDT:USDT'; + const side = 'buy'; // 'buy' | 'sell' + const order_type = 'limit'; // 'market' | 'limit' + const amount = 1; // how many contracts (see `market(symbol).contractSize` to find out coin portion per one contract) + await exchange.loadMarkets(); + const market = exchange.market(symbol); + const ticker = await exchange.fetchTicker(symbol); + const last_price = ticker['last']; + const ask_price = ticker['ask']; + const bid_price = ticker['bid']; + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + if (order_type === 'limit') { + price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + } + // set trigger price for stop-loss/take-profit to 2% from current price + // (note, across different exchanges "trigger" price can be also mentioned with different synonyms, like "activation price", "stop price", "conditional price", etc. ) + const stop_loss_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 0.98 : 1.02); + const take_profit_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 1.02 : 0.98); + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': stop_loss_trigger_price * 0.98, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': take_profit_trigger_price * 0.98, + }, + // note that some exchanges might require some exchange specific parameter when opening a position, i.e.: + // 'posSide': 'long', // for phemex hedge-mode api + }; + const position_amount = market['contractSize'] * amount; + const position_value = position_amount * last_price; + // log + console.log('Going to open a position', 'for', amount, 'contracts worth', position_amount, market['base'], '~', position_value, market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision(symbol, price) : ''), '), using the following params:'); + console.log(params); + console.log('-----------------------------------------------------------------------'); + // exchange.verbose = True // uncomment for debugging purposes if necessary + try { + const created_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + console.log("Created an order", created_order); + // Fetch all your open orders for this symbol + // - use 'fetchOpenOrders' or 'fetchOrders' and filter with 'open' status + // - note, that some exchanges might return one order object with embedded stoploss/takeprofit fields, while other exchanges might have separate stoploss/takeprofit order objects + const all_open_orders = await exchange.fetchOpenOrders(symbol); + console.log("Fetched all your orders for this symbol", all_open_orders); + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } + catch (e) { + console.log(e.toString()); + } +} +await example(); +// NOTES: +// - Sometimes you might experience, when their stop-loss/take-profit order might not become activated, even though on chart the price had crossed that "trigger-price" order was not executed . That happens because some exchange might be using mark-price (instead of last-price) as a reference-price, so that mark-price might reach your trigger-price and it would activate your SL/TP order (even though on your symbol's chart you are viewing the "last-price" by default, which could have different movements than the mark-price). + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/create-order-with-retry.md b/docs/ccxt/wiki/examples/js/create-order-with-retry.md new file mode 100644 index 0000000..72e9575 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/create-order-with-retry.md @@ -0,0 +1,71 @@ +- [Create Order With Retry](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- + +const tryToCreateOrder = async function (exchange, symbol, type, side, amount, price, params) { + + try { + + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + return order + + } catch (e) { + + console.log (e.constructor.name, e.message) + + if (e instanceof ccxt.NetworkError) { + + // retry on networking errors + return false + + } else { + + throw e // break on all other exceptions + } + } +} + +// ---------------------------------------------------------------------------- + +const exchange = new ccxt.bytetrade ({ + 'apiKey': 'classic123', // edit here + 'secret': 'ebcefff7de475ffe15e864ca3e3e410edf7e94fffd1f9af34edf9434e2bfff1b', // edit here +}) + +// +// make a classic bytetrade account - one that is linked to an email or phone number +// then click on your username in the top right and then export +// you will get a file like this: +// +// future garage icon motion panda garage motion task science head garage notable +// ebcefff7de475ffe15e864ca3e3e410edf7e94fffd1f9af34edf9434e2bfff1b +// classic123 +// +// the second line is your secret and the third line is your apiKey +// + +const symbol = 'XRP/USDT' // edit here +const type = 'limit ' // edit here +const side = 'buy' // edit here +const amount = 10 // edit here +const price = 1 // edit here +const params = {} // edit here + +;(async () => { + let order = false + while (true) { + order = await tryToCreateOrder (exchange, symbol, type, side, amount, price, params) + if (order !== false) { + break + } + } + console.log (order) +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/create-order-ws-example.md b/docs/ccxt/wiki/examples/js/create-order-ws-example.md new file mode 100644 index 0000000..d3ab3b5 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/create-order-ws-example.md @@ -0,0 +1,31 @@ +- [Create Order Ws Example](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.pro.binance({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode(true); + exchange.verbose = true; // uncomment for debugging purposes if necessary + // load markets + await exchange.loadMarkets(); + const symbol = 'ETH/USDT'; + const type = 'limit'; + const side = 'buy'; + const amount = 0.01; + let price = 1000; + let orders = []; + for (let i = 1; i < 5; i++) { + const response = await exchange.createOrderWs(symbol, type, side, amount, price); + price += i; + orders.push(response); + } + console.log(orders); +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/create-orders-example.md b/docs/ccxt/wiki/examples/js/create-orders-example.md new file mode 100644 index 0000000..e06e7a8 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/create-orders-example.md @@ -0,0 +1,23 @@ +- [Create Orders Example](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.binance({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode(true); + await exchange.loadMarkets(); + exchange.verbose = true; // uncomment for debugging purposes if necessary + const orders = await exchange.createOrders([ + { 'symbol': 'LTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 10, 'price': 55 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'market', 'side': 'buy', 'amount': 0.5 }, + ]); + console.log(orders); +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/create-trailing-amount-order.md b/docs/ccxt/wiki/examples/js/create-trailing-amount-order.md new file mode 100644 index 0000000..30b8578 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/create-trailing-amount-order.md @@ -0,0 +1,42 @@ +- [Create Trailing Amount Order](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.bingx({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets(); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingAmount = 100; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingAmount': trailingAmount, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log(create_order); + } + catch (e) { + console.log(e.toString()); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/create-trailing-percent-order.md b/docs/ccxt/wiki/examples/js/create-trailing-percent-order.md new file mode 100644 index 0000000..7399e5b --- /dev/null +++ b/docs/ccxt/wiki/examples/js/create-trailing-percent-order.md @@ -0,0 +1,42 @@ +- [Create Trailing Percent Order](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.bingx({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets(); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingPercent = 10; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingPercent': trailingPercent, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingPercentOrder (symbol, order_type, side, amount, price, trailingPercent, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log(create_order); + } + catch (e) { + console.log(e.toString()); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/credentials.md b/docs/ccxt/wiki/examples/js/credentials.md new file mode 100644 index 0000000..f9a20f8 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/credentials.md @@ -0,0 +1,11 @@ +- [Credentials](./examples/js/) + + + ```javascript + { + "hitbtc": { "apiKey": "b6aad581670b30fb25d1c91cdbe8ca5c", "secret": "fa394ced37a488f9b5826a2d9ce39ae3" }, + "bitso": { "apiKey": "xZnHRmdlgJ", "secret": "e156bb7f7ab3a831afbc7a80f7866b9e" }, + "coincheck": { "apiKey": "dCyzY2T6w0DFhaco", "secret": "JpI0eMmxfa0tEpk3X-dNwyclSASJkl-S" } +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/custom-proxy-agent-for-js.md b/docs/ccxt/wiki/examples/js/custom-proxy-agent-for-js.md new file mode 100644 index 0000000..9a27503 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/custom-proxy-agent-for-js.md @@ -0,0 +1,18 @@ +- [Custom Proxy Agent For Js](./examples/js/) + + + ```javascript + // @ts-nocheck +// to set custom "proxy-agent" for ccxt +import ccxt from 'ccxt'; +import HttpProxyAgent from 'http-proxy-agent'; +import HttpsProxyAgent from 'https-proxy-agent'; +const proxy = 'http://1.2.3.4:5678'; +const httpAgent = new HttpProxyAgent(proxy); +const httpsAgent = new HttpsProxyAgent(proxy); +// then pass it through constructor +const kraken = new ccxt.kraken({ agent: httpAgent /* or httpsAgent */ }); +// or set it later +kraken.agent = agent; + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/custom-proxy-url.md b/docs/ccxt/wiki/examples/js/custom-proxy-url.md new file mode 100644 index 0000000..2666b37 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/custom-proxy-url.md @@ -0,0 +1,28 @@ +- [Custom Proxy Url](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +(async function main () { + + const kraken1 = new ccxt.kraken ({ + proxy: function (url) { + return 'https://example.com/?url=' + encodeURIComponent (url) + }, + }) + + console.log (await kraken1.loadMarkets ()) + + const kraken2 = new ccxt.kraken ({ + proxy: function (url) { + return 'https://cors-anywhere.herokuapp.com/' + url + }, + }) + + console.log (await kraken2.loadMarkets ()) + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/delta-maintenance-margin-rate-max-leverage.md b/docs/ccxt/wiki/examples/js/delta-maintenance-margin-rate-max-leverage.md new file mode 100644 index 0000000..2e2d7f2 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/delta-maintenance-margin-rate-max-leverage.md @@ -0,0 +1,66 @@ +- [Delta Maintenance Margin Rate Max Leverage](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version); + +function getMaxLeverage (market, positionSize) { + /** + * @description Equation taken from https://www.delta.exchange/contracts/ + * @param {object} market CCXT market + * @param {float} positionSize The value of the position in quote currency + * @returns The maximum leverage available for the market for the given position size + */ + const info = market['info']; + const maxLeverageNotional = Number (info['max_leverage_notional']); + const initialMarginScalingFactor = Number (info['initial_margin_scaling_factor']); + let initialMargin = Number (info['initial_margin']); + + if (positionSize <= maxLeverageNotional) { + const initialMarginRatio = initialMargin / 100; + return 1 / initialMarginRatio; + } else { + initialMargin = initialMargin + (initialMarginScalingFactor * (positionSize - maxLeverageNotional)); + const initialMarginRatio = initialMargin / 100; + return 1 / initialMarginRatio; + } +} + +function getMaintenanceMarginRate (market, positionSize) { + /** + * @description Equation taken from https://www.delta.exchange/contracts/ + * @param {object} market CCXT market + * @param {float} positionSize The value of the position in quote currency + * @returns The maintenance margin rate as a percentage for the market with the given position size + */ + const info = market['info']; + const maxLeverageNotional = Number (info['max_leverage_notional']); + const maintenanceMarginScalingFactor = Number (info['maintenance_margin_scaling_factor']); + const maintenanceMargin = Number (info['maintenance_margin']); + + if (positionSize <= maxLeverageNotional) { + return maintenanceMargin; + } else { + return maintenanceMargin + (maintenanceMarginScalingFactor * (positionSize - maxLeverageNotional)); + } +} + +async function main () { + + const exchange = new ccxt.delta(); + await exchange.loadMarkets (); + + const symbol = 'ADA/USDT:USDT'; + const market = exchange.market (symbol); + + // Gets the maximum leverage and maintenance margin rate for a position worth 100,000 USDT on the ADA/USDT:USDT market + const maxLeverage = getMaxLeverage(market, 100000); + const maintenanceMarginRate = getMaintenanceMarginRate(market, 100000); + console.log(maxLeverage, maintenanceMarginRate); +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/env-variables.md b/docs/ccxt/wiki/examples/js/env-variables.md new file mode 100644 index 0000000..f178a04 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/env-variables.md @@ -0,0 +1,32 @@ +- [Env Variables](./examples/js/) + + + ```javascript + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' + +// ---------------------------------------------------------------------------- + +const log = ololog.configure.handleNodeErrors (), asTable = require("as-table").configure({ delimiter: " | " }); + +// ---------------------------------------------------------------------------- + +(async () => { + + const exchange = new ccxt.coinbase ({ + verbose: process.argv.includes ('--verbose'), + timeout: 60000, + apiKey: process.env.KEY, + secret: process.env.SECRET + }); + + const balance = await exchange.fetchBalance () + log.green (balance) + +})() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/error-handling.md b/docs/ccxt/wiki/examples/js/error-handling.md new file mode 100644 index 0000000..f764dc1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/error-handling.md @@ -0,0 +1,94 @@ +- [Error Handling](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +const verbose = process.argv.includes ('--verbose'); + +//----------------------------------------------------------------------------- + +const printSupportedExchanges = () => console.log ('Supported exchanges:', ccxt.exchanges.join (', ')) + +const printUsage = () => { + console.log ('Usage: node', process.argv[1], 'id'.green) + printSupportedExchanges () +} + +const run = async (id) => { + + // check if the exchange is supported by ccxt + const exchangeFound = ccxt.exchanges.indexOf (id) > -1 + + if (exchangeFound) { + + console.log ('Instantiating', id, 'exchange') + + // instantiate the exchange by id + const exchange = new ccxt[id] ({ verbose }) + + // try to load markets and catch the errors if any + try { + + await exchange.loadMarkets () + + } catch (e) { + + if (e instanceof ccxt.NetworkError) { + console.log (exchange.id, 'loadMarkets failed due to a network error:', e.message) + } else if (e instanceof ccxt.ExchangeError) { + console.log (exchange.id, 'loadMarkets failed due to exchange error:', e.message) + } else { + console.log (exchange.id, 'loadMarkets failed with:', e.message) + } + + // rethrow the error "higher up" the call chain + throw e + } + + // try to fetch a ticker and catch the errors if any + try { + + const symbol = 'ETH/BTC' + const response = await exchange.fetchTicker (symbol) + console.log (response) + + } catch (e) { + + if (e instanceof ccxt.NetworkError) { + console.log (exchange.id, 'fetchTicker failed due to a network error:', e.message) + } else if (e instanceof ccxt.ExchangeError) { + console.log (exchange.id, 'fetchTicker failed due to exchange error:', e.message) + } else { + console.log (exchange.id, 'fetchTicker failed with:', e.message) + } + + // rethrow the error "higher up" the call chain + throw e + } + + } else { + + console.log ('Exchange', id, 'not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 2) { + + let id = process.argv[2] + await run (id) + + } else { + + printUsage () + } + + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/exchange-capabilities.md b/docs/ccxt/wiki/examples/js/exchange-capabilities.md new file mode 100644 index 0000000..5916e76 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/exchange-capabilities.md @@ -0,0 +1,141 @@ +- [Exchange Capabilities](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import asTable from 'as-table'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice + + + +const csv = process.argv.includes ('--csv'), delimiter = csv ? ',' : '|', asTableConfig = { delimiter: ' ' + delimiter + ' ', /* print: require ('string.ify').noPretty */ } + +asTable.configure (asTableConfig); + +const sortCertified = process.argv.includes ('--sort-certified') || process.argv.includes ('--certified') +const exchangesArgument = process.argv.find (arg => arg.startsWith ('--exchanges=')) +const exchangesArgumentParts = exchangesArgument ? exchangesArgument.split ('=') : [] +const selectedExchanges = (exchangesArgumentParts.length > 1) ? exchangesArgumentParts[1].split (',') : [] + +console.log (ccxt.iso8601 (ccxt.milliseconds ())) +console.log ('CCXT v' + ccxt.version) + +async function main () { + + let total = 0 + let notImplemented = 0 + let inexistentApi = 0 + let implemented = 0 + let emulated = 0 + + const exchangeNames = ccxt.exchanges + let exchanges = exchangeNames.map (id => new ccxt[id] ()) + exchanges = exchanges.map (exchange => exchange.pro ? new ccxt.pro[exchange.id] () : exchange) + if (sortCertified) { + exchanges.sort((a, b) => { + if (a.certified && !b.certified) { + return -1; + } else if (!a.certified && b.certified) { + return 1; + } else { + return 0; + } + }); + } + const metainfo = ccxt.flatten (exchanges.map (exchange => Object.keys (exchange.has))) + const reduced = metainfo.reduce ((previous, current) => { + previous[current] = (previous[current] || 0) + 1 + return previous + }, {}) + const unified = Object.entries (reduced).filter (([ _, count ]) => count > 1) + const methods = unified.map (([ method, _ ]) => method).sort () + if (selectedExchanges.length > 0) { + exchanges = exchanges.filter ((exchange) => selectedExchanges.includes(exchange.id)) + } + const table = asTable (exchanges.map (exchange => { + let result = {}; + const basics = [ + 'CORS', + 'spot', + 'margin', + 'swap', + 'future', + 'option', + ]; + + ccxt.unique (basics.concat (methods)).forEach (key => { + + total += 1 + + let coloredString = ''; + + const feature = exchange.has[key] + const isFunction = (typeof exchange[key] === 'function') + const isBasic = basics.includes (key) + + if (feature === false) { + // if explicitly set to 'false' in exchange.has (to exclude mistake, we check if it's undefined too) + coloredString = exchange.id.red.dim + inexistentApi += 1 + } else if (feature === 'emulated') { + // if explicitly set to 'emulated' in exchange.has + coloredString = exchange.id.yellow + emulated += 1 + } else if (feature) { + if (isBasic) { + // if neither 'false' nor 'emulated', and if method exists + coloredString = exchange.id.green + implemented += 1 + } else { + if (isFunction) { + coloredString = exchange.id.green + implemented += 1 + } else { + // the feature is available in exchange.has and not implemented + // this is an error + coloredString = exchange.id.lightMagenta + } + } + } else { + coloredString = exchange.id.lightRed + notImplemented += 1 + } + + result[key] = coloredString + }) + + return result + })) + + if (csv) { + let lines = table.split ("\n") + lines = lines.slice (0, 1).concat (lines.slice (2)) + log (lines.join ("\n")) + } else { + log (table) + } + + log ('Summary: ', + ccxt.exchanges.length.toString (), 'exchanges; ', + 'Methods [' + total.toString () + ' total]: ', + implemented.toString ().green, 'implemented,', + emulated.toString ().yellow, 'emulated,', + (inexistentApi.toString ().red.dim), 'inexistentApi,', + (notImplemented.toString ().lightRed), 'notImplemented', + ) + + log("\nMessy? Try piping to less (e.g. node script.js | less -S -R --header=3 )\n".red) + +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/exchanges-by-volume.md b/docs/ccxt/wiki/examples/js/exchanges-by-volume.md new file mode 100644 index 0000000..a778281 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/exchanges-by-volume.md @@ -0,0 +1,65 @@ +- [Exchanges By Volume](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +(async () => { + + // const exchanges = [ + // 'bittrex', + // 'poloniex', + // 'bitfinex' + // ] + + const exchanges = ccxt.exchanges + + const symbol = 'BTC/USDT' + const tickers = {} + const volumeField = 'baseVolume' + + console.log ('-----------------------------------------------------------') + + await Promise.all (exchanges.map (exchangeId => + + new Promise (async (resolve, reject) => { + + try { + + const exchange = new ccxt[exchangeId] () + + const ticker = await exchange.fetchTicker (symbol) + + if (ticker[volumeField] !== undefined) { + tickers[exchangeId] = ticker + } + + } catch (e) { + + console.log (exchangeId, e.message.slice (0, 100)) + } + + resolve () + + }) + + )) + + console.log ('-----------------------------------------------------------') + + console.log (Object + .keys (tickers) + .sort ((a, b) => + ((tickers[a][volumeField] > tickers[b][volumeField]) ? 1 : ((tickers[a][volumeField] < tickers[b][volumeField]) ? -1 : 0))) + .reverse () + .map (id => ({ + id, + symbol, + 'volume': tickers[id][volumeField], + })) + ) + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/exchanges.md b/docs/ccxt/wiki/examples/js/exchanges.md new file mode 100644 index 0000000..befd154 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/exchanges.md @@ -0,0 +1,46 @@ +- [Exchanges](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import countries from '../../build/countries.js'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +let exchanges = {} + +ccxt.exchanges.forEach (id => { exchanges[id] = new (ccxt)[id] () }) + +log ('The ccxt library supports', (ccxt.exchanges.length.toString ()).green, 'exchanges:') + +var countryName = function (code) { + return ((countries[code] !== undefined) ? countries[code] : code) +} + +log (asTable.configure ({ delimiter: ' | ' }) (Object.values (exchanges).map (exchange => { + + let countries = Array.isArray (exchange.countries) ? + exchange.countries.map (countryName).join (', ') : + countryName (exchange.countries) + + let website = Array.isArray (exchange.urls.www) ? exchange.urls.www[0] : exchange.urls.www + + return { + id: exchange.id, + name: exchange.name, + url: website, + countries: countries, + } + +}))) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-all-balances.md b/docs/ccxt/wiki/examples/js/fetch-all-balances.md new file mode 100644 index 0000000..91eb27f --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-all-balances.md @@ -0,0 +1,225 @@ +- [Fetch All Balances](./examples/js/) + + + ```javascript + import { PAD_WITH_ZERO } from '../../js/src/base/functions/number.js'; + +//----------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; + +import fs from 'fs'; +import path from 'path'; +import ansicolor from 'ansicolor'; +import asTable from 'as-table'; +import ololog from 'ololog'; + +ansicolor.nice +//----------------------------------------------------------------------------- + +const table = asTable.configure ({ + delimiter: '|'.lightGray.dim, + right: true, + title: x => String (x).lightGray, + print: x => { + if (typeof x === 'object') { + const j = JSON.stringify (x).trim () + if (j.length < 100) return j + } + return String (x) + } + }), + { ROUND, DECIMAL_PLACES, decimalToPrecision, omit, unique, flatten, extend } = ccxt, + log = ololog.handleNodeErrors ().noLocate.unlimited; + +//----------------------------------------------------------------------------- + +// set up keys and settings, if any +const keysGlobal = path.resolve ('keys.json') +const keysLocal = path.resolve ('keys.local.json') + +const keysGlobalExists = fs.existsSync (keysGlobal) +const keysLocalExists = fs.existsSync (keysLocal) + +if (!(keysGlobalExists || keysLocalExists)) { + const lines = [ + 'This script requires a keys.json or a keys.local.json file containing the API keys in JSON format', + '{', + ' "binance": {', + ' "apiKey": "YOUR_API_KEY",', + ' "secret": "YOUR_SECRET"', + ' }', + ' "bitfinex": {', + ' "apiKey": "YOUR_API_KEY",', + ' "secret": "YOUR_SECRET"', + ' }', + '}' + ] + const errorMessage = lines.join ("\n") + log.red.bright (errorMessage) + process.exit () +} + +let globalKeysFile = keysGlobalExists ? keysGlobal : false +let localKeysFile = keysLocalExists ? keysLocal : globalKeysFile +const dynamicLocalKeysFile = JSON.parse (fs.readFileSync (localKeysFile)); +let settings = localKeysFile ? (dynamicLocalKeysFile || {}) : {} + +//----------------------------------------------------------------------------- + +const timeout = 30000 + +const coins = [ + 'BTC', + 'ETH', + 'BNB', + 'EUR', + 'LTC', + 'USD', + 'USDC', + 'USDT', + 'BUSD', + 'XRP', + 'DOGE', + 'YFI', + 'LINK', + 'XLM', + 'ADA', + 'SOL', +] + +function initializeAllExchanges () { + let numErrors = 0 + const ignore = [ + 'bcex', + 'bitsane', + 'chbtc', + 'coinbasepro', + 'jubi', + 'hitbtc', + 'bitstamp1', + 'bitfinex2', + 'upbit', + 'huobipro', + ] + const result = [] + ccxt.exchanges.filter (exchangeId => (!ignore.includes (exchangeId))).forEach (exchangeId => { + try { + const verbose = false + const exchange = new ccxt[exchangeId] ({ + timeout, + verbose, + ... (settings[exchangeId] || {}) + }) + exchange.checkRequiredCredentials () + result.push (exchange) + } catch (e) { + numErrors++ + log.red (exchangeId, 'initialization failed', e.constructor.name, e.message.slice (0, 100)); + } + }) + log ('Initialized', ccxt.exchanges.length - numErrors, 'of', ccxt.exchanges.length, 'exchanges,', + numErrors, 'error' + (((numErrors < 1) || (numErrors > 1)) ? 's' : '') + ',', + ignore.length, 'skipped') + return result +} + +(async () => { + + const exchanges = initializeAllExchanges () + console.log (exchanges.map (exchange => exchange.id)) + let results = [] + const priceOracle = new ccxt.gate () + const tickers = await priceOracle.fetchTickers () + await Promise.all (exchanges.map ((exchange) => (async function () { + + try { + + if (exchange.has['signIn']) { + await exchange.signIn () + } + + const balance = await exchange.fetchTotalBalance () + if (!balance) { + throw new Error (exchange.id + ' erroneous balance') + } + const keys = Object.keys (balance).sort () + const nonzeroBalance = {} + for (let i = 0; i < keys.length; i++) { + const key = keys[i] + if (coins.includes (key)) { + const value = balance[key] + const valueToPrecision = decimalToPrecision (value, ROUND, 8, DECIMAL_PLACES) + if (valueToPrecision !== '0') { + nonzeroBalance[key] = valueToPrecision + } + } + } + const numNonzeroKeys = Object.keys (nonzeroBalance).length + if (numNonzeroKeys < 1) { + log.yellow (exchange.id + ' empty balance') + } else { + log.green (exchange.id, numNonzeroKeys, 'currencies') + results.push ({ exchange: exchange.id, ... nonzeroBalance }) + } + + } catch (e) { + log.red (exchange.id, e.constructor.name, e.message.split ("\n")[0].slice (0, 100)) + } + + }) ())) + + results = ccxt.sortBy (results, 'exchange') + + const currencies = unique (flatten (results.map (result => Object.keys (omit (result, 'exchange'))))) + currencies.sort () + + const total = {} + for (let i = 0; i < currencies.length; i++) { + const currency = currencies[i] + let sum = 0 + results.forEach (result => { + if (currency in result) { + sum += parseFloat (result[currency]) + } + }) + total[currency] = decimalToPrecision (sum, ROUND, 8, DECIMAL_PLACES) + } + + results.push (extend ({ 'exchange': 'total' }, total)) + + results = results.map (result => { + let value = 0; + const convertTo = 'USD' + currencies.forEach (currency => { + if (currency === convertTo) { + if (currency in result) { + value += parseFloat (result[currency]) + } + } else { + const symbol = currency + '/' + convertTo + if (symbol in tickers) { + if (currency in result) { + const ticker = tickers[symbol] + value += parseFloat (result[currency]) * ticker['last'] + } + } + } + }) + return extend ({ + 'exchange': result.exchange, + '$': decimalToPrecision (value, ROUND, 2, DECIMAL_PLACES, PAD_WITH_ZERO), + }, result); + }) + + const tableResults = table (results) + + log (tableResults) + + log.green ('Currencies:', currencies) + + console.log (new Date ()) + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files-2.md b/docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files-2.md new file mode 100644 index 0000000..9ae1f4c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files-2.md @@ -0,0 +1,58 @@ +- [Fetch All Tickers To Files 2](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +import { writeFileSync } from 'fs'; +import path from 'path'; + +const enableRateLimit = true, exchanges = {}, tickers = {}; + + +ccxt.exchanges.forEach (id => { + try { + const exchange = new ccxt[id] () + if (exchange.has['fetchTickers']) { + exchanges[id] = exchange + } + } catch (e) { + console.log ('Failed to initialize', id, e.constructor.name, e.message) + } +}) + +async function main () { + + console.log ('Started') + const start = Date.now () + + try { + const promises = Object.values (exchanges).map (exchange => ( + (async () => { + console.log (exchange.id) + try { + const response = await exchange.fetchTickers () + tickers[exchange.id] = response + } catch (e) { + console.log ('Failed to fetchTickers() from', exchange.id) + } + }) () + )) + await Promise.all (promises) + } catch (e) { + console.log ('Failed awaiting all exchanges to complete') + } + + Object.entries (tickers).forEach (([ id, response ]) => { + const folder = 'C:/myproject/tickers' + const filename = `${id}-tickers.json` + console.log (path.join (folder, filename)) + writeFileSync (path.join (folder, filename), JSON.stringify (response)) + }) + + const end = Date.now () + console.log (`Fetched tickers in ${(end - start) / 1000} seconds`) + +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files.md b/docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files.md new file mode 100644 index 0000000..c92725e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-all-tickers-to-files.md @@ -0,0 +1,83 @@ +- [Fetch All Tickers To Files](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; + +const { noLocate } = ololog; +const log = noLocate; + +import fs from 'fs'; + +// the numWorkers constant defines the number of concurrent workers +// those aren't really threads in terms of the async environment +// set this to the number of cores in your CPU * 2 +// or play with this number to find a setting that works best for you + +const numWorkers = 8;(async () => { + + // make an array of all exchanges + const exchanges = ccxt.exchanges + + // filter coinmarketcap and theocean + // coinmarketcap isn't really an exchange + // theocean requires web3 dependencies to be installed + + .filter (id => ![ 'coinmarketcap', 'theocean' ].includes (id)) + + // instantiate each exchange and save it to the exchanges list + + .map (id => new ccxt[id] ()) + + // the worker function for each "async thread" + const worker = async function () { + + // while the array of all exchanges is not empty + while (exchanges.length > 0) { + + // pop one exchange from the array + const exchange = exchanges.pop () + + // check if it has the necessary method implemented + if (exchange.has['fetchTickers']) { + + // try to do "the work" and handle errors if any + try { + + // fetch the response for all tickers from the exchange + const tickers = await exchange.fetchTickers () + + // make a filename from exchange id + const filename = exchange.id + '.json' + + // save the response to a file + fs.writeFileSync (filename, JSON.stringify ({ tickers })); + + // print out a message on success + log.green (exchange.id, 'tickers saved to', filename) + + } catch (e) { + + // in case of error - print it out and ignore it further + log.red (e.constructor.name, e.message) + } + + } else { + + log.red (exchange.id, "has['fetchTickers'] = false"); + } + } + } + + // create numWorkers "threads" (they aren't really threads) + const workers = [ ... Array (numWorkers) ].map (_ => worker ()) + + // wait for all of them to execute or fail + await Promise.all (workers) + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-balance.md b/docs/ccxt/wiki/examples/js/fetch-balance.md new file mode 100644 index 0000000..075a938 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-balance.md @@ -0,0 +1,33 @@ +- [Fetch Balance](./examples/js/) + + + ```javascript + "use strict"; + +const ccxt = require ('../../ccxt.js'); + +// instantiate the exchange +let exchange = new ccxt.coinbasepro ({ + 'apiKey': 'XXXXXXXXXXXXXX', + 'secret': 'YYYYYYYYYYYYYY', + 'password': 'ZZZZZZ', // if exchange requires password +}); + + +async function checkMyBalance() { + try { + // fetch account balance from the exchange + let myBalance = await exchange.fetchBalance (); + + // output the result + console.log (exchange.id, 'fetched balance', myBalance); + + } catch (e) { + // fpr advanced error-handling, see the "advanced-error-handling.js" example file + console.log ('[' + e.constructor.name + '] ' + e.message); + throw e; + } +} + +checkMyBalance(); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-create-deposit-address.md b/docs/ccxt/wiki/examples/js/fetch-create-deposit-address.md new file mode 100644 index 0000000..f8c294b --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-create-deposit-address.md @@ -0,0 +1,106 @@ +- [Fetch Create Deposit Address](./examples/js/) + + + ```javascript + // ---------------------------------------------------------------------------- +// setup + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- +// setup + +const // change me + defaultCurrencyCode = 'BTC', + // change me + // currency code specified in commandline args ↓ + // you can call this script like node examples/js/fetch-create-deposit-address ETH + exchangeId = 'poloniex', + currencyCode = process.argv[3] || defaultCurrencyCode, + exchange = new ccxt[exchangeId] ({ + + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + + 'enableRateLimit': true, // ←- required! https://github.com/ccxt/ccxt/wiki/Manual#rate-limit + + // 'verbose': true, // ←- uncomment this for verbose output + + // additional credentials might be required in exchange-specific cases: + // uid or password for Coinbase Pro, etc... + }); + +// ---------------------------------------------------------------------------- + +if (!exchange.has['fetchDepositAddress']) { + + console.log ('The exchange does not support fetchDepositAddress() yet') + process.exit () +} + +// ---------------------------------------------------------------------------- + +;(async () => { + + try { + + console.log ('Trying to fetch deposit address for ' + currencyCode + ' from ' + exchangeId + '...') + + let fetchResult = await exchange.fetchDepositAddress (currencyCode) + + console.log ('Successfully fetched deposit address for ' + currencyCode) + console.log (fetchResult) + + } catch (e) { + + // never skip proper error handling, whatever it is you're building + // actually, with crypto error handling should be the largest part of your code + + if (e instanceof ccxt.InvalidAddress) { + + console.log ('The address for ' + currencyCode + ' does not exist yet') + + if (exchange.has['createDepositAddress']) { + + console.log ('Attempting to create a deposit address for ' + currencyCode + '...') + + try { + + const createResult = await exchange.createDepositAddress (currencyCode) + + // console.log (createResult) // for debugging + + console.log ('Successfully created a deposit address for ' + currencyCode + ', fetching the deposit address now...') + + try { + + let fetchResult = await exchange.fetchDepositAddress (currencyCode) + + console.log ('Successfully fetched deposit address for ' + currencyCode) + console.log (fetchResult); + + + } catch (e) { + + console.log ('Failed to fetch deposit address for ' + currencyCode, e.constructor.name, e.message) + } + + } catch (e) { + + console.log ('Failed to create deposit address for ' + currencyCode, e.constructor.name, e.message) + + } + + } else { + + console.log ('The exchange does not support createDepositAddress()') + } + + } else { + + console.log ('There was an error while fetching deposit address for ' + currencyCode, e.constructor.name, e.message) + } + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-first-ohlcv-timestamp.md b/docs/ccxt/wiki/examples/js/fetch-first-ohlcv-timestamp.md new file mode 100644 index 0000000..fd68a8c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-first-ohlcv-timestamp.md @@ -0,0 +1,85 @@ +- [Fetch First Ohlcv Timestamp](./examples/js/) + + + ```javascript + // eslint-disable-next-line no-unused-vars +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// ###### Description ###### +// +// This function tries to fetch the "listing time" of a symbol by fetching the earliest available bar in daily resolution. +// Top-tier exchanges also support fetching smaller timeframes (eg. 1 minute) even several years back, so for those exchanges you can also use `useMinuteTimeframe = true` argument to get the timestamp rounded to the earliest minute bar (instead of daily bar timestamp). +// See usage in the end of this file +async function fetchFirstBarTimestamp(exchange, symbol, useMinuteTimeframe = false) { + // set some constants + const millisecondsPerDay = 86400000; + const minutesPerDay = 1440; + const minimumTimestamp = 1230768000000; // 2009-01-01 (bitcoin created year) + // get market features + const market = exchange.market(symbol); + const marketType = exchange.safeString(market, 'type'); + let features = exchange.safeDict(exchange.features, marketType, {}); + if (market['subType'] !== undefined) { + features = exchange.safeDict(features, market['subType'], {}); + } + const ohlcv = exchange.safeDict(features, 'fetchOHLCV'); + if (ohlcv === undefined) { + return undefined; + } + const limit = exchange.safeInteger(ohlcv, 'limit'); + const fetchParams = { 'maxRetriesOnFailure': 3 }; + // start loop + let currentSince = exchange.milliseconds() - millisecondsPerDay * (limit - 1); + let foundStartTime = 0; + // eslint-disable-next-line + while (true) { + currentSince = Math.max(currentSince, minimumTimestamp); + const dailyBars = await exchange.fetchOHLCV(symbol, '1d', currentSince, limit, fetchParams); + if (dailyBars.length <= 0) { + break; // if no days returned, then probably start date was passed + } + const firstTs = dailyBars[0][0]; + if (firstTs === foundStartTime) { + // if the first timestamp is equal to the last-fetched timestamp, then break here, because some exchanges still return initial bar even if since is much ahead to listing time + break; + } + foundStartTime = firstTs; + currentSince = foundStartTime - millisecondsPerDay * (limit - 1); // shift 'since' one step back + if (dailyBars.length === 1) { + // in some cases, some exchanges might still return first bar of chart when endtime overlaps previous day + break; + } + } + // if minute resolution needed + if (useMinuteTimeframe) { + const maxIteration = Math.ceil(minutesPerDay / limit) * 2; + const allPromises = []; + for (let i = 0; i < maxIteration; i++) { + currentSince = foundStartTime - millisecondsPerDay + i * limit * 60 * 1000; // shift one-duration back for more accuracy for different kind of exchanges, like OKX, where first daily bar is offset by one day, but minute bars present + allPromises.push(exchange.fetchOHLCV(symbol, '1m', currentSince, limit, fetchParams)); + } + const allResponses = await Promise.all(allPromises); + // find earliest bar + for (let i = 0; i < allResponses.length; i++) { + const response = allResponses[i]; + if (response.length > 0) { + foundStartTime = response[0][0]; + break; + } + } + } + return foundStartTime; +} +// ###### Usage ###### +const runExample = false; // set to true to run example +if (runExample) { + const myEx = new ccxt.binance(); + await myEx.loadMarkets(); + const symbol = 'TRUMP/USDT'; + const earliest_timestamp = await fetchFirstBarTimestamp(myEx, symbol, true); + console.log('- Earliest bar timestamp:', earliest_timestamp, ', readable: ', myEx.iso8601(earliest_timestamp)); + console.log('- market.created value:', myEx.market(symbol)['created']); +} +export default fetchFirstBarTimestamp; + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-from-many-exchanges-simultaneously.md b/docs/ccxt/wiki/examples/js/fetch-from-many-exchanges-simultaneously.md new file mode 100644 index 0000000..8e746d8 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-from-many-exchanges-simultaneously.md @@ -0,0 +1,26 @@ +- [Fetch From Many Exchanges Simultaneously](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; + +const symbol = 'ETH/BTC' +const exchanges = [ 'coinbasepro', 'hitbtc2', 'poloniex' ] + +;(async () => { + + const result = await Promise.all (exchanges.map (async id => { + + const exchange = new ccxt[id] () + const ticker = await exchange.fetchTicker (symbol) + return exchange.extend ({ 'exchange': id }, ticker) + + })) + + log (result); + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-funding-rate-history.md b/docs/ccxt/wiki/examples/js/fetch-funding-rate-history.md new file mode 100644 index 0000000..aa591ad --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-funding-rate-history.md @@ -0,0 +1,31 @@ +- [Fetch Funding Rate History](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; + +const table = asTable.configure ({ delimiter: ' | ' }); + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.binanceusdm() + , symbol = 'ETH/USDT' + , since = undefined + , limit = undefined + , params = {} + + // ------------------------------------------------------------------------ + // fetch the history of the funding rate for a symbol + + const response = await exchange.fetchFundingRateHistory (symbol, since, limit, params) + + console.log (table (response)) + +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-ohlcv-from-to-mark-index-premium.md b/docs/ccxt/wiki/examples/js/fetch-ohlcv-from-to-mark-index-premium.md new file mode 100644 index 0000000..146a7b6 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-ohlcv-from-to-mark-index-premium.md @@ -0,0 +1,78 @@ +- [Fetch Ohlcv From To Mark Index Premium](./examples/js/) + + + ```javascript + "use strict"; + +const ccxt = require ('../../ccxt') + +const exchange = new ccxt.binance (); + +const symbols = [ 'BTC/USDT', 'ETH/USDT', 'ADA/USDT']; +// start from i.e. 01 february 2022 +// you can use milliseconds integer or also parse uniform datetime string, i.e. exchange.parse8601 ('2020-02-01T00:00:00Z') +const fromTimestamp = 1643659200000; +const tillTimestamp = exchange.milliseconds (); +const timeframe = '1h'; +const itemsLimit = 1000; +const fetchMethod = 'fetchOHLCV'; // if using swap exchanges, you can also use fetchMarkOHLCV, fetchIndexOHLCV, fetchPremiumIndexOHLCV + +async function myDataFetch (symbol) { + + await exchange.loadMarkets (); + + // get the duration of one timeframe period in milliseconds + const duration = exchange.parseTimeframe (timeframe) * 1000; + console.log ('Fetching', symbol, timeframe, 'candles', 'from', exchange.iso8601 (fromTimestamp), 'to', exchange.iso8601 (tillTimestamp), '...'); + + let result = []; + let since = fromTimestamp; + do { + + try { + + const candles = await exchange[fetchMethod] (symbol, timeframe, since, itemsLimit); + + const message = '[' + symbol + '] Fetched ' + candles.length + ' ' + timeframe + ' candles since ' + exchange.iso8601 (since); + + if (candles.length) { + + const first = candles[0]; + const last = candles[candles.length - 1]; + console.log ( message, ' | first', exchange.iso8601 (first[0]), ' | last', exchange.iso8601 (last[0]) ); + + // store your candles to a database or to a file here + // ... + result = result.concat (candles); + since = last[0] + duration // next start from last candle timestamp + duration + + } else { + console.log ( message, ' | moving into next period'); + since = since + duration * itemsLimit; // next start from the current period's end + } + + } catch (e) { + + console.log (symbol, e.constructor.name, e.message, ' Taking small pause...'); + await exchange.sleep (2000); + // retry on next iteration + } + + } while (since + duration <= tillTimestamp) + + console.log (symbol + ' completed !'); + return result; +} + + + +async function checkAllSymbols() { + // download in parallel + await Promise.all (symbols.map (symbol => myDataFetch (symbol))); + // you can also do one by one (but that is not much optimal) + //for (const symbol of symbols) { + // const data = await myDataFetch (symbol); +} +checkAllSymbols(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-ohlcv-many-exchanges-continuosly.md b/docs/ccxt/wiki/examples/js/fetch-ohlcv-many-exchanges-continuosly.md new file mode 100644 index 0000000..9a5548a --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-ohlcv-many-exchanges-continuosly.md @@ -0,0 +1,45 @@ +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// fetch and handle constinuosly +async function fetchOHLCVContinuously(exchange, symbol) { + while (true) { + try { + const ohlcv = await exchange.fetchOHLCV(symbol); + const ohlcvLength = ohlcv.length; + console.log('Fetched ', exchange.id, ' - ', symbol, ' candles. last candle: ', ohlcv[ohlcvLength - 1]); + } + catch (e) { + console.log(e); + break; + } + } +} +// start exchanges and fetch OHLCV loop +async function startExchange(exchangeName, symbols) { + const ex = new ccxt[exchangeName]({}); + const promises = []; + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i]; + promises.push(fetchOHLCVContinuously(ex, symbol)); + } + await Promise.all(promises); + await ex.close(); +} +// main function +async function example() { + const exchanges = ['binance', 'okx', 'kraken']; + const symbols = ['BTC/USDT', 'ETH/USDT']; + const promises = []; + for (let i = 0; i < exchanges.length; i++) { + const exchangeName = exchanges[i]; + promises.push(startExchange(exchangeName, symbols)); + } + await Promise.all(promises); +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-ohlcv.md b/docs/ccxt/wiki/examples/js/fetch-ohlcv.md new file mode 100644 index 0000000..ce4fa70 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-ohlcv.md @@ -0,0 +1,22 @@ +- [Fetch Ohlcv](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const myex = new ccxt.okx({}); + const fromTimestamp = myex.milliseconds() - 86400 * 1000; // last 24 hrs + const ohlcv = await myex.fetchOHLCV('BTC/USDT', '1m', fromTimestamp, 3, { 'whatever': 123 }); + const length = ohlcv.length; + if (length > 0) { + const lastPrice = ohlcv[length - 1][4]; + console.log('Fetched ', length, ' candles for ', myex.id, ': last close ', lastPrice); + } + else { + console.log('No candles have been fetched'); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-okex-futures.md b/docs/ccxt/wiki/examples/js/fetch-okex-futures.md new file mode 100644 index 0000000..de91428 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-okex-futures.md @@ -0,0 +1,28 @@ +- [Fetch Okex Futures](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +async function test () { + + const exchange = new ccxt.okex () + await exchange.loadMarkets () + + for (let symbol in exchange.markets) { + + const market = exchange.markets[symbol] + + if (market['future']) { + console.log ('----------------------------------------------------') + console.log (symbol, await exchange.fetchTicker (symbol)) + await ccxt.sleep (exchange.rateLimit) + } + } +} + +test () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-orders.md b/docs/ccxt/wiki/examples/js/fetch-orders.md new file mode 100644 index 0000000..2afa208 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-orders.md @@ -0,0 +1,32 @@ +- [Fetch Orders](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; +import ansicolor from 'ansicolor'; + + +ansicolor.nice + +const exchange = new ccxt.bittrex ({ + apiKey: "YOUR_API_KEY", + secret: "YOUR_SECRET", +}) + +async function test () { + + const orders = await exchange.fetchOrders () + + log (asTable (orders.map (order => ccxt.omit (order, [ 'timestamp', 'info' ])))) + + const order = await exchange.fetchOrder (orders[0]['id']) + + log (order) +} + +test () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-ticker-from-multiple-exchanges.md b/docs/ccxt/wiki/examples/js/fetch-ticker-from-multiple-exchanges.md new file mode 100644 index 0000000..c9a8e46 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-ticker-from-multiple-exchanges.md @@ -0,0 +1,40 @@ +- [Fetch Ticker From Multiple Exchanges](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +(async () => { + + const exchanges = [ + 'bittrex', + 'poloniex', + ] + + const symbol = 'BTC/USDT' + const tickers = {} + + await Promise.all (exchanges.map (exchangeId => + + new Promise (async (resolve, reject) => { + + const exchange = new ccxt[exchangeId] () + + while (true) { + + const ticker = await exchange.fetchTicker (symbol) + tickers[exchangeId] = ticker + + Object.keys (tickers).map (exchangeId => { + const ticker = tickers[exchangeId] + console.log (ticker['datetime'], exchangeId, ticker['bid'], ticker['ask']) + }) + } + + }) + + )) + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/fetch-ticker-where-available.md b/docs/ccxt/wiki/examples/js/fetch-ticker-where-available.md new file mode 100644 index 0000000..fc168e3 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/fetch-ticker-where-available.md @@ -0,0 +1,80 @@ +- [Fetch Ticker Where Available](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; +import ansicolor from 'ansicolor'; + + +ansicolor.nice + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'symbol'.green) +} + +;(async function main () { + + if (process.argv.length > 2) { + + let symbol = process.argv[2].toUpperCase () + + for (let i = 0; i < ccxt.exchanges.length; i++) { + + let id = ccxt.exchanges[i] + + const exchange = new ccxt[id] () + if (exchange.has.fetchTicker) { + + try { + + await exchange.loadMarkets () + + if (exchange.symbols.includes (symbol)) { + + log (id.green) + + const ticker = await exchange.fetchTicker (symbol) + + log.dim (ticker) + + if (ticker['baseVolume'] && ticker['quoteVolume']) { + + if (ticker['bid'] > 1) { + + if (ticker['baseVolume'] > ticker['quoteVolume']) + log (id.bright, 'baseVolume > quoteVolume ← !'.bright) + + } else { + + if (ticker['baseVolume'] < ticker['quoteVolume']) + log (id.bright, 'baseVolume < quoteVolume ← !'.bright) + + } + + } + + } else { + + log (id.yellow) + } + + } catch (e) { + + log.error (id.red, e.toString ().red) + } + } + } + + } else { + + printUsage () + } + + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/gateio-create-batch-order.md b/docs/ccxt/wiki/examples/js/gateio-create-batch-order.md new file mode 100644 index 0000000..8051834 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/gateio-create-batch-order.md @@ -0,0 +1,48 @@ +- [Gateio Create Batch Order](./examples/js/) + + + ```javascript + const ccxt = require ('../../ccxt'); + +console.log ('CCXT Version:', ccxt.version); + +async function main () { + + const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + await exchange.loadMarkets (); + + const ada = exchange.market ('ADA/USDT'); + const xrp = exchange.market ('XRP/USDT'); + + const orders = await exchange.privateSpotPostBatchOrders ( + [ + { + text: "t-123456", + currency_pair: ada['id'], + type: "limit", + account: "spot", + side: "buy", + amount: "3", + price: "0.4", + }, + { + text: "t-123456", + currency_pair: xrp['id'], + type: "limit", + account: "spot", + side: "buy", + amount: "3", + price: "0.47", + }, + ] + ); + + console.log (orders); + +}; + +main (); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/gateio-futures.md b/docs/ccxt/wiki/examples/js/gateio-futures.md new file mode 100644 index 0000000..f75f8c8 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/gateio-futures.md @@ -0,0 +1,55 @@ +- [Gateio Futures](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + + +const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'future', + }, +}) + +;(async () => { + // exchange.setSandboxMode (true) + + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example 1: Creating a future (market) order + try { + + // find a future + const futures = [] + for (const [key, market] of Object.entries(markets)) { + if (market['future']) { + futures.push(market); + } + } + if (futures.length > 0) { + const market = futures[0]; + const symbol = market['symbol'] // example: BTC/USDT:USDT-220318 + const type = 'market' + const side = 'buy' + const amount = 1 + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + } + + } catch (e) { + console.log (e.constructor.name, e.message) + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/gateio-open-close-contract.md b/docs/ccxt/wiki/examples/js/gateio-open-close-contract.md new file mode 100644 index 0000000..c393ad6 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/gateio-open-close-contract.md @@ -0,0 +1,55 @@ +- [Gateio Open Close Contract](./examples/js/) + + + ```javascript + const ccxt = require ('../../ccxt'); + + +const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'swap', + 'marginMode': 'cross' + }, +}) + + +;(async () => { + + // exchange.setSandboxMode (true) + + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example: creating and closing a contract + let symbol = 'LTC/USDT:USDT' + let type = 'market' + let side = 'buy' + let amount = 1 + let price = undefined + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + console.log(balance) + + // placing an order / opening contract position + const order = await exchange.createOrder (symbol, type, side, amount, price) + console.log (order) + + // closing it by issuing an oposite contract + // and therefore close our previous position + side = 'sell' + type = 'market' + reduce_only = true + params = {'reduce_only': reduce_only} + const opositeOrder = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (opositeOrder) + } catch (e) { + console.log (e.constructor.name, e.message) + } +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/gateio-swaps.md b/docs/ccxt/wiki/examples/js/gateio-swaps.md new file mode 100644 index 0000000..9b005e3 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/gateio-swaps.md @@ -0,0 +1,80 @@ +- [Gateio Swaps](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.gateio ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) + +;(async () => { + // exchange.setSandboxMode (true) + + const markets = await exchange.loadMarkets () + + exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example 1: Creating and canceling a linear swap (limit) order + try { + const symbol = 'LTC/USDT:USDT' + const type = 'limit' + const side = 'buy' + const amount = 1 + const price = 55 + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + + // canceling an order + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + + // Example 2: Creating and canceling a linear swap (stop-limit) order with leverage + try { + const symbol = 'LTC/USDT:USDT' + const type = 'limit' + const side = 'buy' + const amount = 1 + const price = 55 + + const stopPrice = 130 + const params = { + 'stopPrice': stopPrice, + } + //set leverage + const leverage = await exchange.setLeverage(3, symbol); + console.log(leverage) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // canceling an order + const cancelParams = { + isStop: true, + }; + const cancel = await exchange.cancelOrder (order['id'], symbol, cancelParams) + console.log (cancel) + + //reset leverage + exchange.setLeverage(1, symbol); + } catch (e) { + console.log (e.constructor.name, e.message) + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/gdax-fetch-trades-pagination.md b/docs/ccxt/wiki/examples/js/gdax-fetch-trades-pagination.md new file mode 100644 index 0000000..baf3d22 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/gdax-fetch-trades-pagination.md @@ -0,0 +1,35 @@ +- [Gdax Fetch Trades Pagination](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; + +const { noLocate } = ololog; +const log = noLocate; + +const exchange = new ccxt.coinbasepro () + +;(async () => { + + const symbol = 'ETH/BTC' + const params = {} + await exchange.loadMarkets () + while (true) { + const trades = await exchange.fetchTrades (symbol, undefined, undefined, params) + if (trades.length) { + const firstTrade = trades[0] + const lastTrade = trades[trades.length - 1] + log.yellow ('Fetched', trades.length, symbol, 'trades from', firstTrade['datetime'], 'to', lastTrade['datetime']) + if ('Cb-After' in exchange.last_response_headers) { + params['after'] = exchange.last_response_headers['Cb-After']; + } + } else { + log.green ('Done.') + break; + } + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/hibachi-example.md b/docs/ccxt/wiki/examples/js/hibachi-example.md new file mode 100644 index 0000000..841d9dc --- /dev/null +++ b/docs/ccxt/wiki/examples/js/hibachi-example.md @@ -0,0 +1,119 @@ +- [Hibachi Example](./examples/js/) + + + ```javascript + import { hibachi } from '../../js/ccxt.js'; +import fs from 'fs'; +/* + In order to run the examples, you need to setup keys.local.json file like this: + ``` + { + "hibachi": { + "accountId": 111, + "apiKey": "1111111111111111111111111111111111111111111=", + "privateKey": "0x1111111111111111111111111111111111111111111111111111111111111111", + "publicKey": "0x11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", + "withdrawAddress": "0x1111111111111111111111111111111111111111" + } + } + ``` + You can get the accountId, apiKey and privateKey from Hibachi App by creating an API key + After that you can view the API key, it will show the publicKey (only for trustless account, you can ignore it for exchange managed account) + Note: if you are using exchange managed account, the privateKey's length will be 44 instead + The withdrawAddress can be any ethereum wallet address, that is used to receive funds for withdraw tests +*/ +async function example() { + const keys = JSON.parse(fs.readFileSync('keys.local.json', 'utf-8')); + const exchange = new hibachi(keys.hibachi); + exchange.verbose = true; + const markets = await exchange.fetchMarkets(); + console.log('fetchMarkets', markets.length, markets[0]); + const currencies = await exchange.fetchCurrencies(); + console.dir(currencies, { depth: null, colors: true }); + const trades = await exchange.fetchTrades("BTC/USDT:USDT"); + console.log('fetchTrades', trades.length, trades[0]); + const tenMinutes = 10 * 60 * 1000; + const until = Date.now(); + const since = until - tenMinutes; + const ohlcv = await exchange.fetchOHLCV('BTC/USDT:USDT', '5min', since, 100, { until }); + console.log('fetchOHLCV', ohlcv.length, ohlcv[0]); + const balance = await exchange.fetchBalance(); + console.dir(balance, { depth: null, colors: true }); + const ticker = await exchange.fetchTicker('BTC/USDT:USDT'); + console.log('fetchTicker', ticker); + // createOrder, editOrder and cancelOrder + const order1 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const order2 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002); + console.log('create market order', order1.id, order2.id); + const order3 = await exchange.createOrder('ETH/USDT:USDT', 'limit', 'buy', 1.234, 1.234); + const order4 = await exchange.editOrder(order3.id, 'ETH/USDT:USDT', 'limit', 'buy', 0.987, 1.123); + const order5 = await exchange.cancelOrder(order3.id); + console.log('create, edit and cancel limit order', order3.id, order4.id, order5.id); + // advanced order parameters + const postOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, { 'timeInForce': 'PO' }); + await exchange.cancelOrder(postOnlyOrder.id); + const iocOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, { 'timeInForce': 'IOC' }); + await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const reduceOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002, undefined, { 'reduceOnly': true }); + const triggerOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'sell', 2.0, 2.0, { 'triggerPrice': '2.0' }); + await exchange.cancelOrder(triggerOrder.id); + console.log('postOnly, IOC, reduceOnly, trigger order', postOnlyOrder.id, iocOrder.id, reduceOnlyOrder.id, triggerOrder.id); + const order1_info = await exchange.fetchOrder(order1.id, 'BTC/USDT:USDT'); + console.log('fetchOrder', order1_info); + const orderbook = await exchange.fetchOrderBook('BTC/USDT:USDT'); + console.log('fetchOrderBook', orderbook); + const withdrawResponse = await exchange.withdraw('USDT', 0.02, keys.hibachi.withdrawAddress); + console.log(withdrawResponse); + const myTrades = await exchange.fetchMyTrades('BTC/USDT:USDT', undefined, 1); + console.log('fetchMyTrades', myTrades); + const tradingFees = await exchange.fetchTradingFees(); + console.log('fetchTradingFees', tradingFees); + const openOrders = await exchange.fetchOpenOrders(); + console.log('fetchOpenOrders', openOrders); + const openOrdersWithLimit = await exchange.fetchOpenOrders(undefined, undefined, 1); + console.log('fetchOpenOrdersWithLimit', openOrdersWithLimit); + const openOrdersBTC = await exchange.fetchOpenOrders('BTC/USDT:USDT'); + console.log('fetchOpenOrdersBTC', openOrdersBTC); + const openOrdersSince = await exchange.fetchOpenOrders(undefined, 1752552000000); // 7/15/2025 00:00 UTC + console.log('fetchOpenOrdersSince', openOrdersSince); + if (keys.hibachi.publicKey !== undefined) { + const depositAddress = await exchange.fetchDepositAddress('USDT', { 'publicKey': keys.hibachi.publicKey }); + console.log('fetchDepositAddress', depositAddress); + } + const ledger = await exchange.fetchLedger('USDT', undefined, 2); + console.log('fetchLedger', ledger); + const deposits = await exchange.fetchDeposits(); + console.log('fetchDeposits', deposits); + const withdrawals = await exchange.fetchWithdrawals(); + console.log('fetchWithdrawals', withdrawals); + const timestamp = await exchange.fetchTime(); + console.log('fetchTime', timestamp); + const openInterest = await exchange.fetchOpenInterest('BTC/USDT:USDT'); + console.log('fetchOpenInterest', openInterest); + const fundingRate = await exchange.fetchFundingRate('BTC/USDT:USDT'); + console.log('fetchFundingRate', fundingRate); + const fundingRateHistory = await exchange.fetchFundingRateHistory('BTC/USDT:USDT', undefined, 2); + console.log('fetchFundingRateHistory', fundingRateHistory); + // Batch orders + const createOrders = await exchange.createOrders([ + { 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.234, 'price': 1.234 }, + { 'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.001, 'price': 1.001 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.002, 'price': 1.002 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.003, 'price': 1.003 }, + ]); + console.log('createOrders', createOrders); + const editOrders = await exchange.editOrders([ + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + { 'id': createOrders[0].id, 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.111, 'price': 0.999 }, + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + { 'id': createOrders[1].id, 'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.112, 'price': 0.998 }, + ]); + console.log('editOrders', editOrders); + const cancelOrders = await exchange.cancelOrders([createOrders[0].id, createOrders[1].id]); + console.log('cancelOrders', cancelOrders); + const cancelAll = await exchange.cancelAllOrders('ETH/USDT:USDT'); + console.log(cancelAll); +} +example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/hitbtc2-withdraw.md b/docs/ccxt/wiki/examples/js/hitbtc2-withdraw.md new file mode 100644 index 0000000..3263e44 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/hitbtc2-withdraw.md @@ -0,0 +1,66 @@ +- [Hitbtc2 Withdraw](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +const log = ololog.configure ({ locate: false }) + +require ('ansicolor').nice + +const getPositiveAccounts = function (balance) { + const result = {} + Object.keys (balance) + .filter (currency => balance[currency] && (balance[currency] > 0)) + .forEach (currency => { + result[currency] = balance[currency] + }) + return result +} + +;(async () => { + + // instantiate the exchange + let exchange = new ccxt.hitbtc2 ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }) + + try { + + let tradingBalance = await exchange.fetchBalance () + let accountBalance = await exchange.fetchBalance ({ type: 'account' }) + + log.cyan ('Trading balance:', getPositiveAccounts (tradingBalance.total)) + log.magenta ('Account balance:', getPositiveAccounts (accountBalance.total)) + + // withdraw + let withdraw = await exchange.withdraw ('ETH', 0.01, '0x811DCfeb6dC0b9ed825808B6B060Ca469b83fB81') + + // output the result + log (exchange.name.green, 'withdraw', withdraw) + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection || e.message.includes ('ECONNRESET')) { + log.bright.yellow ('[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow ('[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow ('[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow ('[Exchange Not Available Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow ('[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow ('[Network Error] ' + e.message) + } else { + throw e + } + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/how-to-import-one-exchange-esm.md b/docs/ccxt/wiki/examples/js/how-to-import-one-exchange-esm.md new file mode 100644 index 0000000..8fe9c70 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/how-to-import-one-exchange-esm.md @@ -0,0 +1,16 @@ +- [How To Import One Exchange Esm](./examples/js/) + + + ```javascript + import { binance } from '../../js/ccxt.js'; +async function example() { + const exchange = new binance({}); + const ob = await exchange.fetchOrderBook('BTC/USDT', 3); + const asks = ob['asks']; + const bids = ob['bids']; + console.log(asks); + console.log(bids); +} +example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/huobi-futures.md b/docs/ccxt/wiki/examples/js/huobi-futures.md new file mode 100644 index 0000000..07247ca --- /dev/null +++ b/docs/ccxt/wiki/examples/js/huobi-futures.md @@ -0,0 +1,77 @@ +- [Huobi Futures](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'future', + }, +}) + +;(async () => { + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // creating and canceling a linear future (limit) order + let symbol = 'ETH/USDT:USDT-220121' // the last segment is the date of expiration (can be next week, next quarter, ...) adjust it accordingly + let type = 'limit' + let side = 'buy' + let offset= 'open' + let leverage = 1 + let amount = 1 + let price = 1 + let params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + // console.log(balance) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + + // canceling an order + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + + // creating and canceling a inverse future (limit) order + symbol = 'ADA/USD:ADA-220121' // the last segment is the date of expiration (can be next week, next quarter, ...) adjust it accordingly + type = 'limit' + side = 'buy' + offset= 'open' + leverage = 1 + amount = 1 + price = 1 // 1 contract = 10 ADA = 10 usd in this case + params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/huobi-open-close-contract.md b/docs/ccxt/wiki/examples/js/huobi-open-close-contract.md new file mode 100644 index 0000000..0e092b5 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/huobi-open-close-contract.md @@ -0,0 +1,69 @@ +- [Huobi Open Close Contract](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'swap', + 'marginMode': 'cross' + }, +}) + +;(async () => { + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // Example: creating and closing a contract + let symbol = 'ADA/USDT:USDT' // market positions for contracts not available + let type = 'limit' + let side = 'buy' + let offset= 'open' + let leverage = 1 + let amount = 1 + let price = 1 + let clientOrderId = 6; + let params = { + 'offset': offset, + 'lever_rate': leverage, + 'client_order_id': clientOrderId + } + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + console.log(balance) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // fetching position + const position = await exchange.fetchPosition(symbol) + console.log(position) + + + // closing it by issuing an oposite contract + // warning: since we can only place limit orders + // it might take a while (depending on the price we choose and market fluctuations) + // to the order be fulfilled + // and therefore close our previous position + side = 'sell' + type = 'limit' + offset = 'close' + reduce_only = 1 // 1 : yes, 0: no + clientOrderId = 9 + price = 1.147 // adjust this accordingly + params = {'offset': offset, 'reduce_only': reduce_only, 'client_order_id': clientOrderId} + const opositeOrder = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (opositeOrder) + } catch (e) { + console.log (e.constructor.name, e.message) + } +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/huobi-swaps.md b/docs/ccxt/wiki/examples/js/huobi-swaps.md new file mode 100644 index 0000000..888957b --- /dev/null +++ b/docs/ccxt/wiki/examples/js/huobi-swaps.md @@ -0,0 +1,76 @@ +- [Huobi Swaps](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) + +;(async () => { + const markets = await exchange.loadMarkets () + + // exchange.verbose = true // uncomment for debugging purposes if necessary + + // creating and canceling a linear swap (limit) order + let symbol = 'ADA/USDT:USDT' + let type = 'limit' + let side = 'buy' + let offset= 'open' + let leverage = 1 + let amount = 1 + let price = 1 // 1 contract = 10 ADA = 10 usd in this case + let params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + // fetching current balance + const balance = await exchange.fetchBalance() + // console.log(balance) + + // placing an order + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + + // fetching open orders + const openOrders = await exchange.fetchOpenOrders(symbol) + console.log(openOrders) + + // canceling an order + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } + + // creating and canceling an inverse swap (limit) order + symbol = 'ADA/USD:ADA' + type = 'limit' + side = 'buy' + offset = 'open' + leverage = 1 + amount = 1 + price = 1 // 1 contract = 10 ADA = 10 usd in this case + params = { + 'offset': offset, + 'lever_rate': leverage, + } + + try { + const order = await exchange.createOrder (symbol, type, side, amount, price, params) + console.log (order) + const cancel = await exchange.cancelOrder (order['id'], symbol) + console.log (cancel) + } catch (e) { + console.log (e.constructor.name, e.message) + } +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/huobipro-market-buy-sell-fetch-trading-limits.md b/docs/ccxt/wiki/examples/js/huobipro-market-buy-sell-fetch-trading-limits.md new file mode 100644 index 0000000..a36dfb2 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/huobipro-market-buy-sell-fetch-trading-limits.md @@ -0,0 +1,103 @@ +- [Huobipro Market Buy Sell Fetch Trading Limits](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' + +const log = ololog.configure .unlimited.handleNodeErrors (), + { NotSupported } = ccxt, + enableRateLimit = true, + symbol = 'ADA/BTC', + side = 'buy', + // set createMarketBuyOrderRequiresPrice to true or false to see the difference + type = 'market', + // default is true + createMarketBuyOrderRequiresPrice = true, + amount = 191.03, + price = 0.000011, + options = { createMarketBuyOrderRequiresPrice }, + exchange = new ccxt.huobipro ({ enableRateLimit, options }); + +// This is an example that demonstrates the issues discussed here: +// https://github.com/ccxt/ccxt/issues/564 +// https://github.com/ccxt/ccxt/issues/3427 +// https://github.com/ccxt/ccxt/issues/3460 +// https://github.com/ccxt/ccxt/issues/4799 + +log.green ('CCXT', ccxt.version) + +;(async () => { + + // preload them first + await exchange.loadMarkets () + + // huobipro has this + if (!exchange.has['fetchTradingLimits']) { + throw new NotSupported (exchange.id + ' does not have fetchTradingLimits() yet, make sure your version of CCXT is up to date'); + } + + // In this particular case it requires an array of symbols + // otherwise it will load all of them one by one. + // Loading all limits without specifying + // the array of symbols might take a lot of time. + + // The array of symbols will contain just one symbol of interest. + const arrayOfSymbols = [ symbol ] + + const allLimits = await exchange.fetchTradingLimits (arrayOfSymbols) + + // { 'ADA/BTC': { info: { symbol: "adabtc", + // 'buy-limit-must-less-than': 1.1, + // 'sell-limit-must-greater-than': 0.9, + // 'limit-order-must-greater-than': 0.1, + // 'limit-order-must-less-than': 5000000, + // 'market-buy-order-must-greater-than': 0.0001, + // 'market-buy-order-must-less-than': 100, + // 'market-sell-order-must-greater-than': 0.1, + // 'market-sell-order-must-less-than': 500000, + // 'limit-order-before-open-greater-than': 999999999, + // 'limit-order-before-open-less-than': 0, + // 'circuit-break-when-greater-than': 10000, + // 'circuit-break-when-less-than': 10, + // 'market-sell-order-rate-must-less-than': 0.1, + // 'market-buy-order-rate-must-less-than': 0.1 }, + // limits: { amount: { min: 0.1, max: 5000000 } } } } + + const limits = allLimits[symbol] + log.yellow (symbol, 'limits:') + log.yellow (limits) + + // To make things a bit more complicated huobipro specifies + // different minimums for market and limit orders + // and different minimums for buy/sell directions + // therefore we have to work with it in an exchange-specific way + // using the 'info' field from the response – that is + // until this aspect is completely unified in ccxt. + + const info = limits['info'] + const typeSide = type + '-' + side + + const min = info[typeSide + '-order-must-greater-than'] + const max = info[typeSide + '-order-must-less-than'] + + // huobipro requires the amount in quote currency for market sell orders + // huobipro requires the cost in quote currency for market buy orders + // cost = amount * price + + const cost = createMarketBuyOrderRequiresPrice ? (amount * price) : amount + + let color = 'red' + + if ((min !== undefined) && (cost < min)) { + log[color] ('The cost is below minimum:', cost, '<', min) + } else if ((max !== undefined) && (cost > max)) { + log[color] ('The cost is above maximum:', cost, '>', max) + } else { + color = 'green' + } + + log[color] ({ min, max, cost }) + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/hybridCJSExample.md b/docs/ccxt/wiki/examples/js/hybridCJSExample.md new file mode 100644 index 0000000..93aead4 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/hybridCJSExample.md @@ -0,0 +1,24 @@ +- [Hybridcjsexample](./examples/js/) + + + ```javascript + +const ccxt = require('ccxt'); + +console.log('--------------------------------------------') +console.log('Yey importing ccxt as a cjs module!!!!!') +console.log('Version:', ccxt.version) +console.log('--------------------------------------------') + +const exchange = new ccxt.huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) +;(async () => { +const result = await exchange.fetchBalance(); +console.log(result) +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/hybridESMExample.md b/docs/ccxt/wiki/examples/js/hybridESMExample.md new file mode 100644 index 0000000..c5a2248 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/hybridESMExample.md @@ -0,0 +1,24 @@ +- [Hybridesmexample](./examples/js/) + + + ```javascript + import {version, huobi} from 'ccxt'; + +console.log('--------------------------------------------') +console.log('Yey importing ccxt as an ESM module!!!!!') +console.log('Version:', version) +console.log('--------------------------------------------') + +const exchange = new huobi ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) + +;(async () => { + const result = await exchange.fetchBalance(); + console.log(result) + }) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/idex-fetch-balance.md b/docs/ccxt/wiki/examples/js/idex-fetch-balance.md new file mode 100644 index 0000000..3e8b992 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/idex-fetch-balance.md @@ -0,0 +1,19 @@ +- [Idex Fetch Balance](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +const idex = ccxt.idex ({ + 'apiKey': 'YOUR_IDEX_API_KEY', + 'secret': 'YOUR_IDEX_SECRET', + 'walletAddress': '0xYOUR_ETHEREUM_WALLET_ADDRESS', + 'privateKey': '0xYOUR_ETHEREUM_PRIVATE_KEY', + 'verbose': 0, +}) + +;(async () => { + console.log (await idex.fetchBalance ()) +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/instantiate-all-at-once.md b/docs/ccxt/wiki/examples/js/instantiate-all-at-once.md new file mode 100644 index 0000000..cac5627 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/instantiate-all-at-once.md @@ -0,0 +1,52 @@ +- [Instantiate All At Once](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +async function test () { + + let exchanges = { + "bittrex": { + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }, + "bitfinex": { + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET" + }, + } + + let ids = ccxt.exchanges.filter (id => id in exchanges) + + await Promise.all (ids.map (async id => { + + console.log (exchanges[id]) + + // instantiate the exchange + let exchange = new ccxt[id] (exchanges[id]) + console.log (exchange.id, exchange.apiKey) + exchanges[id] = exchange + + // load markets + await exchange.loadMarkets () + console.log (exchange.id, 'loaded') + + // check the balance + if (exchange.apiKey) { + let balance = await exchange.fetchBalance () + console.log (exchange.id, balance) + } + + return exchange + })) + + // when all of them are ready, do your other things + console.log ('Loaded exchanges:', ids.join (', ')) +} + +test () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/instantiate-all-from-json.md b/docs/ccxt/wiki/examples/js/instantiate-all-from-json.md new file mode 100644 index 0000000..dff6545 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/instantiate-all-from-json.md @@ -0,0 +1,37 @@ +- [Instantiate All From Json](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import settings from './credentials.json'; + +async function test () { + + const ids = ccxt.exchanges.filter (id => id in settings) + + const exchanges = ccxt.indexBy (await Promise.all (ids.map (async id => { + + // instantiate the exchange + let exchange = new ccxt[id] (settings[id]) + + // load markets + await exchange.loadMarkets () + + // check the balance + if (exchange.apiKey) { + let balance = await exchange.fetchBalance () + console.log (exchange.id, balance['free']) + } + + return exchange + })), 'id') + + // when all of them are ready, do your other things + console.log ('Loaded exchanges:', Object.keys (exchanges).join (', ')) +} + +test () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/kraken-create-and-close-position.md b/docs/ccxt/wiki/examples/js/kraken-create-and-close-position.md new file mode 100644 index 0000000..8994cfd --- /dev/null +++ b/docs/ccxt/wiki/examples/js/kraken-create-and-close-position.md @@ -0,0 +1,60 @@ +- [Kraken Create And Close Position](./examples/js/) + + + ```javascript + // @ts-nocheck +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +console.log('CCXT Version:', ccxt.version); +// ------------------------------------------------------------------------------ +async function example() { + const exchange = new ccxt.kraken({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + }); + const symbol = 'UNI/USD'; + let side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'market'; // set it to 'market' or 'limit' + const amount = 1; + const leverage = 2; + await exchange.loadMarkets(); + const market = exchange.market(symbol); + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + // you can fetch the ticker and update price + // const ticker = await exchange.fetchTicker (symbol); + // const last_price = ticker['last']; + // const ask_price = ticker['ask']; + // const bid_price = ticker['bid']; + // if (order_type === 'limit') { + // price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + // } + const params = { + 'leverage': leverage, + }; + // log + console.log('Going to open a position', 'for', amount, 'worth', amount, market['base'], '~', market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision(symbol, price) : ''), '), using the following params:'); + console.log(params); + console.log('-----------------------------------------------------------------------'); + // exchange.verbose = True // uncomment for debugging purposes if necessary + try { + const created_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + console.log("Created an order", created_order); + // Fetch all your closed orders for this symbol (because we used market order) + // - use 'fetchClosedOrders' or 'fetchOrders' and filter with 'closed' status + const all_closed_orders = await exchange.fetchClosedOrders(symbol); + console.log("Fetched all your closed orders for this symbol", all_closed_orders); + const all_open_positions = await exchange.fetchPositions(symbol); + console.log("Fetched all your positions for this symbol", all_open_positions); + // To close a position: + // - long position (buy), you can create a sell order: exchange.createOrder (symbol, order_type, 'sell', amount, price, params); + // - short position (sell), you can create a buy order: exchange.createOrder (symbol, order_type, 'buy', amount, price, params); + } + catch (e) { + console.log(e.toString()); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/kraken-fetch-order-trades.md b/docs/ccxt/wiki/examples/js/kraken-fetch-order-trades.md new file mode 100644 index 0000000..86acf36 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/kraken-fetch-order-trades.md @@ -0,0 +1,39 @@ +- [Kraken Fetch Order Trades](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +(async () => { + + const exchange = new ccxt.kraken ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + // 'verbose': true, + }) + + const orders = await exchange.fetchClosedOrders (); + + for (let i = 0; i < orders.length; i++) { + const order = await exchange.fetchOrder (orders[i]['id']); + const trades = await exchange.fetchOrderTrades (order['id'], undefined, undefined, undefined, order); + console.log (trades); + } + + // + // alternatively: + // + // const params = { + // 'trades': [ + // 'TT5UC3-GOIRW-6AZZ6R', + // 'TIY6G4-LKLAI-Y3GD4A', + // 'T57FVC-OB4LN-Z55WUL', + // 'TIMIRG-WUNNE-RRJ6GT', + // ] + // } + // + // const trades = await exchange.fetchOrderTrades (order['id'], undefined, undefined, undefined, params); + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/kraken-margin-trading.md b/docs/ccxt/wiki/examples/js/kraken-margin-trading.md new file mode 100644 index 0000000..937d811 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/kraken-margin-trading.md @@ -0,0 +1,94 @@ +- [Kraken Margin Trading](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.kraken ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }) + + console.log ('-----------------------------------------------------------') + + console.log ('Loading markets...') + const markets = await exchange.loadMarkets () + console.log ('Markets loaded') + + // exchange.verbose = true // uncomment for debugging purposes + + try { + + const symbol = 'ETH/USDT' + , market = exchange.market (symbol) + , { base, quote } = market + , type = 'market' + , amount = market['limits']['amount']['min'] + , price = undefined + , params = { + 'leverage': 2, + } + + console.log ('-----------------------------------------------------------') + + // https://www.kraken.com/en-us/features/api#add-standard-order + + console.log ('Placing order...') + let order = await exchange.createOrder (symbol, type, 'buy', amount, price, params) + console.log ('Order placed:') + console.log (order) + + console.log ('-----------------------------------------------------------') + + // https://www.kraken.com/en-us/features/api#get-open-positions + + console.log ('Fetching open positions...') + const positionsParams = { 'docalcs': true } + let openPositions = await exchange.fetchPositions (positionsParams) + console.log ('Current positions:') + console.log (openPositions) + + console.log ('-----------------------------------------------------------') + + console.log ('Fetching balance...') + let balance = await exchange.fetchTotalBalance () + console.log ('Fetched balance:') + console.log (base, balance[base], '(base)') + console.log (quote, balance[quote], '(quote)') + + console.log ('-----------------------------------------------------------') + + console.log ('Closing the position...') + order = await exchange.createOrder (symbol, type, 'sell', amount, price, params) + console.log ('Got a response:') + console.log (order) + + console.log ('-----------------------------------------------------------') + + console.log ('Fetching open positions again...') + openPositions = await exchange.fetchPositions (positionsParams) + console.log ('Current positions:') + console.log (openPositions) + + console.log ('-----------------------------------------------------------') + + console.log ('Fetching balance...') + balance = await exchange.fetchTotalBalance () + console.log ('Fetched balance:') + console.log (base, balance[base], '(base)') + console.log (quote, balance[quote], '(quote)') + + } catch (e) { + + console.log (e.constructor.name, e.message) + } +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/kucoin-rate-limit.md b/docs/ccxt/wiki/examples/js/kucoin-rate-limit.md new file mode 100644 index 0000000..21c507e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/kucoin-rate-limit.md @@ -0,0 +1,44 @@ +- [Kucoin Rate Limit](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +async function main () { + + const exchange = new ccxt.kucoin() + const markets = await exchange.loadMarkets () + const timeframe = '5m' + const symbol = 'BTC/USDT' + const since = undefined + const limit = 1000 + + let i = 0 + while (true) { + try { + const ohlcvs = await exchange.fetchOHLCV(symbol, timeframe, since, limit) + const now = exchange.milliseconds() + const datetime = exchange.iso8601(now) + console.log(datetime, i, 'fetched', ohlcvs.length, symbol, timeframe, 'candles', + 'from', exchange.iso8601(ohlcvs[0][0]), + 'to', exchange.iso8601(ohlcvs[ohlcvs.length-1][0])) + } catch (e) { + if (e instanceof ccxt.RateLimitExceeded) { + const now = exchange.milliseconds() + const datetime = exchange.iso8601(now) + console.log(datetime, i, e.constructor.name, e.message) + await exchange.sleep(10000) + } else { + console.log(e.constructor.name, e.message) + throw e + } + } + i += 1 + } +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/latoken-example.md b/docs/ccxt/wiki/examples/js/latoken-example.md new file mode 100644 index 0000000..5bd9edb --- /dev/null +++ b/docs/ccxt/wiki/examples/js/latoken-example.md @@ -0,0 +1,113 @@ +- [Latoken Example](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog'; +import asTable from 'as-table'; + + +const table = asTable.configure ({ delimiter: ' | ' }), + //----------------------------------------------------------------------------- + log = ololog.unlimited.noLocate.handleNodeErrors ();(async function main () { + + const symbol = 'BTC/USDT' + + const exchange = new ccxt.latoken ({ + 'verbose': process.argv.includes ('--verbose'), + // uncomment and change for your keys to enable private calls + // 'apiKey': 'YOUR_API_KEY', + // 'secret': 'YOUR_API_SECRET', + }) + + await exchange.loadMarkets () + + log ('-------------------------------------------------------------------') + + log (exchange.id, 'has', exchange.has) + + // public API + + log ('-------------------------------------------------------------------') + + const markets = Object.values (exchange.markets) + log ('Loaded', markets.length, exchange.id, 'markets:') + log (table (markets.map (x => exchange.omit (x, [ 'info', 'limits', 'precision' ])))) + + log ('-------------------------------------------------------------------') + + const currencies = Object.values (exchange.currencies) + log ('Loaded', currencies.length, exchange.id, 'currencies:') + log (table (currencies.map (x => exchange.omit (x, [ 'info', 'limits' ])))) + + log ('-------------------------------------------------------------------') + + const time = await exchange.fetchTime () + log ('Exchange time:', exchange.iso8601 (time)) + + log ('-------------------------------------------------------------------') + + const ticker = await exchange.fetchTicker (symbol) + log (ticker) + + log ('-------------------------------------------------------------------') + + const tickers = await exchange.fetchTickers () + log (table (Object.values (tickers).map (x => + exchange.omit (x, [ 'info', 'bid', 'ask', 'bidVolume', 'askVolume', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const orderbook = await exchange.fetchOrderBook (symbol) + log (orderbook) + + log ('-------------------------------------------------------------------') + + const trades = await exchange.fetchTrades (symbol) + log (table (trades.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + // private API + + if (exchange.checkRequiredCredentials (false)) { + + const balance = await exchange.fetchBalance () + log (exchange.omit (balance, [ 'info' ])) + + log ('-------------------------------------------------------------------') + + const order = await exchange.createOrder (symbol, 'limit', 'buy', 0.001, 10000) + log (order) + + log ('-------------------------------------------------------------------') + + const openOrders = await exchange.fetchOpenOrders (symbol) + log (table (openOrders.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const canceled = await exchange.cancelOrder (order['id'], order['symbol']) + log (canceled) + + log ('-------------------------------------------------------------------') + + const closedOrders = await exchange.fetchClosedOrders (symbol) + log (table (closedOrders.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const canceledOrders = await exchange.fetchCanceledOrders (symbol) + log (table (canceledOrders.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + log ('-------------------------------------------------------------------') + + const myTrades = await exchange.fetchMyTrades (symbol) + log (table (myTrades.map (x => exchange.omit (x, [ 'info', 'timestamp' ])))) + + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/live-orderbook.md b/docs/ccxt/wiki/examples/js/live-orderbook.md new file mode 100644 index 0000000..64474ee --- /dev/null +++ b/docs/ccxt/wiki/examples/js/live-orderbook.md @@ -0,0 +1,111 @@ +- [Live Orderbook](./examples/js/) + + + ```javascript + + +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'exchange'.green, 'symbol'.yellow, 'depth'.cyan) + printSupportedExchanges () +} + +let printOrderBook = async (id, symbol, depth) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] () + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + // output a list of all market symbols + // log (id.green, 'has', exchange.symbols.length, 'symbols:', exchange.symbols.join (', ').yellow) + + if (symbol in exchange.markets) { + + const market = exchange.markets[symbol] + const pricePrecision = market.precision ? market.precision.price : 8 + const amountPrecision = market.precision ? market.precision.amount : 8 + + // Object.values (markets).forEach (market => log (market)) + + // make a table of all markets + // const table = asTable.configure ({ delimiter: ' | ' }) (Object.values (markets)) + // log (table) + + const priceVolumeHelper = color => ([price, amount]) => ({ + price: price.toFixed (pricePrecision)[color], + amount: amount.toFixed (amountPrecision)[color], + ' ': ' ', + }) + + const cursorUp = '\u001b[1A' + const tableHeight = depth * 2 + 4 // bids + asks + headers + + log (' ') // empty line + + while (true) { + + const orderbook = await exchange.fetchOrderBook (symbol) + + log (symbol.green, exchange.iso8601 (exchange.milliseconds ())) + + log (asTable.configure ({ delimiter: ' | '.dim, right: true }) ([ + ... orderbook.asks.slice (0, depth).reverse ().map (priceVolumeHelper ('red')), + // { price: '--------'.dim, amount: '--------'.dim }, + ... orderbook.bids.slice (0, depth).map (priceVolumeHelper ('green')), + ])) + + log (cursorUp.repeat (tableHeight)) + } + + } else { + + log.error ('Symbol', symbol.bright, 'not found') + } + + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 4) { + + const id = process.argv[2] + const symbol = process.argv[3].toUpperCase () + const depth = parseInt (process.argv[4]) + await printOrderBook (id, symbol, depth) + + } else { + + printUsage () + } + + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/live-ticker.md b/docs/ccxt/wiki/examples/js/live-ticker.md new file mode 100644 index 0000000..058d2a9 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/live-ticker.md @@ -0,0 +1,85 @@ +- [Live Ticker](./examples/js/) + + + ```javascript + + +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'exchange'.green, 'symbol'.yellow, '[rateLimit]'.magenta) + printSupportedExchanges () +} + +let printTicker = async (id, symbol, rateLimit = undefined) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] () + + exchange.rateLimit = rateLimit ? rateLimit : exchange.rateLimit + + log.green ('Rate limit:', exchange.rateLimit.toString ().bright) + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + if (symbol in exchange.markets) { + + while (true) { + + const ticker = await exchange.fetchTicker (symbol) + + log ('--------------------------------------------------------') + log (exchange.id.green, symbol.yellow, exchange.iso8601 (exchange.milliseconds ())) + log (ccxt.omit (ticker, 'info')) + } + + } else { + + log.error ('Symbol', symbol.bright, 'not found') + } + + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 3) { + + const id = process.argv[2] + const symbol = process.argv[3].toUpperCase () + const rateLimit = process.argv[4] ? parseInt (process.argv[4]) : undefined + await printTicker (id, symbol, rateLimit) + + } else { + + printUsage () + } + + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/live-tickers.md b/docs/ccxt/wiki/examples/js/live-tickers.md new file mode 100644 index 0000000..b6ab824 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/live-tickers.md @@ -0,0 +1,79 @@ +- [Live Tickers](./examples/js/) + + + ```javascript + + +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +ansicolor.nice + +const { noLocate } = ololog; +const log = noLocate; + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'exchange'.green) + printSupportedExchanges () +} + +let printTickers = async (id) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] () + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + while (true) { + + const tickers = await exchange.fetchTickers () + + log ('--------------------------------------------------------') + log (exchange.id.green, exchange.iso8601 (exchange.milliseconds ())) + log ('Fetched', Object.values (tickers).length.toString ().green, 'tickers:') + log (asTable.configure ({ delimiter: ' | '.dim, right: true }) ( + ccxt.sortBy (Object.values (tickers), 'quoteVolume', true) + .slice (0,20) + .map (ticker => ({ + symbol: ticker['symbol'], + price: ticker['last'].toFixed (8), + datetime: ticker['datetime'], + })))) + } + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 2) { + + const id = process.argv[2] + await printTickers (id) + + } else { + + printUsage () + } + + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/load-all-contracts.md b/docs/ccxt/wiki/examples/js/load-all-contracts.md new file mode 100644 index 0000000..87c2eeb --- /dev/null +++ b/docs/ccxt/wiki/examples/js/load-all-contracts.md @@ -0,0 +1,46 @@ +- [Load All Contracts](./examples/js/) + + + ```javascript + "use strict"; + +const ccxt = require ('../../js/ccxt.js') + +console.log ('CCXT Version:', ccxt.version) + +async function loadExchange (exchange) { + try { + await exchange.loadMarkets () + exchange.symbols.map (symbol => { + const market = exchange.market (symbol) + if (market['contract']) { + console.log (exchange.id, 'loaded', market['type'], symbol, 'market') + } + }) + } catch (e) { + console.log (e.constructor.name, e.message) + } +} + +async function loadAllExchanges (exchangeId) { + try { + + const exchanges = []; + [ 'swap', 'future', 'options' ].forEach (defaultType => { + const exchange = new ccxt[exchangeId]() + if (exchange.has[defaultType]) { + exchanges.push (exchange); + } + }) + await Promise.all (exchanges.map (exchange => loadExchange (exchange))) + } catch (e) { + console.log (e.constructor.name, e.message) + } +} + +async function main () { + await Promise.all (ccxt.exchanges.map (exchangeId => loadAllExchanges (exchangeId))) +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/load-all-symbols-at-once.md b/docs/ccxt/wiki/examples/js/load-all-symbols-at-once.md new file mode 100644 index 0000000..a215023 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/load-all-symbols-at-once.md @@ -0,0 +1,75 @@ +- [Load All Symbols At Once](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +//----------------------------------------------------------------------------- + +let test = async function (exchange) { + + try { + + await exchange.loadMarkets () + log (exchange.id.green, 'loaded', exchange.symbols.length.toString ().bright.green, 'symbols') + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection) { + log.bright.yellow (exchange.id, '[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id, '[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id, '[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id, '[Exchange Not Available] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id, '[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow (exchange.id, '[Network Error] ' + e.message) + } else { + throw e + } + } +} + +//----------------------------------------------------------------------------- + +let exchanges = [] + +async function main () { + + // instantiate all exchanges + await Promise.all (ccxt.exchanges.map (async id => { + let exchange = new (ccxt)[id] () + exchanges.push (exchange) + await test (exchange) + })) + + let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green + let failed = exchanges.filter (exchange => exchange.markets ? false : true).length + let total = ccxt.exchanges.length.toString ().bright.white + let numSymbols = 0; + exchanges.map (exchange => { + numSymbols += exchange.symbols ? exchange.symbols.length : 0; + }) + log (numSymbols, 'symbols from', succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) + +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/load-all-tickers-at-once.md b/docs/ccxt/wiki/examples/js/load-all-tickers-at-once.md new file mode 100644 index 0000000..8edfaa7 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/load-all-tickers-at-once.md @@ -0,0 +1,97 @@ +- [Load All Tickers At Once](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +//----------------------------------------------------------------------------- + +let human_value = function (price) { + return price === undefined ? 'N/A' : price +} + +//----------------------------------------------------------------------------- + +let test = async function (exchange, symbol) { + + try { + + await exchange.loadMarkets () + + if (symbol in exchange.markets) { + + let ticker = await exchange.fetchTicker (symbol) + + log (exchange.id.green, symbol.green, 'ticker', + ticker['datetime'], + 'high: ' + human_value (ticker['high']), + 'low: ' + human_value (ticker['low']), + 'bid: ' + human_value (ticker['bid']), + 'ask: ' + human_value (ticker['ask']), + 'volume: ' + human_value (ticker['quoteVolume'])) + } else { + + // do nothing or throw an error + log.bright.yellow (exchange.id + ' does not have ' + symbol) + } + + } catch (e) { + + if (e instanceof ccxt.DDoSProtection) { + log.bright.yellow (exchange.id, '[DDoS Protection]') + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id, '[Request Timeout]') + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id, '[Authentication Error]') + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id, '[Exchange Not Available]') + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id, '[Exchange Error]') + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow (exchange.id, '[Network Error]') + } else { + throw e + } + } +} + +//----------------------------------------------------------------------------- + +const symbol = 'BTC/USD' + +//----------------------------------------------------------------------------- + +async function main () { + + let exchanges = [] + + // instantiate all exchanges + await Promise.all (ccxt.exchanges.map (async id => { + let exchange = new (ccxt)[id] () + exchanges.push (exchange) + await test (exchange, symbol) + })) + + let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green + let failed = exchanges.filter (exchange => exchange.markets ? false : true).length + let total = ccxt.exchanges.length.toString ().bright.white + console.log (succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/load-markets-to-files.md b/docs/ccxt/wiki/examples/js/load-markets-to-files.md new file mode 100644 index 0000000..436ddac --- /dev/null +++ b/docs/ccxt/wiki/examples/js/load-markets-to-files.md @@ -0,0 +1,63 @@ +- [Load Markets To Files](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import path from 'path'; +import fs from 'fs'; + +const enableRateLimit = true, + // exchange defaults + // ------------------------------------------------------------------------ + // path to your folder, for example '/myproject/markets' or 'C:/myproject/markets' + options = { enableRateLimit }, + // writes to current working directory if left empty + // ------------------------------------------------------------------------ + // use a reasonable value for maxConcurrency to avoid network congestion + // a burst of requests in a short period of time will cause + // excessive competition for networking resources within the application + folder = '', + maxConcurrency = 7; + +async function main () { + + const allExchanges = ccxt.exchanges.map (id => { + try { + return new ccxt[id] (options) + } catch (e) { + console.log ('Failed to initialize', id, e.constructor.name) + } + }).filter (x => x) + , allExchangesByIds = ccxt.indexBy (allExchanges, 'id') + , exchangeIds = Object.keys (allExchangesByIds) + + const load = async () => { + while (exchangeIds.length > 0) { + const id = exchangeIds.pop () + const exchange = allExchangesByIds[id] + const file = path.join (folder, `saved-markets-${exchange.id}.json`) + try { + await exchange.loadMarkets () + const { id, markets } = exchange + await writeFile (file, JSON.stringify ({ id, markets })) + console.log ('Loaded markets from', id, 'to', file) + } catch (e) { + console.log ('Failed to load markets from', id, 'to', file, e.constructor.name) + } + } + } + + const started = ccxt.milliseconds () + const loaders = Array (maxConcurrency).fill ().map (x => load ()) + await Promise.all (loaders) + const stopped = ccxt.milliseconds () + console.log ('Done loading', allExchanges.length, 'exchanges in', ((stopped - started) / 1000).toFixed (2), 'seconds') + + // other code... +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/looping-over-all-symbols-of-specific-exchanges.md b/docs/ccxt/wiki/examples/js/looping-over-all-symbols-of-specific-exchanges.md new file mode 100644 index 0000000..c1d9b55 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/looping-over-all-symbols-of-specific-exchanges.md @@ -0,0 +1,67 @@ +- [Looping Over All Symbols Of Specific Exchanges](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'); + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async () => { + + const exchanges = [ 'bittrex', 'poloniex', 'hitbtc2' ] + + for (let exchangeId of exchanges) { + + // create the exchange instance + const exchange = new ccxt[exchangeId] () + + // preload all markets first, as explained in the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { + + await exchange.loadMarkets (); + + } catch (e) { + + log.red ('Could not load markets from', exchange.id + ':', e.constructor.name, e.message) + + continue; // skip this exchange if markets failed to load + + } + + for (let symbol in exchange.markets) { + + console.log (exchange.id, symbol) + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { // try fetching the ticker for a symbol existing with that exchange + + const ticker = await exchange.fetchTicker (symbol) + log.green (ticker) + + } catch (e) { // catch the error (if any) and handle it or ignore it + + log.red ('Could not fetch', symbol, 'ticker from', exchange.id + ':', e.constructor.name, e.message) + + } + } + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/looping-over-specific-symbols-of-all-exchanges.md b/docs/ccxt/wiki/examples/js/looping-over-specific-symbols-of-all-exchanges.md new file mode 100644 index 0000000..0a5ebfe --- /dev/null +++ b/docs/ccxt/wiki/examples/js/looping-over-specific-symbols-of-all-exchanges.md @@ -0,0 +1,97 @@ +- [Looping Over Specific Symbols Of All Exchanges](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'); + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async () => { + + const exchanges = {}; + const symbols = [ 'ETH/BTC', 'XRP/BTC', 'BTC/USDT' ] + + for (let symbol of symbols) { + + for (let exchangeId of ccxt.exchanges) { + + let exchange = undefined + + try { // try creating the exchange instance first and handle errors if any + + // check if we have created an instance of this exchange already + + exchange = exchanges[exchangeId] + + if (exchange === undefined) { + + // create the exchange instance + exchange = new ccxt[exchangeId] () + } + + exchanges[exchangeId] = exchange // save it for later use + + } catch (e) { + + log.red ('Could not create exchange', exchangeId + ':', e.constructor.name, e.message) + + // uncomment the following line to interrupt program execution on error + // or leave it commented out to do nothing + + // process.exit () + + } + + if (exchange !== undefined) { + + // preload all markets first, as explained in the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { + + await exchange.loadMarkets (); + + } catch (e) { + + log.red ('Could not load markets from', exchange.id + ':', e.constructor.name, e.message) + continue; // skip this exchange if markets failed to load + + } + + for (let symbol of symbols) { + + console.log (exchange.id, symbol) + + // add error/exception handling as required by the Manual: + // https://github.com/ccxt/ccxt/wiki/Manual#error-handling + + try { // try fetching the ticker for a symbol existing with that exchange + + const ticker = await exchange.fetchTicker (symbol) + log.green (ticker) + + } catch (e) { // catch the error (if any) and handle it or ignore it + + log.red ('Could not fetch', symbol, 'ticker from', exchange.id + ':', e.constructor.name, e.message) + + } + } + } + } + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/margin-loan-borrow-buy-sell-repay.md b/docs/ccxt/wiki/examples/js/margin-loan-borrow-buy-sell-repay.md new file mode 100644 index 0000000..4a3275e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/margin-loan-borrow-buy-sell-repay.md @@ -0,0 +1,76 @@ +- [Margin Loan Borrow Buy Sell Repay](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// Note, this is just an example and might not yet work on other exchanges, which are being still unified. +async function example() { + // ########## user inputs ########## + const exchange = new ccxt['binance']({ 'apiKey': 'xxx', 'secret': 'xxx' }); + const symbol = 'BUSD/USDT'; // set target symbol + const marginMode = 'isolated'; // margin mode (cross or isolated) + const collateral_coin = 'USDT'; // which asset you want to use for margin-borrow collateral + const borrow_coin = 'BUSD'; // which coin to borrow + const order_side = 'sell'; // which side to trade + const amount_to_trade = 14; // how many coins to sell + const order_type = 'limit'; // order type (can be market, limit or etc) + const limit_price = 0.99; // price to sell at (set undefined/null/None if market-order) + const margin_magnitude = 5; // target margin (aka 'leverage'). This might also be obtainable using other unified methods, but for example purposes, we set here manually + // ########## end of user-inputs ########## + // + // for example purposes, let's also check available balance at first + const balance_margin = await exchange.fetchBalance({ 'defaultType': 'margin', 'marginMode': marginMode }); // use `defaultType` because of temporary bug, otherwise, after several days, you can use `type` too. + // if we don't have enought coins, then we have to borrow at first + let needed_amount_to_borrow = undefined; // will be auto-set below + if (amount_to_trade > balance_margin[symbol][borrow_coin]['free']) { + needed_amount_to_borrow = amount_to_trade - balance_margin[symbol][borrow_coin]['free']; + console.log('hmm, I have only ', balance_margin[symbol][borrow_coin]['free'], ' ', borrow_coin, ' in margin balance, and still need additional ', needed_amount_to_borrow, ' to make an order. Lets borrow it.'); + // To initate a borrow, at first, check if we have enough collateral (for this example, as we make a sell-short, we need '-1' to keep for collateral currency) + const needed_collateral_amount = needed_amount_to_borrow / (margin_magnitude - 1); + // Check if we have any collateral to get permission for borrow + if (balance_margin[symbol][collateral_coin]['free'] < needed_collateral_amount) { + // If we don't have enough collateral, then let's try to transfer collateral-asset from spot-balance to margin-balance + console.log('hmm, I have only ', balance_margin[symbol][collateral_coin]['free'], ' in balance, but ', needed_collateral_amount, ' collateral is needed. I should transfer ', needed_collateral_amount, ' from spot'); + // let's check if we have spot balance at all + const balance_spot = await exchange.fetchBalance({ 'type': 'spot' }); + if (exchange.parseNumber(balance_spot[collateral_coin]['free']) < needed_collateral_amount) { + console.log('hmm, I neither do have enough balance on spot - only ', balance_spot[collateral_coin]['free'], '. Script can not continue...'); + return; + } + else { + console.log('Transferring ', needed_collateral_amount, ' to margin account'); + await exchange.transfer(collateral_coin, needed_collateral_amount, 'spot', marginMode, { 'symbol': symbol }); + } + } + // now, as we have enough margin collateral, initiate borrow + console.log('Initiating margin borrow of ', needed_amount_to_borrow, ' ', borrow_coin); + const borrowResult = await exchange.borrowMargin(borrow_coin, needed_amount_to_borrow, symbol, { 'marginMode': marginMode }); + } + console.log('Submitting order.'); + const order = await exchange.createOrder(symbol, order_type, order_side, amount_to_trade, limit_price, { 'marginMode': marginMode }); + console.log('Order was submitted !', order['id']); + // + // + // ... + // ... + // some time later, if you want to repay the loan back (like 'close the position')... + // ... + // ... + // + // + // set the "repay-back" amount (for this example snippet, this will be same amount that we borrowed above) + if (needed_amount_to_borrow !== undefined) { + const amount_to_repay_back = needed_amount_to_borrow; + // At first, you need to get back the borrowed coin, by making an opposide trade + console.log('Making purchase back of ', amount_to_repay_back, ' ', borrow_coin, ' to repay it back.'); + const purchase_back_price = 1.01; + const order_back = await exchange.createOrder(symbol, order_type, (order_side === 'buy' ? 'sell' : 'buy'), amount_to_repay_back, purchase_back_price, { 'marginMode': marginMode }); + console.log('Now, repaying the loan.'); + const repayResult = await exchange.repayMargin(borrow_coin, amount_to_repay_back, symbol, { 'marginMode': marginMode }); + console.log('finished.'); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/market-status-and-currency-status.md b/docs/ccxt/wiki/examples/js/market-status-and-currency-status.md new file mode 100644 index 0000000..85a999c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/market-status-and-currency-status.md @@ -0,0 +1,35 @@ +- [Market Status And Currency Status](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import log from 'ololog'; +import asTable from 'as-table'; + +(async function main () { + + let kraken = new ccxt.kraken () + await kraken.loadMarkets () + + const markets = Object.values (kraken.markets).map (market => ({ + symbol: market.symbol, + active: market.active, + })) + + log.bright.green.noLocate ('Markets:') + log.green.noLocate (asTable (markets), '\n') + + const currencies = Object.values (kraken.currencies).map (currency => ({ + code: currency.code, + active: currency.active, + status: currency.status, + })) + + log.bright.yellow.noLocate ('Currencies:') + log.yellow.noLocate (asTable (currencies)) + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/ohlcv-console-chart.md b/docs/ccxt/wiki/examples/js/ohlcv-console-chart.md new file mode 100644 index 0000000..5fbabbe --- /dev/null +++ b/docs/ccxt/wiki/examples/js/ohlcv-console-chart.md @@ -0,0 +1,34 @@ +- [Ohlcv Console Chart](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asciichart from 'asciichart'; +import asTable from 'as-table'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +;(async function main () { + + // experimental, not yet implemented for all exchanges + // your contributions are welcome ;) + + const indexOfClose = 4 // [ timestamp, open, high, low, close, volume ] + const ohlcv = await new ccxt.cex ().fetchOHLCV ('BTC/USD', '1m') + const lastPrice = ohlcv[ohlcv.length - 1][indexOfClose] // closing price + const plotSeriesData = ohlcv.slice (-80).map (x => x[indexOfClose]) // closing price + const bitcoinRate = ('₿ = $' + lastPrice).green + const chart = asciichart.plot (plotSeriesData, { height: 15, padding: ' ' }) + log.yellow ("\n" + chart, bitcoinRate, "\n") + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/okex-fetch-closed-orders-archive.md b/docs/ccxt/wiki/examples/js/okex-fetch-closed-orders-archive.md new file mode 100644 index 0000000..90bbb8c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/okex-fetch-closed-orders-archive.md @@ -0,0 +1,36 @@ +- [Okex Fetch Closed Orders Archive](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version:', ccxt.version) + +// https://github.com/ccxt/ccxt/issues/10179 + +async function main () { + + const exchange = new ccxt.okex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_PASSWORD', + 'options': { + 'fetchClosedOrders': { + 'method': 'privateGetTradeOrdersHistoryArchive' + } + } + }) + + const markets = await exchange.loadMarkets () + + exchange.verbose = true + + const orders = await exchange.fetchClosedOrders () + console.log (orders) + +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/okex-transfer.md b/docs/ccxt/wiki/examples/js/okex-transfer.md new file mode 100644 index 0000000..a170c9e --- /dev/null +++ b/docs/ccxt/wiki/examples/js/okex-transfer.md @@ -0,0 +1,56 @@ +- [Okex Transfer](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT version:', ccxt.version) +console.log ('This example requires CCXT version 1.54.92 or higher') + +async function main () { + + const exchange = new ccxt.okex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_API_KEY_PASSWORD', + }) + + await exchange.loadMarkets () + + const code = 'USDT' + let tradingBalance = await exchange.fetchFreeBalance (/* { 'type': 'trading' } */) + let fundingBalance = await exchange.fetchFreeBalance ({ 'type': 'funding' }) + console.log ('Trading:', tradingBalance[code], code) + console.log ('Funding:', fundingBalance[code], code) + + const oldVerboseMode = exchange.verbose + exchange.verbose = process.argv.includes ('--verbose') || process.argv.includes ('-v') + + // https://www.okex.com/docs-v5/en/#rest-api-funding-funds-transfer + // + // 'spot' == '1' + // 'futures' == '3', + // 'margin' == '5', + // 'swap' == '9', + // 'option' == '12', + // 'trading' == '18', // unified trading account + // 'unified' == '18', + // + const from = 'trading' + const to = 'funding' + const amount = 1 + const transfer = await exchange.transfer (code, amount, from, to) + console.log (transfer) + + exchange.verbose = oldVerboseMode + + tradingBalance = await exchange.fetchFreeBalance (/* { 'type': 'spot' } */) + fundingBalance = await exchange.fetchFreeBalance ({ 'type': 'funding' }) + console.log ('Trading:', tradingBalance[code], code) + console.log ('Funding:', fundingBalance[code], code) +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/okx-poll-fetch-my-trades.md b/docs/ccxt/wiki/examples/js/okx-poll-fetch-my-trades.md new file mode 100644 index 0000000..9a6f919 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/okx-poll-fetch-my-trades.md @@ -0,0 +1,42 @@ +- [Okx Poll Fetch My Trades](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js' + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.okx ({ + + // edit for your credentials + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + }) + + await exchange.loadMarkets () + + // if this script fails with a rate limiter error + // uncomment the following line for debugging purposes + + // exchange.verbose = true + + while (true) { + + try { + + const trades = await exchange.fetchMyTrades () + console.log (new Date(), 'fetched', trades.length, 'trades') + + } catch (e) { + + console.log (e.constructor.name, e.message) + break; + } + } +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/okx-poll-rate-limit.md b/docs/ccxt/wiki/examples/js/okx-poll-rate-limit.md new file mode 100644 index 0000000..242f6b9 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/okx-poll-rate-limit.md @@ -0,0 +1,54 @@ +- [Okx Poll Rate Limit](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js' + +console.log ('CCXT Version:', ccxt.version) + +async function main () { + + const exchange = new ccxt.okx ({ + + // edit for your credentials + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + + 'api': { + 'private': { + 'get': { + 'trade/fills-history': 2.2, + }, + }, + }, + + }) + + await exchange.loadMarkets () + + // if this script fails with a rate limiter error + // uncomment the following line for debugging purposes + + // exchange.verbose = true + + const promises=[]; + for(let i=0;i<100;i++){ + promises.push(exchange.fetchMyTrades()); + } + + const allResponses = await Promise.allSettled(promises); + allResponses.forEach((result, i) => { + + if(result.status == "fulfilled"){ + console.log (new Date(), i + 6, 'fetched', result.value.length, 'trades') + } else { + console.log ("Rejected:", i + 6, result.reason); + } + }); + +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/order-book-extra-level-depth-param.md b/docs/ccxt/wiki/examples/js/order-book-extra-level-depth-param.md new file mode 100644 index 0000000..47cf469 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/order-book-extra-level-depth-param.md @@ -0,0 +1,25 @@ +- [Order Book Extra Level Depth Param](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import log from 'ololog'; +import ansicolor from 'ansicolor'; + +ansicolor.nice + +;(async function test () { + + const exchange = new ccxt.bitfinex () + const limit = 5 + const orders = await exchange.fetchOrderBook ('BTC/USD', limit, { + // this parameter is exchange-specific, all extra params have unique names per exchange + 'group': 1, // 1 = orders are grouped by price, 0 = orders are separate + }) + + log (orders) +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/phemex-create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/js/phemex-create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..6f23da6 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/phemex-create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,55 @@ +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/js/) + + + ```javascript + // @ts-nocheck +import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// ------------------------------------------------------------------------------ +async function example() { + const exchange = new ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + const symbol = 'XRP/USDT:USDT'; + const side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'limit'; // set it to 'market' or 'limit' + const amount = 1; // how many contracts + const price = 0.5; // set a price at your desired level + // take profit and stop loss prices and types + const take_profit_trigger_price = 0.6; + const stop_loss_trigger_price = 0.4; + const take_profit_limit_price = 0.7; + const stop_loss_limit_price = 0.3; + await exchange.loadMarkets(); + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'posSide': 'Long', + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + 'type': 'limit', + 'price': stop_loss_limit_price, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + 'type': 'limit', + 'price': take_profit_limit_price, + }, + }; + console.log('-----------------------------------------------------------------------'); + // exchange.verbose = True // uncomment for debugging purposes if necessary + try { + const created_order = await exchange.createOrder(symbol, order_type, side, amount, price, params); + console.log('Created an order', created_order); + // Fetch all your open orders for this symbol + const all_open_orders = await exchange.fetchOpenOrders(symbol); + console.log('Fetched all your orders for this symbol', all_open_orders); + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } + catch (e) { + console.log(e.toString()); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/poll-ohlcv.md b/docs/ccxt/wiki/examples/js/poll-ohlcv.md new file mode 100644 index 0000000..dd2271b --- /dev/null +++ b/docs/ccxt/wiki/examples/js/poll-ohlcv.md @@ -0,0 +1,48 @@ +- [Poll Ohlcv](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; + +const ohlcvsBySymbol = {} + +function handleAllOHLCVs (exchange, ohlcvs, symbol, timeframe) { + console.log ('----------------------------------------------------------') + console.log ('Last updated:', exchange.iso8601 (exchange.milliseconds ())) + const symbols = Object.keys (ohlcvsBySymbol) + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i] + const ohlcvs = ohlcvsBySymbol[symbol] + const lastCandle = exchange.safeValue (ohlcvs, ohlcvs.length - 1) + const lastTimestamp = lastCandle[0] + console.log (exchange.iso8601 (lastTimestamp), symbol, timeframe, lastCandle.slice (1)) + } +} + +async function pollOHLCV (exchange, symbol, timeframe) { + while (true) { + try { + const response = await exchange.fetchOHLCV (symbol, timeframe) + ohlcvsBySymbol[symbol] = response + handleAllOHLCVs(exchange, response, symbol, timeframe) + } catch (e) { + console.log (e.constructor.name, e.message) + } + } +} + +async function main () { + + const exchange = new ccxt.binance() + const markets = await exchange.loadMarkets () + const timeframe = '5m' + + const firstOneHundredSymbols = exchange.symbols.slice (0, 100) + + await Promise.all (firstOneHundredSymbols.map (symbol => pollOHLCV (exchange, symbol, timeframe))) +} + +main () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/poloniex-fetch-order-books.md b/docs/ccxt/wiki/examples/js/poloniex-fetch-order-books.md new file mode 100644 index 0000000..8f21b61 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/poloniex-fetch-order-books.md @@ -0,0 +1,41 @@ +- [Poloniex Fetch Order Books](./examples/js/) + + + ```javascript + + +// ---------------------------------------------------------------------------- + +import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- + +(async () => { + + const exchange = new ccxt.poloniex ({ + 'verbose': process.argv.includes ('--verbose'), + 'timeout': 60000, + }) + + try { + + const response = await exchange.fetchOrderBooks ([ + 'ETH/BTC', + 'LTC/BTC', + 'OMG/BTC', + ]) + console.log (response); + console.log ('Succeeded.') + + } catch (e) { + + console.log ('--------------------------------------------------------') + console.log (e.constructor.name, e.message) + console.log ('--------------------------------------------------------') + console.log (exchange.last_http_response) + console.log ('Failed.') + } + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/poloniex-limits-amount-min.md b/docs/ccxt/wiki/examples/js/poloniex-limits-amount-min.md new file mode 100644 index 0000000..5a8582c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/poloniex-limits-amount-min.md @@ -0,0 +1,67 @@ +- [Poloniex Limits Amount Min](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +import fs from 'fs'; +import ololog from 'ololog' + +const log = ololog.configure.unlimited.noLocate, + verbose = process.argv.includes ('--verbose'), + keysGlobal = 'keys.json', + keysLocal = 'keys.local.json', + keysFile = fs.existsSync (keysLocal) ? keysLocal : (fs.existsSync (keysGlobal) ? keysGlobal : false), + config = keysFile ? require ('../../' + keysFile) : {}, + exchange = new ccxt.poloniex (ccxt.extend ({ + enableRateLimit: true, + verbose, + }, config.poloniex || {}));(async () => { + + const test = async function (symbol) { + + try { + + await exchange.createOrder (symbol, 'limit', 'buy', 0, 0) + + } catch (e) { + + if (e instanceof ccxt.InvalidOrder) { + + const words = e.message.split (' ') + let minAmount = parseFloat (words[words.length - 1]) + log.green ("'" + symbol + "': " + minAmount.toString () + ',') + + } else { + + throw e + } + } + } + + await exchange.loadMarkets () + + for (let i = 0; i < exchange.symbols.length; i++) { + + try { + + await test (exchange.symbols[i]) + + } catch (e) { + + if (e instanceof ccxt.InvalidNonce) { + + log.yellow (e) + + } else { + + log.red (e) + throw e + } + } + + + await ccxt.sleep (5000) // sleep 5 seconds, no rush, safe delay + } + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/proxy-round-robin.md b/docs/ccxt/wiki/examples/js/proxy-round-robin.md new file mode 100644 index 0000000..c710d0c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/proxy-round-robin.md @@ -0,0 +1,104 @@ +- [Proxy Round Robin](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +// this script loads markets from all exchanges +// if it cannot connect to an exchange, it falls back to an alternative route via proxy +// it will retry to load a exchange until it either reaches the exchange or runs out of proxies + +//----------------------------------------------------------------------------- + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +//----------------------------------------------------------------------------- + +let loadExchange = async exchange => { + await exchange.loadMarkets () + log (exchange.id.green, 'loaded', + exchange.symbols.length.toString ().bright.green, 'symbols', + (exchange.proxy ? exchange.proxy : '_').blue) +} + +//----------------------------------------------------------------------------- + +let tryAllProxies = async function (exchange, proxies) { + + let currentProxy = 0 + let maxRetries = proxies.length + + // a special case for ccex + if (exchange.id == 'ccex') + currentProxy = 1 + + for (let numRetries = 0; numRetries < maxRetries; numRetries++) { + + try { + + exchange.proxy = proxies[currentProxy] + await loadExchange (exchange) + break + + } catch (e) { + + currentProxy = ++currentProxy % proxies.length + if (e instanceof ccxt.DDoSProtection) { + log.bright.yellow (exchange.id, '[DDoS Protection] ' + e.message) + } else if (e instanceof ccxt.RequestTimeout) { + log.bright.yellow (exchange.id, '[Request Timeout] ' + e.message) + } else if (e instanceof ccxt.AuthenticationError) { + log.bright.yellow (exchange.id, '[Authentication Error] ' + e.message) + } else if (e instanceof ccxt.ExchangeNotAvailable) { + log.bright.yellow (exchange.id, '[Exchange Not Available] ' + e.message) + } else if (e instanceof ccxt.ExchangeError) { + log.bright.yellow (exchange.id, '[Exchange Error] ' + e.message) + } else if (e instanceof ccxt.NetworkError) { + log.bright.yellow (exchange.id, '[Network Error] ' + e.message) + } else { + throw e; + } + } + + } +} + +//----------------------------------------------------------------------------- + +let proxies = [ + '', + 'https://cors-anywhere.herokuapp.com/', + 'https://crossorigin.me/', +] + +let exchanges = [] + +async function main () { + // instantiate all exchanges + await Promise.all (ccxt.exchanges.map (async id => { + let exchange = new (ccxt)[id] () + exchanges.push (exchange) + await tryAllProxies (exchange, proxies) + })) + + let succeeded = exchanges.filter (exchange => exchange.markets ? true : false).length.toString ().bright.green + let failed = exchanges.filter (exchange => exchange.markets ? false : true).length + let total = ccxt.exchanges.length.toString ().bright.white + console.log (succeeded, 'of', total, 'exchanges loaded', ('(' + failed + ' errors)').red) +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/proxy-usage.md b/docs/ccxt/wiki/examples/js/proxy-usage.md new file mode 100644 index 0000000..f4a0bf7 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/proxy-usage.md @@ -0,0 +1,46 @@ +- [Proxy Usage](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// 1) ABOUT CCXT PROXIES, READ MORE AT: https://docs.ccxt.com/#/README?id=proxy +// 2) in python, uncomment the below: +// if sys.platform == 'win32': +// asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) +async function example_proxyUrl() { + const myEx = new ccxt.kucoin(); + myEx.proxyUrl = 'http://188.245.226.105:8090/proxy_url.php?caller=https://ccxt.com&url='; + console.log(await myEx.fetch('https://api.ipify.org/')); +} +async function example_httpProxy() { + const myEx = new ccxt.kucoin(); + myEx.httpProxy = 'http://188.245.226.105:8911'; // "httpProxy" or "httpsProxy" (depending on your proxy protocol) + console.log(await myEx.fetch('https://api.ipify.org/')); +} +async function example_socksProxy() { + const myEx = new ccxt.kucoin(); + myEx.socksProxy = 'socks5://127.0.0.1:1080'; // from protocols: socks, socks5, socks5h + console.log(await myEx.fetch('https://api.ipify.org/')); +} +async function example_webSockets() { + const myEx = new ccxt.pro.kucoin(); + myEx.httpProxy = 'http://188.245.226.105:8911'; // even though you are using WebSockets, you might also need to set up proxy for the exchange's REST requests + myEx.wsProxy = 'http://188.245.226.105:8911'; // "wsProxy" or "wssProxy" or "wsSocksProxy" (depending on your proxy protocol) + await myEx.loadMarkets(); + // + // To ensure your WS proxy works, uncomment below code and watch the log + // + // myEx.verbose = true; + // await myEx.loadHttpProxyAgent (); + // await myEx.watch ('ws://188.245.226.105:9876/', 'myip'); // in the incoming logs, confirm that you see the proxy IP in "hello" message + // + console.log(await myEx.watchTicker('BTC/USDT')); + await myEx.close(); +} +// await example_proxyUrl (); +await example_httpProxy(); +// await example_socksProxy (); +// await example_webSockets (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/sample-local-proxy-server-with-cors.md b/docs/ccxt/wiki/examples/js/sample-local-proxy-server-with-cors.md new file mode 100644 index 0000000..72e38a9 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/sample-local-proxy-server-with-cors.md @@ -0,0 +1,18 @@ +- [Sample Local Proxy Server With Cors](./examples/js/) + + + ```javascript + // @ts-nocheck +// JavaScript sample Proxy with CORS support +// Save this in a file like cors.js and run with: +// node cors [port] +// It will listen for your requests on the port you pass in command line (or port 8080 by default) +import cors from 'cors-anywhere'; // npm install cors-anywhere +const port = (process.argv.length > 2) ? parseInt(process.argv[2]) : 8080; // if not provided from cli, default to 8080 +cors.createServer({ +// you can set origin, if needed by exchange +// setHeaders: { 'origin': 'https://www.bitmex.com' } +}).listen(port, 'localhost'); +console.log('Running CORS Anywhere on localhost:' + port); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/search-all-exchanges.md b/docs/ccxt/wiki/examples/js/search-all-exchanges.md new file mode 100644 index 0000000..1f7307c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/search-all-exchanges.md @@ -0,0 +1,172 @@ +- [Search All Exchanges](./examples/js/) + + + ```javascript + import asTable from 'as-table'; +import ololog from 'ololog'; +import path from 'path'; +import fs from 'fs'; +import ansicolor from 'ansicolor'; +import ccxt from '../../js/ccxt.js'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice +/* ------------------------------------------------------------------------ */ + +const [processPath, , argument = null] = process.argv.filter (x => !x.startsWith ('--')) + , verbose = process.argv.includes ('--verbose') + , strict = process.argv.includes ('--strict') + , detailed = process.argv.includes ('--detailed') || process.argv.includes ('-v') + , debug = process.argv.includes ('--debug') + , marketsOnly = process.argv.includes ('--markets') + , currenciesOnly = process.argv.includes ('--currencies') + +/* ------------------------------------------------------------------------ */ + +const warn = log.bright.yellow.error // .error → stderr + +/* ------------------------------------------------------------------------ */ + +process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) +process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) + +/* ------------------------------------------------------------------------ */ + +let printUsage = function () { + log (' Non-strict search: node', process.argv[1], 'symbol'.green) + log (' Non-strict search: node', process.argv[1], 'currency'.green) + log (' Strict search: node', process.argv[1], '--strict', 'argument'.green) + log (' Search markets only: node', process.argv[1], '--markets', 'argument'.green) + log ('Search currencies only: node', process.argv[1], '--currencies', 'argument'.green) + +} + +if (process.argv.length < 3) { + printUsage () + process.exit () +} + +/* ------------------------------------------------------------------------ */ + +const keysGlobal = path.resolve ('keys.json') +const keysLocal = path.resolve ('keys.local.json') +let globalKeysFile = fs.existsSync (keysGlobal) ? keysGlobal : false +let localKeysFile = fs.existsSync (keysLocal) ? keysLocal : globalKeysFile + +const keys = JSON.parse (fs.readFileSync (localKeysFile)) + +/* ------------------------------------------------------------------------ */ + +log ('Looking up for:', argument.bright, strict ? '(strict search)' : '(non-strict search)') + +const checkAgainst = strict ? + (a, b) => (a.toString () || '').toUpperCase ().includes ((b.toString () || '').toUpperCase ()) : + (a, b) => (a.toString () || '').toLowerCase ().includes ((b.toString () || '').toLowerCase ()) + +;(async function test () { + + let exchanges = await Promise.all (ccxt.exchanges.map (async id => { + + // instantiate the exchange + let exchange = new ccxt[id] (ccxt.extend (localKeysFile ? (keys[id] || {}) : {}, { + // agent, // set up keys and settings, if any + })) + + if (exchange.has.fetchMarkets) { + + try { + + // load markets + await exchange.loadMarkets () + return exchange + + } catch (e) { + + if (debug) { + log.red (exchange.id, e.constructor.name) + } + return undefined + } + } + })) + + // filter out exchanges that failed to load + exchanges = exchanges.filter (exchange => exchange) + + if (!currenciesOnly) { + + log ("---------------------------------------------------------------") + + log ("Markets And Symbols:") + + let markets = ccxt.flatten (exchanges + .map (exchange => + Object.values (exchange.markets).map (market => + exchange.extend (market, { + exchange: exchange.id[(market.active !== false) ? 'green' : 'yellow'], + })))) + .filter (market => { + try { + return ( + checkAgainst (market['base'], argument) || + checkAgainst (market['quote'], argument) || + (market['baseId'] ? checkAgainst (market['baseId'].toString (), argument) : false) || + (market['quoteId'] ? checkAgainst (market['quoteId'].toString (), argument) : false) || + checkAgainst (market['symbol'], argument) || + checkAgainst (market['id'].toString (), argument) || + checkAgainst (market['type'], argument) + ) + } catch (e) { + if (debug) { + log.red (e.constructor.name, e.message) + } + return false + } + }) + + log (asTable (markets.map (market => { + market = ccxt.omit (market, [ 'info', 'limits', 'precision', 'tiers' ]) + return (detailed) ? market : { + 'symbol': market['symbol'], + 'exchange': market['exchange'], + }; + }))) + + log (markets.length.toString ().yellow, 'markets') + } + + if (!marketsOnly) { + + log ("---------------------------------------------------------------") + + log ("Currencies:") + + let currencies = ccxt.flatten (exchanges + .map (exchange => + Object.values (exchange.currencies).map (currency => + exchange.extend (currency, { + exchange: exchange.id[(currency.active !== false) ? 'green' : 'yellow'], + })))) + .filter (currency => ( + checkAgainst (currency['code'], argument) || + checkAgainst (currency['id'], argument) + )) + + log (asTable (currencies.map (currency => { + currency = ccxt.omit (currency, [ 'info', 'limits', 'precision' ]) + return (detailed) ? currency : { + 'code': currency['code'], + 'exchange': currency['exchange'], + }; + }))) + + log (currencies.length.toString ().yellow, 'currencies') + } + + process.exit () + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/shared-load-markets.md b/docs/ccxt/wiki/examples/js/shared-load-markets.md new file mode 100644 index 0000000..8d2af17 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/shared-load-markets.md @@ -0,0 +1,86 @@ +- [Shared Load Markets](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// ---------------------------------------------------------------------------- +// an example of how to load markets for each exchange just once +// in order to save memory and time for initializing multiple exchange instances +// see https://github.com/ccxt/ccxt/issues/7312 for details +// ---------------------------------------------------------------------------- + +const globalIds = [ 'binance', 'poloniex', 'bittrex', 'bitstamp' ] +const globalExchanges = {} + +async function loadExchange (id) { + try { + const exchange = new ccxt[id] () + await exchange.loadMarkets () + globalExchanges[id] = exchange + } catch (e) { + // throw e // uncomment to break the entire program on any error + // console.log (e) // print the exception and ignore this exchange + } +} + +async function main () { + + // initialize unique global exchange instances first + await Promise.all (globalIds.map (async (id) => loadExchange (id))) + console.log ('Loaded global exchanges:', Object.keys (globalExchanges)) + + // load user exchanges and keys from a database or configure these via JSON + const users = { + 'user1': { + 'binance': { 'apiKey': 'USER1_BINANCE_API_KEY', 'secret': 'USER1_BINANCE_SECRET' }, + 'poloniex': { 'apiKey': 'USER1_POLONIEX_API_KEY', 'secret': 'USER1_POLONIEX_SECRET' } + }, + 'user2': { + 'poloniex': { 'apiKey': 'USER2_POLONIEX_API_KEY', 'secret': 'USER2_POLONIEX_SECRET' }, + 'bittrex': { 'apiKey': 'USER2_BITTREX_API_KEY', 'secret': 'USER2_BITTREX_SECRET' } + }, + 'user3': { + 'bittrex': { 'apiKey': 'USER3_BITTREX_API_KEY', 'secret': 'USER3_BITTREX_SECRET' }, + 'bitstamp': { 'apiKey': 'USER3_BITSTAMP_API_KEY', 'secret': 'USER3_BITSTAMP_SECRET' } + } + } + + // initialize local exchanges per user + const localExchanges = {} + for (const userId in users) { + const userExchanges = {} + for (const exchangeId in users[userId]) { + if (exchangeId in globalExchanges) { + const globalExchange = globalExchanges[exchangeId] + const exchange = new ccxt[exchangeId] ({ + // 'verbose': true, // uncomment for debug output + ... users[userId][exchangeId], + }); + [ + 'ids', + 'markets', + 'markets_by_id', + 'currencies', + 'currencies_by_id', + 'baseCurrencies', + 'quoteCurrencies', + 'symbols', + ].forEach ((propertyName) => { + exchange[propertyName] = globalExchange[propertyName] + }) + userExchanges[exchangeId] = exchange + } + } + localExchanges[userId] = userExchanges + } + + // print the loaded exchanges per user + for (const userId in localExchanges) { + console.log ('Loaded', userId, Object.keys (localExchanges[userId])) + } +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/sort-swap-markets-by-hourly-price-change.md b/docs/ccxt/wiki/examples/js/sort-swap-markets-by-hourly-price-change.md new file mode 100644 index 0000000..8f3d9ad --- /dev/null +++ b/docs/ccxt/wiki/examples/js/sort-swap-markets-by-hourly-price-change.md @@ -0,0 +1,61 @@ +- [Sort Swap Markets By Hourly Price Change](./examples/js/) + + + ```javascript + 'use strict'; + +const ccxt = require ('../../js/ccxt.js'); + +const exchange = new ccxt.binanceusdm (); +const timeframe = '1h'; +const type = 'swap'; + +async function fetchOHLCV (symbol) { + /** + * @description Wrapper around exchange.fetchOHLCV method + * @param {string} symbol CCXT unified symbol + * @returns {[float|str]} 1d array with a single ohlcv record with the market symbol appended + */ + try { + const ohlcv = await exchange.fetchOHLCV (symbol, timeframe, undefined, 1); + ohlcv[0].push (symbol); + return ohlcv[0]; + } catch (err) { + console.log (symbol + ' failed fetchOHLCV with error ' + err) + } +} + +function getPriceChangePercent (ohlcv) { + /** + * @description Gets the price change of a market as a percentage + * @param {[float]} ohlcv A single ohlcv record with the market symbol appended + * @returns {[float, str]} The price change as a percent with the symbol for the market + */ + const open = ohlcv[1]; + const close = ohlcv[4]; + const symbol = ohlcv[6]; + const priceIncrease = close - open; + const increaseAsRatio = priceIncrease / open; + const increaseAsPercent = increaseAsRatio * 100; + return [increaseAsPercent, symbol] +} + +function sort (a, b) { + return a[0] - b[0]; +} + +async function main () { + /** + * @description Gets the price change as a percent of every market matching type over the last timeframe matching timeframe and prints a sorted list. The most immediate candle is ignored because it is incomplete + */ + await exchange.loadMarkets (); + const allSwapSymbols = exchange.symbols.filter (symbol => exchange.market (symbol)[type] ); + const ohlcvs = await Promise.all (allSwapSymbols.map (symbol => fetchOHLCV (symbol))); + const priceChanges = ohlcvs.map (ohlcv => getPriceChangePercent (ohlcv)); + const sorted = priceChanges.sort (sort); + console.dir(sorted, {'maxArrayLength': null}) +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/symbols.md b/docs/ccxt/wiki/examples/js/symbols.md new file mode 100644 index 0000000..d30f1d1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/symbols.md @@ -0,0 +1,115 @@ +- [Symbols](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import fs from 'fs'; +import ololog from 'ololog'; +import ansicolor from 'ansicolor'; +import asTable from 'as-table'; + +const { noLocate } = ololog; +const log = noLocate; + +ansicolor.nice +const table = asTable.configure ({ delimiter: ' | ' }), verbose = process.argv.includes ('--verbose'), debug = process.argv.includes ('--debug'); + +//----------------------------------------------------------------------------- + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'id'.green) + printSupportedExchanges () +} + +let printSymbols = async (id) => { + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + if (exchangeFound) { + + log ('Instantiating', id.green, 'exchange') + + // set up keys and settings, if any + const keysGlobal = 'keys.json' + const keysLocal = 'keys.local.json' + + let keysFile = fs.existsSync (keysLocal) ? keysLocal : (fs.existsSync (keysGlobal) ? keysGlobal : false) + let settings = keysFile ? (require ('../../' + keysFile)[id] || {}) : {} + + // instantiate the exchange by id + let exchange = new ccxt[id] (ccxt.extend ({ + verbose, + // 'proxy': 'https://cors-anywhere.herokuapp.com/', + // 'proxy': 'https://crossorigin.me/', + }, settings)) + + // Object.assign (exchange, settings) + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + // debug log + if (debug) + Object.values (markets).forEach (market => log (market)) + + log ("\nSymbols:\n") + + // make a table of all markets + + const marketsList = + ccxt.sortBy (Object.values (markets), 'symbol') + .map (market => + ccxt.omit (market, [ 'info', 'limits', 'precision', 'fees' ])) + + let table = table (marketsList) + log (table) + + log ("\n---------------------------------------------------------------") + + log ("\nCurrencies:\n") + + // make a table of all currencies + + const currenciesList = + ccxt.sortBy (Object.values (exchange.currencies), 'code') + .map (currency => + ccxt.omit (currency, [ 'info', 'limits' ])) + + const currenciesTable = table (currenciesList) + log (currenciesTable) + + log ("\n---------------------------------------------------------------") + + // output a summary + log (id.green, 'has', exchange.symbols.length.toString ().yellow, 'symbols and', + Object.keys (exchange.currencies).length.toString ().yellow, "currencies\n") + + } else { + + log ('Exchange ' + id.red + ' not found') + printSupportedExchanges () + } +} + +;(async function main () { + + if (process.argv.length > 2) { + + let id = process.argv[2] + await printSymbols (id) + + } else { + + printUsage () + } + + process.exit () + +}) () +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/theocean.md b/docs/ccxt/wiki/examples/js/theocean.md new file mode 100644 index 0000000..0f24523 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/theocean.md @@ -0,0 +1,47 @@ +- [Theocean](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +(async function main () { + const walletAddress = process.env['WALLET_ADDRESS'] + const privateKey = process.env['PRIVATE_KEY'] + const apiKey = process.env['API_KEY'] + const secret = process.env['SECRET'] + + const ocean = new ccxt.theocean({ + walletAddress, + privateKey, + apiKey, + secret + }); + + // get balance + const balance = await ocean.fetchBalanceByCode('REP'); + console.log('REP balance: ', balance); + + // get order book + const orderBook = await ocean.fetchOrderBook('REP/ZRX'); + console.log('REP/ZRX orderbook: ', orderBook); + + // placing order + const placeResult = await ocean.createOrder('REP/ZRX', 'limit', 'sell', '0.5', '30'); + const id = placeResult['id']; + console.log('result of placing order: ', placeResult); + + // cancel order + if (placeResult['remaining'] > 0) { + const cancelResult = await ocean.cancelOrder(id); + console.log('cancel result: ', cancelResult); + } + + // cancel all open user orders + const cancelAllOrderssResult = await ocean.cancelAllOrders(); + console.log('cancel all orders result: ', cancelAllOrderssResult); + + process.exit (); +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/tickers.md b/docs/ccxt/wiki/examples/js/tickers.md new file mode 100644 index 0000000..f7a4188 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/tickers.md @@ -0,0 +1,112 @@ +- [Tickers](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import asTable from 'as-table'; +import ansicolor from 'ansicolor'; +import ololog from 'ololog'; + +const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose'); + +ansicolor.nice + +//----------------------------------------------------------------------------- + +let printSupportedExchanges = function () { + log ('Supported exchanges:', ccxt.exchanges.join (', ').green) +} + +let printUsage = function () { + log ('Usage: node', process.argv[1], 'id'.green, '[symbol]'.yellow) + printSupportedExchanges () +} + +let printSymbols = function (exchange) { + log (id.green, 'has', exchange.symbols.length, 'symbols:', exchange.symbols.join (', ').yellow) +} + +let sleep = (ms) => new Promise (resolve => setTimeout (resolve, ms)) + +let printTicker = async (exchange, symbol) => { + let ticker = await exchange.fetchTicker (symbol) + log (exchange.id.green, symbol.yellow, 'ticker', + ticker['datetime'], + 'high: ' + ticker['high'], + 'low: ' + ticker['low'], + 'bid: ' + ticker['bid'], + 'ask: ' + ticker['ask'], + 'volume: ' + ticker['baseVolume']) + return ticker +} + +//----------------------------------------------------------------------------- + +let printTickers = async (id) => { + + log ('Instantiating', id.green, 'exchange exchange') + + // instantiate the exchange by id + let exchange = new ccxt[id] ({ verbose }) + + // load all markets from the exchange + let markets = await exchange.loadMarkets () + + if (process.argv.length > 3) { // if a symbol was supplied, get that symbol only + + let symbol = process.argv[3] + + await printTicker (exchange, symbol) + + } else { // otherwise run through all symbols one by one + + for (let symbol of exchange.symbols) + if ((symbol.indexOf ('.d') < 0)) { // skip darkpool symbols + + const market = exchange.markets[symbol]; + + if (!market['active']) { + log.red (exchange.id + ' ' + symbol + ' inactive'); + continue; + } + + await sleep (exchange.rateLimit) + await printTicker (exchange, symbol) + } + } +} + +//----------------------------------------------------------------------------- + +;(async function main () { + + if (process.argv.length > 2) { + + let id = process.argv[2] + + // check if the exchange is supported by ccxt + let exchangeFound = ccxt.exchanges.indexOf (id) > -1 + + if (exchangeFound) { + + await printTickers (id) + + } else { + + log ('Exchange ' + id.red + ' not found') + printUsage () + } + + } else { + + printUsage () + + } + + process.exit () + +}) () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/validate-paginated-data.md b/docs/ccxt/wiki/examples/js/validate-paginated-data.md new file mode 100644 index 0000000..f735d48 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/validate-paginated-data.md @@ -0,0 +1,66 @@ +- [Validate Paginated Data](./examples/js/) + + + ```javascript + + +import ccxt from '../../js/ccxt.js'; +import ololog from 'ololog' +import ansicolor from 'ansicolor'; + +const log = ololog.configure ({ locate: false }) + +ansicolor.nice + +//----------------------------------------------------------------------------- + +/* +* Warning: Sometimes the exchanges have gaps in their OHLCV data, so it does not mean +* that CCXT is broken if you see gaps in the chart. +*/ + +async function fetchData(exchange, symbol, timeframe) { + await exchange.loadMarkets() + // exchange.verbose = true; + const duration = exchange.parseTimeframe (timeframe) *1000; // in milliseconds + const ohlcv = await exchange.fetchOHLCV (symbol, timeframe, undefined, undefined, {'paginate': true, 'paginationCalls': 5}) + validateTimeframes(ohlcv, duration, exchange, symbol) +} + +function validateTimeframes(ohlcv, duration, exchange, symbol) { + for (let j = 0; j < ohlcv.length; j++) { + const [timestamp, open, high, low, close, volume] = ohlcv[j] + if (j > 0) { + const [prevTimestamp, prevOpen, prevHigh, prevLow, prevClose, prevVolume] = ohlcv[j - 1] + if (timestamp - prevTimestamp !== duration) { + log.red ('[' + j + ']',exchange.id, symbol, 'OHLCV data is not continuous, at', exchange.iso8601 (timestamp), 'diff:', ((timestamp - prevTimestamp) / 1000), 's expected:', duration/ 1000, 's') + } + } + } + log.green(exchange.id, symbol, `All the ${ohlcv.length} candles returned are continuous`) +} + +async function main () { + + const exchanges = { + 'binance': 'BTC/USDT', + 'bitget': 'BTC/USDT', + 'kucoin': 'BTC/USDT', + 'kucoinfutures': 'BTC/USDT:USDT', + 'okex': 'BTC/USDT', + 'bybit': 'BTC/USDT' + } + const timeframe = '1m'; + const keys = Object.keys (exchanges) + const promises = []; + for (let i = 0; i < keys.length; i++) { + const name = keys[i] + const symbol = exchanges[name] + const exchange = new ccxt[name] ({ enableRateLimit: true }) + promises.push(fetchData(exchange, symbol, timeframe)) + } + await Promise.all(promises) +} + +main() +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watch-OHLCV-For-Symbols.md b/docs/ccxt/wiki/examples/js/watch-OHLCV-For-Symbols.md new file mode 100644 index 0000000..a0a098f --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watch-OHLCV-For-Symbols.md @@ -0,0 +1,21 @@ +- [Watch Ohlcv For Symbols](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const subscriptions = [ + ['BTC/USDT', '5m'], + ['ETH/USDT', '5m'], + ['BTC/USDT', '1h'], + ]; + while (true) { + const ohlcv = await binance.watchOHLCVForSymbols(subscriptions); + console.log(ohlcv); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watch-OHLCV.md b/docs/ccxt/wiki/examples/js/watch-OHLCV.md new file mode 100644 index 0000000..ba40fab --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watch-OHLCV.md @@ -0,0 +1,18 @@ +- [Watch Ohlcv](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbol = 'BTC/USDT'; + const timeframe = '1m'; + while (true) { + const ohlcv = await binance.watchOHLCV(symbol, timeframe); + console.log(ohlcv); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watch-OrderBook-For-Symbols.md b/docs/ccxt/wiki/examples/js/watch-OrderBook-For-Symbols.md new file mode 100644 index 0000000..0709218 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watch-OrderBook-For-Symbols.md @@ -0,0 +1,17 @@ +- [Watch Orderbook For Symbols](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const orderbook = await binance.watchOrderBookForSymbols(symbols); + console.log(orderbook['symbol'], orderbook['asks'][0], orderbook['bids'][0]); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watch-Trades-For-Symbols.md b/docs/ccxt/wiki/examples/js/watch-Trades-For-Symbols.md new file mode 100644 index 0000000..9a17c8c --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watch-Trades-For-Symbols.md @@ -0,0 +1,17 @@ +- [Watch Trades For Symbols](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const trades = await binance.watchTradesForSymbols(symbols); + console.log(trades); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watch-tickers.md b/docs/ccxt/wiki/examples/js/watch-tickers.md new file mode 100644 index 0000000..005da47 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watch-tickers.md @@ -0,0 +1,17 @@ +- [Watch Tickers](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const tickers = await binance.watchTickers(symbols); + console.log(tickers['BTC/USDT'], tickers['ETH/USDT'], tickers['DOGE/USDT']); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchOHLCVForSymbols.md b/docs/ccxt/wiki/examples/js/watchOHLCVForSymbols.md new file mode 100644 index 0000000..12613ee --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchOHLCVForSymbols.md @@ -0,0 +1,21 @@ +- [Watchohlcvforsymbols](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const subscriptions = [ + ['BTC/USDT', '5m'], + ['ETH/USDT', '5m'], + ['BTC/USDT', '1h'], + ]; + while (true) { + const ohlcv = await binance.watchOHLCVForSymbols(subscriptions); + console.log(ohlcv); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchOrderBookForSymbols.md b/docs/ccxt/wiki/examples/js/watchOrderBookForSymbols.md new file mode 100644 index 0000000..d400071 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchOrderBookForSymbols.md @@ -0,0 +1,17 @@ +- [Watchorderbookforsymbols](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbol = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const orderbook = await binance.watchOrderBookForSymbols(symbol); + console.log(orderbook['symbol'], orderbook['asks'][0], orderbook['bids'][0]); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.md b/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.md new file mode 100644 index 0000000..6d8d954 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.md @@ -0,0 +1,7 @@ +- [Watchpositions Many Exchanges Continuosly.d](./examples/js/) + + + ```javascript + export {}; +//# sourceMappingURL=watchPositions-many-exchanges-continuosly.d.ts.map +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.ts.md b/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.ts.md new file mode 100644 index 0000000..a2238d1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.d.ts.md @@ -0,0 +1,6 @@ +- [Watchpositions Many Exchanges Continuosly.d.ts](./examples/js/) + + + ```javascript + {"version":3,"file":"watchPositions-many-exchanges-continuosly.d.ts","sourceRoot":"","sources":["../ts/watchPositions-many-exchanges-continuosly.ts"],"names":[],"mappings":""} +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.md b/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.md new file mode 100644 index 0000000..d6c41ab --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositions-many-exchanges-continuosly.md @@ -0,0 +1,55 @@ +- [Watchpositions Many Exchanges Continuosly](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +// watch and handle constinuosly +async function watchPositionsContinuously(exchange) { + while (true) { + try { + const positions = await exchange.watchPositions(); + console.log('Fetched ', exchange.id, ' - Positions: ', positions); + } + catch (e) { + console.log(e); + break; + } + } +} +// start exchanges and fetch OHLCV loop +async function startExchange(exchangeName, config) { + const ex = new ccxt[exchangeName](config); + const promises = []; + promises.push(watchPositionsContinuously(ex)); + await Promise.all(promises); + await ex.close(); +} +// main function +async function example() { + const exchanges = { + 'binanceusdm': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'okx': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'huobi': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + }; + const promises = []; + const exchangeIds = Object.keys(exchanges); + for (let i = 0; i < exchangeIds.length; i++) { + const exchangeName = exchangeIds[i]; + const config = exchanges[exchangeName]; + promises.push(startExchange(exchangeName, config)); + } + await Promise.all(promises); +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositions.d.md b/docs/ccxt/wiki/examples/js/watchPositions.d.md new file mode 100644 index 0000000..b32e9e1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositions.d.md @@ -0,0 +1,7 @@ +- [Watchpositions.d](./examples/js/) + + + ```javascript + export {}; +//# sourceMappingURL=watchPositions.d.ts.map +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositions.d.ts.md b/docs/ccxt/wiki/examples/js/watchPositions.d.ts.md new file mode 100644 index 0000000..af4bc80 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositions.d.ts.md @@ -0,0 +1,6 @@ +- [Watchpositions.d.ts](./examples/js/) + + + ```javascript + {"version":3,"file":"watchPositions.d.ts","sourceRoot":"","sources":["../ts/watchPositions.ts"],"names":[],"mappings":""} +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositions.md b/docs/ccxt/wiki/examples/js/watchPositions.md new file mode 100644 index 0000000..84995e1 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositions.md @@ -0,0 +1,19 @@ +- [Watchpositions](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.pro.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET' + }); + while (true) { + const trades = await exchange.watchPositions(); + console.log(trades); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.md b/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.md new file mode 100644 index 0000000..675f5a8 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.md @@ -0,0 +1,7 @@ +- [Watchpositionsforsymbols.d](./examples/js/) + + + ```javascript + export {}; +//# sourceMappingURL=watchPositionsForSymbols.d.ts.map +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.ts.md b/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.ts.md new file mode 100644 index 0000000..7d2f607 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.d.ts.md @@ -0,0 +1,6 @@ +- [Watchpositionsforsymbols.d.ts](./examples/js/) + + + ```javascript + {"version":3,"file":"watchPositionsForSymbols.d.ts","sourceRoot":"","sources":["../ts/watchPositionsForSymbols.ts"],"names":[],"mappings":""} +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.md b/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.md new file mode 100644 index 0000000..3efdb26 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchPositionsForSymbols.md @@ -0,0 +1,20 @@ +- [Watchpositionsforsymbols](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const exchange = new ccxt.pro.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'Your_API_SECRET' + }); + const symbols = ['BTC/USDT:USDT', 'ETH/USDT:USDT', 'DOGE/USDT:USDT']; + while (true) { + const trades = await exchange.watchPositions(symbols); + console.log(trades); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/watchTradesForSymbols.md b/docs/ccxt/wiki/examples/js/watchTradesForSymbols.md new file mode 100644 index 0000000..ece96c8 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/watchTradesForSymbols.md @@ -0,0 +1,17 @@ +- [Watchtradesforsymbols](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; +// AUTO-TRANSPILE // +async function example() { + const binance = new ccxt.pro.binance({}); + const symbols = ['BTC/USDT', 'ETH/USDT', 'DOGE/USDT']; + while (true) { + const trades = await binance.watchTradesForSymbols(symbols); + console.log(trades); + } +} +await example(); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/js/withdraw-from-one-exchange-to-another.md b/docs/ccxt/wiki/examples/js/withdraw-from-one-exchange-to-another.md new file mode 100644 index 0000000..41d5a11 --- /dev/null +++ b/docs/ccxt/wiki/examples/js/withdraw-from-one-exchange-to-another.md @@ -0,0 +1,56 @@ +- [Withdraw From One Exchange To Another](./examples/js/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +console.log ('CCXT Version', ccxt.version) + +async function main () { + + const binance = new ccxt.binance ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'fetchCurrencies': true, + }, + }) + + const kucoin = new ccxt.kucoin ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_API_PASSWORD', + }) + + await binance.loadMarkets () + await kucoin.loadMarkets () + + binance.verbose = true + kucoin.verbose = true + + const code = 'COTI' + const amount = 40 + + // https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params + // https://binance-docs.github.io/apidocs/spot/en/#deposit-address-supporting-network-user_data + const deposit = await binance.fetchDepositAddress (code, { 'network': 'ETH' }) + + console.log ('-----------------------------------------------------------') + + console.log (depositAddress) + + console.log ('-----------------------------------------------------------') + + // https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params + // https://docs.kucoin.com/#apply-withdraw-2 + const withdrawal = await kucoin.withdraw (code, amount, deposit['address'], deposit['tag'], { 'chain': 'ERC20' }) + + console.log ('-----------------------------------------------------------') + + console.log (withdrawal) + +} + +main () + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/README.md b/docs/ccxt/wiki/examples/php/README.md new file mode 100644 index 0000000..9ae0ce8 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/README.md @@ -0,0 +1,160 @@ + + +# [<-](Examples?id=php) + +# CCXT PHP Examples + +To run PHP examples from any folder type in console: + +```shell +php -f path/to/example.php # substitute for actual filename here +``` + +- [Arbitrage Pairs](./examples/php/arbitrage-pairs.md) + +- [Async Await Fetch Multiple](./examples/php/async-await-fetch-multiple.md) + +- [Async Await Fetch](./examples/php/async-await-fetch.md) + +- [Basic Error Handling](./examples/php/basic-error-handling.md) + +- [Basic Order](./examples/php/basic-order.md) + +- [Binance Create Order Stop Loss Take Profit](./examples/php/binance-create-order-stop-loss-take-profit.md) + +- [Binance Fetch All Trades For All Traded Symbols](./examples/php/binance-fetch-all-trades-for-all-traded-symbols.md) + +- [Binance Oco Order](./examples/php/binance-oco-order.md) + +- [Binance Set Futures Leverage](./examples/php/binance-set-futures-leverage.md) + +- [Binance Spot Trailing](./examples/php/binance-spot-trailing.md) + +- [Bitfinex2 Fetch Ohlcv Since Limit](./examples/php/bitfinex2-fetch-ohlcv-since-limit.md) + +- [Bitfinex2 Fetch Ohlcv](./examples/php/bitfinex2-fetch-ohlcv.md) + +- [Bitfinex2 Fetch Trades Since](./examples/php/bitfinex2-fetch-trades-since.md) + +- [Bitmex Create Order](./examples/php/bitmex-create-order.md) + +- [Build Ohlcv Bars](./examples/php/build-ohlcv-bars.md) + +- [Built In Rate Limiting Poller](./examples/php/built-in-rate-limiting-poller.md) + +- [Bybit Updated](./examples/php/bybit-updated.md) + +- [Bytetrade Create Order](./examples/php/bytetrade-create-order.md) + +- [Cache Exchange Instance Reuse](./examples/php/cache-exchange-instance-reuse.md) + +- [Cancel Order](./examples/php/cancel-order.md) + +- [Cli](./examples/php/cli.md) + +- [Coinbase Fetch All Balances](./examples/php/coinbase-fetch-all-balances.md) + +- [Coinbasepro Cursor Pagination](./examples/php/coinbasepro-cursor-pagination.md) + +- [Coinone Markets](./examples/php/coinone-markets.md) + +- [Compare Two Exchanges Capabilities](./examples/php/compare-two-exchanges-capabilities.md) + +- [Create Order Position With Takeprofit Stoploss](./examples/php/create-order-position-with-takeprofit-stoploss.md) + +- [Create Order Ws Example](./examples/php/create-order-ws-example.md) + +- [Create Orders Example](./examples/php/create-orders-example.md) + +- [Create Trailing Amount Order](./examples/php/create-trailing-amount-order.md) + +- [Create Trailing Percent Order](./examples/php/create-trailing-percent-order.md) + +- [Error Handling Message](./examples/php/error-handling-message.md) + +- [Exchange Properties](./examples/php/exchange-properties.md) + +- [Fetch Balance](./examples/php/fetch-balance.md) + +- [Fetch First Ohlcv Timestamp](./examples/php/fetch-first-ohlcv-timestamp.md) + +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/php/fetch-ohlcv-many-exchanges-continuosly.md) + +- [Fetch Ohlcv](./examples/php/fetch-ohlcv.md) + +- [Fetch Order](./examples/php/fetch-order.md) + +- [Fetch Ticker](./examples/php/fetch-ticker.md) + +- [Fetch Tickers](./examples/php/fetch-tickers.md) + +- [Gateio Futures](./examples/php/gateio-futures.md) + +- [Gateio Swaps](./examples/php/gateio-swaps.md) + +- [Huobi Fetch Balance](./examples/php/huobi-fetch-balance.md) + +- [Huobi Futures](./examples/php/huobi-futures.md) + +- [Huobi Swaps](./examples/php/huobi-swaps.md) + +- [Indodax Fetch Balance Create Order Cancel Order](./examples/php/indodax-fetch-balance-create-order-cancel-order.md) + +- [Kraken Create And Close Position](./examples/php/kraken-create-and-close-position.md) + +- [Kraken Query Ledgers](./examples/php/kraken-query-ledgers.md) + +- [Kucoin Fetch All Deposit Addresses](./examples/php/kucoin-fetch-all-deposit-addresses.md) + +- [Kucoin Implicit Inner Transfer V1](./examples/php/kucoin-implicit-inner-transfer-v1.md) + +- [Latoken Example](./examples/php/latoken-example.md) + +- [Load All At Once Async](./examples/php/load-all-at-once-async.md) + +- [Load All At Once](./examples/php/load-all-at-once.md) + +- [Margin Loan Borrow Buy Sell Repay](./examples/php/margin-loan-borrow-buy-sell-repay.md) + +- [Method Overload Override](./examples/php/method-overload-override.md) + +- [Nonce Override](./examples/php/nonce-override.md) + +- [Order Book Level Depth Extra Param](./examples/php/order-book-level-depth-extra-param.md) + +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/php/phemex-create-order-position-with-takeprofit-stoploss.md) + +- [Proxy Usage](./examples/php/proxy-usage.md) + +- [React Eventloop With Rate Limiting](./examples/php/react-eventloop-with-rate-limiting.md) + +- [Sample Local Proxy Server With Cors](./examples/php/sample-local-proxy-server-with-cors.md) + +- [Shared Markets](./examples/php/shared-markets.md) + +- [Symbols](./examples/php/symbols.md) + +- [Trading View](./examples/php/trading-view.md) + +- [Watch Ohlcv For Symbols](./examples/php/watch-OHLCV-For-Symbols.md) + +- [Watch Ohlcv](./examples/php/watch-OHLCV.md) + +- [Watch Orderbook For Symbols](./examples/php/watch-OrderBook-For-Symbols.md) + +- [Watch Trades For Symbols](./examples/php/watch-Trades-For-Symbols.md) + +- [Watch Tickers](./examples/php/watch-tickers.md) + +- [Watchohlcvforsymbols](./examples/php/watchOHLCVForSymbols.md) + +- [Watchorderbookforsymbols](./examples/php/watchOrderBookForSymbols.md) + +- [Watchpositions Many Exchanges Continuosly](./examples/php/watchPositions-many-exchanges-continuosly.md) + +- [Watchpositions](./examples/php/watchPositions.md) + +- [Watchpositionsforsymbols](./examples/php/watchPositionsForSymbols.md) + +- [Watchtradesforsymbols](./examples/php/watchTradesForSymbols.md) + diff --git a/docs/ccxt/wiki/examples/php/arbitrage-pairs.md b/docs/ccxt/wiki/examples/php/arbitrage-pairs.md new file mode 100644 index 0000000..9da1b68 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/arbitrage-pairs.md @@ -0,0 +1,144 @@ +- [Arbitrage Pairs](./examples/php/) + + + ```php + setHeaders ($headers); + $tbl->addData ($rows); + return $tbl->getTable (); +} + +function pairs_table_helper ($pair) { + return array_values ($pair); +} + +$proxies = array ( + '', // no proxy by default + 'https://crossorigin.me/', + 'https://cors-anywhere.herokuapp.com/', +); + +$max_retries = count ($proxies); +$ids = array_slice ($argv, 1); +$exchanges = array (); +$min_exchanges = 2; // a pair should be present on at least two exchanges or more + +if ($ids) { + + // load all markets from all exchanges + foreach ($ids as $id) { + + // instantiate the exchange by id + $exchange = '\\ccxt\\' . $id; + $exchange = new $exchange (); + + // save it in an assoc array for later use + $exchanges[$id] = $exchange; + + $current_proxy = 0; + + for ($num_retries = 0; $num_retries < $max_retries; $num_retries++) { + + try { + + $exchange->proxy = $proxies[$current_proxy]; + $current_proxy = (++$current_proxy) % count ($proxies); + + // load all markets from the exchange + $markets = $exchange->load_markets (); + + // output a list of all market symbols + dump (green ($id), 'has', yellow (count ($exchange->symbols)), 'symbols'); + + break; + + } catch (\ccxt\RequestTimeout $e) { + print_r ($e); + } catch (\ccxt\DDoSProtection $e) { + print_r ($e); + } catch (\ccxt\AuthenticationError $e) { + print_r ($e); + } catch (\ccxt\ExchangeNotAvailable $e) { + print_r ($e); + } catch (\ccxt\NotSupported $e) { + print_r ($e); + } catch (\ccxt\NetworkError $e) { + print_r ($e); + } catch (\ccxt\ExchangeError $e) { + print_r ($e); + } catch (Exception $e) { + print_r ($e); + } + + } + } + + dump (green ('Loaded all markets')); + + $all_symbols = flatten (array_values (array_map (function ($exchange) { + return $exchange->symbols; + }, $exchanges))); + + $unique_symbols = array_unique ($all_symbols); + + // filter unique symbols leaving those present on at least 2 exchanges or more + $arbitrable_symbols = array_filter ($unique_symbols, function ($symbol) use (&$exchanges, $min_exchanges) { + + $num_related_exchanges = count (array_filter ($exchanges, function ($exchange) use (&$symbol, $min_exchanges) { + return in_array ($symbol, $exchange->symbols); + })); + + return ($num_related_exchanges >= $min_exchanges); + }); + + sort ($arbitrable_symbols); + + $pairs = array_map (function ($symbol) use (&$exchanges) { + $result = array ('symbol' => $symbol); + foreach ($exchanges as $exchange) { + $result[$exchange->id] = in_array ($symbol, $exchange->symbols) ? $exchange->id : ''; + } + return $result; + }, $arbitrable_symbols); + + // output a table of all markets + @dump (tabulate (array_keys ($pairs[0]), array_map ('pairs_table_helper', $pairs))); + +} else { + + dump ('Usage: php -f', __FILE__, green ('id')); + print_supported_exchanges (); + +} + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/async-await-fetch-multiple.md b/docs/ccxt/wiki/examples/php/async-await-fetch-multiple.md new file mode 100644 index 0000000..d847e6f --- /dev/null +++ b/docs/ccxt/wiki/examples/php/async-await-fetch-multiple.md @@ -0,0 +1,28 @@ +- [Async Await Fetch Multiple](./examples/php/) + + + ```php + load_markets()); +$symbols = array('BTC/USDT', 'ETH/USDT', 'DOGE/USDT'); + + +echo "########### Combined await ###########\n"; +$promises = []; +foreach ($symbols as $symbol) { + $promises[] = $exchange->fetch_ticker($symbol); +} +$tickers = await(all($promises)); + +echo "{$tickers[0]['symbol']} {$tickers[0]['close']} | {$tickers[1]['symbol']} {$tickers[1]['close']} | {$tickers[21]['symbol']} {$tickers[2]['close']}\n"; + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/async-await-fetch.md b/docs/ccxt/wiki/examples/php/async-await-fetch.md new file mode 100644 index 0000000..c83ff2f --- /dev/null +++ b/docs/ccxt/wiki/examples/php/async-await-fetch.md @@ -0,0 +1,64 @@ +- [Async Await Fetch](./examples/php/) + + + ```php + load_markets()); +$symbols = array('BTC/USDT', 'ETH/USDT'); + + +// ########################################### +echo "########## Individual await ##########\n"; +foreach ($symbols as $symbol) { + $ticker = await($exchange->fetch_ticker($symbol)); + echo "{$ticker['symbol']} {$ticker['close']}\n"; +} +// ########################################### + + +// ########################################### +echo "########### Combined await ###########\n"; +$promises = []; +foreach ($symbols as $symbol) { + $promises[] = $exchange->fetch_ticker($symbol); +} +$tickers = await(React\Promise\all($promises)); +echo "{$tickers[0]['symbol']} {$tickers[0]['close']} | {$tickers[1]['symbol']} {$tickers[1]['close']}\n"; +// ########################################### + + + +// ########################################### +$exchange->fetch_ticker($symbols[0])->then(function($ticker){ + echo "########## Callback->then ##########\n"; + echo "{$ticker['symbol']} {$ticker['close']}\n"; +}); +// ########################################### + + + +// ################### custom async function ######################## +function myFunc ($exchange, $symbol) { + return async(function () use ($exchange, $symbol) { + try { + // example sleep + await(React\Promise\Timer\sleep(0.5)); + $ticker = await($exchange->fetch_ticker($symbol)); + echo "########## Custom async function ##########\n"; + echo "{$ticker['symbol']} {$ticker['close']}\n"; + } catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; + } + }); +} +await(myFunc($exchange, $symbols[0])()); +// ########################################### + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/basic-error-handling.md b/docs/ccxt/wiki/examples/php/basic-error-handling.md new file mode 100644 index 0000000..bccb011 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/basic-error-handling.md @@ -0,0 +1,31 @@ +- [Basic Error Handling](./examples/php/) + + + ```php + fetch_ticker ('NONEXISTENT_SYMBOL'); + var_dump ($result); + +} catch (Exception $e) { + + // print it + echo $e->getMessage() . "\n"; + + // save to $message (for whatever needs) + $message = $e->getMessage(); +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/basic-order.md b/docs/ccxt/wiki/examples/php/basic-order.md new file mode 100644 index 0000000..70c8771 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/basic-order.md @@ -0,0 +1,42 @@ +- [Basic Order](./examples/php/) + + + ```php + 'YOUR_API_KEY', // change for your keys + 'secret' => 'YOUR_API_SECRET', +)); + +$message = null; + +try { + + $exchange->load_markets(); + + $exchange->verbose = true; // uncomment for debugging purposes + + // adjust your values below + + $symbol = 'BTC/USDT'; + $order_type = 'limit'; + $side = 'sell'; + $amount = 0.123; // adjust for your amount + $price = 50000; // adjust for your price (for limit orders) + + $result = $exchange->create_order ($symbol, $order_type, $side, $amount, $price); + var_dump ($result); + +} catch (Exception $e) { + + echo get_class($e) . ': ' . $e->getMessage() . "\n"; +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/binance-create-order-stop-loss-take-profit.md b/docs/ccxt/wiki/examples/php/binance-create-order-stop-loss-take-profit.md new file mode 100644 index 0000000..bc58e78 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/binance-create-order-stop-loss-take-profit.md @@ -0,0 +1,55 @@ +- [Binance Create Order Stop Loss Take Profit](./examples/php/) + + + ```php + 'YOUR_API_KEY', // edit this line + 'secret' => 'YOUR_SECRET', // edit this line +)); + +$exchange->load_markets(); +// $exchange->verbose = True; // uncomment for debugging purposes + +$symbol = 'BTC/USDT'; +$side = 'buy'; +$amount = 0.01; +$stopLossPrice = 25000; +$takeProfitPrice = 35000; + +try { + + $order = $exchange->create_order($symbol, 'MARKET', $side, $amount); + print_r($order); + + $inverted_side = ($side == 'buy') ? 'sell' : 'buy'; + + $stopLossParams = array('stopPrice' => $stopLossPrice); + $stopLossOrder = $exchange->create_order($symbol, 'STOP_MARKET', $inverted_side, $amount, null, $stopLossParams); + print_r($stopLossOrder); + + $takeProfitParams = array('stopPrice' => $takeProfitPrice); + $takeProfitOrder = $exchange->create_order($symbol, 'TAKE_PROFIT_MARKET', $inverted_side , $amount, null, $takeProfitParams); + print_r($takeProfitOrder); + +} catch (Exception $e) { + echo get_class($e) . ': ' . $e->getMessage() . "\n"; +} + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/binance-fetch-all-trades-for-all-traded-symbols.md b/docs/ccxt/wiki/examples/php/binance-fetch-all-trades-for-all-traded-symbols.md new file mode 100644 index 0000000..31a5cfb --- /dev/null +++ b/docs/ccxt/wiki/examples/php/binance-fetch-all-trades-for-all-traded-symbols.md @@ -0,0 +1,113 @@ +- [Binance Fetch All Trades For All Traded Symbols](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', +)); + +$exchange->load_markets(); +$balance = $exchange->fetch_balance(); + +$total = $balance['total']; + +$all_matching_symbols = array(); + +foreach ($total as $currency_code => $value) { + + echo "-------------------------------------------------------------------\n"; + echo "Currency code: ", $currency_code, " value: ", $value, "\n"; + + if ($value > 0) { + + // get all related markets with + // either base currency === currency code from the balance structure + // or quote currency === currency code from the balance structure + + $matching_markets = array_filter(array_values($exchange->markets), function ($market) use ($currency_code) { + return ($market['base'] === $currency_code) || ($market['quote'] === $currency_code); + }); + + $matching_symbols = $exchange->pluck($matching_markets, 'symbol'); + + echo "Matching symbols:\n"; + print_r($matching_symbols); + + $all_matching_symbols = array_merge($all_matching_symbols, $matching_symbols); + } +} + +echo "========================================================================\n"; +$unique_symbols = $exchange->unique($all_matching_symbols); +print_r($unique_symbols); + +$all_trades_for_all_symbols = array(); + +// ---------------------------------------------------------------------------- + +function fetch_all_my_trades($exchange, $symbol) { + + $from_id = '0'; + $params = array('fromId' => $from_id); + $previous_from_id = $from_id; + + $all_trades = array(); + + while (true) { + + echo "------------------------------------------------------------------\n"; + echo "Fetching with params:\n"; + print_r($params); + $trades = $exchange->fetch_my_trades($symbol, null, null, $params); + echo "Fetched ", count($trades), ' ', $symbol, " trades\n"; + if (count($trades)) { + $last_trade = $trades[count($trades) - 1]; + if ($last_trade['id'] == $previous_from_id) { + break; + } else { + $params['fromId'] = $last_trade['id']; + $previous_from_id = $last_trade['id']; + $all_trades = array_merge ($all_trades, $trades); + } + } else { + break; + } + } + + echo "Fetched ", count($all_trades), ' ', $symbol, " trades\n"; + for ($i = 0; $i < count($all_trades); $i++) { + $trade = $all_trades[$i]; + echo $i, ' ', $trade['symbol'], ' ', $trade['id'], ' ', $trade['datetime'], ' ', $trade['amount'], "\n"; + } + + return $all_trades; +} + +// ---------------------------------------------------------------------------- + +foreach ($unique_symbols as $symbol) { + + echo "=================================================================\n"; + echo "Fetching all ", $symbol, " trades\n"; + + // fetch all trades for the $symbol, with pagination + $trades = fetch_all_my_trades($exchange, $symbol); + + echo count($trades), ' ' , $symbol, " trades\n"; + + $all_trades_for_all_symbols = array_merge($all_trades_for_all_symbols, $trades); + +} + +// do whatever you want with $all_trades_for_all_symbols + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/binance-oco-order.md b/docs/ccxt/wiki/examples/php/binance-oco-order.md new file mode 100644 index 0000000..10c8705 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/binance-oco-order.md @@ -0,0 +1,69 @@ +- [Binance Oco Order](./examples/php/) + + + ```php + 'YOUR_API_KEY', // replace with your keys + 'secret' => 'YOUR_SECRET', + 'verbose' => true, +)); + +try { + + $symbol = 'XRP/BTC'; // replace with your symbol + $amount = 123.45; // replace with your amount here + $price = 543.21; // replace with your price here + $stop_price = 123.45; // replace with your stop_price + + // $limit_iceberg_qty = 543.21; // replace with your limit iceberg amount + + // if stopLimitPrice is provided, stopLimitTimeInForce is also required + // $stop_limit_price = 54.321; // replace with your stop limit price + // $stop_limit_time_in_force = 'GTC'; // or 'FOK', or 'IOC' + + // $stop_iceberg_qty = 123.45; // replace with your stop iceberg amount + + // https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + $exchange->load_markets(); + + // https://github.com/ccxt/ccxt/wiki/Manual#symbols-and-market-ids + $market = $exchange->market($symbol); + + // https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods + $params = array( + 'symbol' => $market['id'], // market id + // 'listClientOrderId' => 'STRING', // a unique id for the entire orderList + 'side' => 'BUY', // or 'SELL' + 'quantity' => $exchange->amount_to_precision($symbol, $amount), // decimal string + // 'limitClientOrderId' => 'STRING', // a unique id for the limit order + 'price' => $exchange->price_to_precision($symbol, $price), // decimal string + // 'limitIcebergQty' => $exchange->amount_to_precision($symbol, $limit_iceberg_qty), // decimal string + // 'stopClientOrderId' => 'STRING', // a unique id for the stop loss/stop loss limit leg + 'stopPrice' => $exchange->price_to_precision($symbol, $stop_price), // decimal string + // if stopLimitPrice is provided, stopLimitTimeInForce is also required + // 'stopLimitPrice' => $exchange->price_to_precision($symbol, $stop_limit_price), // decimal string + // 'stopLimitTimeInForce' => $stop_limit_time_in_force, + // 'stopIcebergQty' => $exchange->amount_to_precision($symbol, $stop_iceberg_qty), // decimal string + // 'newOrderRespType' => 'ACK', // or 'RESULT', or 'FULL', // set the response JSON + ); + + $response = $exchange->private_post_order_oco($params); + + var_dump($response); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (\ccxt\ExchangeError $e) { + echo '[Exchange Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/binance-set-futures-leverage.md b/docs/ccxt/wiki/examples/php/binance-set-futures-leverage.md new file mode 100644 index 0000000..96c84e9 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/binance-set-futures-leverage.md @@ -0,0 +1,41 @@ +- [Binance Set Futures Leverage](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', + 'options' => array( + 'defaultType' => 'future' + ), +)); + +$exchange->load_markets(); // https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + +// $exchange->verbose = true; // verbose mode on, uncomment for debugging + +$symbol = 'BTC/USDT'; + +$market = $exchange->market($symbol); + +// https://github.com/ccxt/ccxt/wiki/Manual#passing-parameters-to-api-methods +$params = array( + 'symbol' => $market['id'], // convert a unified CCXT symbol to an exchange-specific market id + 'leverage' => 10, +); + +// https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods +$response = $exchange->fapiPrivate_post_leverage($params); + +print_r ($response); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/binance-spot-trailing.md b/docs/ccxt/wiki/examples/php/binance-spot-trailing.md new file mode 100644 index 0000000..f94b9db --- /dev/null +++ b/docs/ccxt/wiki/examples/php/binance-spot-trailing.md @@ -0,0 +1,79 @@ +- [Binance Spot Trailing](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET_KEY', + // 'verbose' => true, // uncomment if debug output is needed +)); + +// You can read more about spot trailing orders here: +// https://github.com/binance/binance-spot-api-docs/blob/master/faqs/trailing-stop-faq.md + +// Example 1: Spot : trailing spot loss +function example_1($exchange) { + $markets = $exchange->load_markets(true); + + // create STOP_LOSS_LIMIT BUY with a trailing stop of 5%. + $symbol = 'LTC/USDT'; + $type = 'STOP_LOSS_LIMIT'; + $side = 'buy'; + $amount = 0.4; + $price = 25; + $params = array( + 'trailingDelta' => 500, // 5% in BIPS + ); + $create_order = $exchange->create_order($symbol, $type, $side, $amount, $price, $params); + + print_r('Create order id:' . $create_order['id']); + + // cancel created order + $canceled_order = $exchange->cancel_order($create_order['id'] . $symbol); + print_r ($canceled_order); +} + +// ----------------------------------------------------------------------------------------- + +// Example 2: Spot : TAKE_PROFIT_LIMIT BUY order +function example_2($exchange) { + $markets = $exchange->load_markets(true); + + // create STOP_LOSS_LIMIT BUY with a trailing stop of 5%. + $symbol = 'LTC/USDT'; + $type = 'TAKE_PROFIT_LIMIT'; + $side = 'buy'; + $amount = 0.2; + $price = 70; + $params = array( + 'trailingDelta' => 250, // 2.5% in BIPS + ); + + $create_order = $exchange->create_order($symbol, $type, $side, $amount, $price, $params); + + print_r('Create order id:' . $create_order['id']); + + // cancel created order + $canceled_order = $exchange->cancel_order($create_order['id'], $symbol); + print_r ($canceled_order); +} +// ----------------------------------------------------------------------------------------- + +function main($exchange) { + example_1($exchange); + example_2($exchange); +} + +main($exchange) + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv-since-limit.md b/docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv-since-limit.md new file mode 100644 index 0000000..a9de551 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv-since-limit.md @@ -0,0 +1,32 @@ +- [Bitfinex2 Fetch Ohlcv Since Limit](./examples/php/) + + + ```php + load_markets(); + +function run($exchange, $symbol, $timeframe, $since, $limit) { + $ohlcvs = $exchange->fetch_ohlcv($symbol, $timeframe, $since, $limit); + foreach ($ohlcvs as $v) { + printf ("%s O:%.8f H:%.8f L:%.8f C:%.8f V:%.8f\n", $exchange->iso8601($v[0]), $v[1], $v[2], $v[3], $v[4], $v[5]); + } +} + +printf("--------------------------------------------------------------\n"); +run($exchange, 'ETH/BTC', '1m', 1518842513569, 5); +printf("--------------------------------------------------------------\n"); +run($exchange, 'ETH/BTC', '1m', 1518842513569, 10); +printf("--------------------------------------------------------------\n"); + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv.md b/docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv.md new file mode 100644 index 0000000..586953a --- /dev/null +++ b/docs/ccxt/wiki/examples/php/bitfinex2-fetch-ohlcv.md @@ -0,0 +1,24 @@ +- [Bitfinex2 Fetch Ohlcv](./examples/php/) + + + ```php + 12000, +)); + +// bitfinex2 breaks occasionally + +for ($i = 0; $i < 1000; $i++) { + $ohlcv = $exchange->fetch_ohlcv('BTC/USD', '1m'); + print_r ($exchange->iso8601($ohlcv[0][0]) . "\t" . count($ohlcv) . "\n"); +} + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/bitfinex2-fetch-trades-since.md b/docs/ccxt/wiki/examples/php/bitfinex2-fetch-trades-since.md new file mode 100644 index 0000000..ac384c4 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/bitfinex2-fetch-trades-since.md @@ -0,0 +1,26 @@ +- [Bitfinex2 Fetch Trades Since](./examples/php/) + + + ```php + fetch_trades ('ETH/BTC', 1518983548636 - 2 * 24 * 60 * 60 * 1000); + +foreach ($trades as $trade) { + echo $trade['datetime'] . "\n"; +} +echo count ($trades) . " trades\n"; + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/bitmex-create-order.md b/docs/ccxt/wiki/examples/php/bitmex-create-order.md new file mode 100644 index 0000000..a59704d --- /dev/null +++ b/docs/ccxt/wiki/examples/php/bitmex-create-order.md @@ -0,0 +1,31 @@ +- [Bitmex Create Order](./examples/php/) + + + ```php + 'YOUR_API_KEY', // ←------------ replace with your keys + 'secret' => 'YOUR_SECRET', +)); + +$symbol = 'BTC/USD:BTC-220624'; +$type = 'StopLimit'; // # or 'market', or 'Stop' or 'StopLimit' +$side = 'sell'; // or 'buy' +$amount = 1.0; +$price = 6500.0; // or None + +// extra params and overrides +$params = array( + 'stopPx' => 6000.0, // if needed +); + +$order = $exchange->create_order($symbol, $type, $side, $amount, $price, $params); + +print_r($order); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/build-ohlcv-bars.md b/docs/ccxt/wiki/examples/php/build-ohlcv-bars.md new file mode 100644 index 0000000..d846c2d --- /dev/null +++ b/docs/ccxt/wiki/examples/php/build-ohlcv-bars.md @@ -0,0 +1,80 @@ +- [Build Ohlcv Bars](./examples/php/) + + + ```php + milliseconds() - 1000 * 60 * 30; // last 30 mins + $limit = 1000; + $trades = Async\await($exch->fetch_trades($symbol, $since, $limit)); + $generated_bars = $exch->build_ohlcvc($trades, $timeframe, $since, $limit); + // you can ignore 6th index ("count" field) from ohlcv entries, which is not part of OHLCV standard structure and is just added internally by `buildOHLCVC` method + var_dump('[REST] Constructed', count($generated_bars), 'bars from trades: ', $generated_bars); + }) (); +} + + +function example_with_watch_trades() { + return Async\async(function () { + $exch = new \ccxt\pro\binance(array()); + $timeframe = '1m'; + $symbol = 'DOGE/USDT'; + $limit = 1000; + $since = $exch->milliseconds() - 10 * 60 * 1000 * 1000; // last 10 hrs + $collected_trades = []; + $collected_bars = []; + while (true) { + $ws_trades = Async\await($exch->watch_trades($symbol, $since, $limit, array())); + $collected_trades = array_merge($collected_trades, $ws_trades); + $generated_bars = $exch->build_ohlcvc($collected_trades, $timeframe, $since, $limit); + // Note: first bar would be partially constructed bar and its 'open' & 'high' & 'low' prices (except 'close' price) would probably have different values compared to real bar on chart, because the first obtained trade timestamp might be somewhere in the middle of timeframe period, so the pre-period would be missing because we would not have trades data. To fix that, you can get older data with `fetchTrades` to fill up bars till start bar. + for ($i = 0; $i < count($generated_bars); $i++) { + $bar = $generated_bars[$i]; + $bar_timestamp = $bar[0]; + $collected_bars_length = count($collected_bars); + $last_collected_bar_timestamp = $collected_bars_length > 0 ? $collected_bars[$collected_bars_length - 1][0] : 0; + if ($bar_timestamp === $last_collected_bar_timestamp) { + // if timestamps are same, just updarte the last bar + $collected_bars[$collected_bars_length - 1] = $bar; + } elseif ($bar_timestamp > $last_collected_bar_timestamp) { + $collected_bars[] = $bar; + // remove the trades from saved array, which were till last collected bar's open timestamp + $collected_trades = $exch->filter_by_since_limit($collected_trades, $bar_timestamp); + } + } + // Note: first bar would carry incomplete values, please read comment in "buildOHLCVCFromWatchTrades" method definition for further explanation + var_dump('[WS] Constructed', count($collected_bars), 'bars from', $symbol, 'trades: ', $collected_bars); + } + }) (); +} + + +Async\await(example_with_fetch_trades()); + + +Async\await(example_with_watch_trades()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/built-in-rate-limiting-poller.md b/docs/ccxt/wiki/examples/php/built-in-rate-limiting-poller.md new file mode 100644 index 0000000..3632eda --- /dev/null +++ b/docs/ccxt/wiki/examples/php/built-in-rate-limiting-poller.md @@ -0,0 +1,24 @@ +- [Built In Rate Limiting Poller](./examples/php/) + + + ```php + fetch_order_book($symbol); + echo "----------------------------------------------------------------\n"; + echo date('c') . "\n"; + echo count($order_book['bids']) . " bids and " . count($order_book['asks']) . " asks\n"; + echo sprintf("bid: %.8f ask: %.8f", $order_book['bids'][0][0], $order_book['asks'][0][0]) . "\n"; +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/bybit-updated.md b/docs/ccxt/wiki/examples/php/bybit-updated.md new file mode 100644 index 0000000..9f396ce --- /dev/null +++ b/docs/ccxt/wiki/examples/php/bybit-updated.md @@ -0,0 +1,180 @@ +- [Bybit Updated](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET_KEY', + // 'verbose' => true, // uncomment if debug output is needed +)); + + +// Example 1: Spot : fetch balance, create order, cancel it and check canceled orders +function example_1($exchange) { + $exchange->options['defaultType'] = 'spot'; // very important set spot as default type + $markets = $exchange->load_markets(); + + // fetch spot balance + $balance = $exchange->fetch_balance(); + print_r($balance); + + // create limit order + $symbol = 'LTC/USDT'; + $type = 'limit'; + $side = 'buy'; + $amount = 0.1; + $price = 50; + $create_order = $exchange->create_order($symbol, $type, $side, $amount, $price); + print_r('Create order id:' . $create_order['id']); + + // cancel created order + $canceled_order = $exchange->cancel_order($create_order['id'], $symbol); + print_r($canceled_order); + + // Check canceled orders (bybit does not have a single endpoint to check orders + // we have to choose whether to check open or closed orders and call fetch_open_orders + // or fetch_closed_orders respectively + $orders = $exchange->fetch_closed_orders($symbol); + print_r($orders); + +} + +// ----------------------------------------------------------------------------------------- + +// Example 2 :: Swap : fetch balance, open a position and close it +function example_2($exchange) { + $exchange->options['defaultType'] = 'swap'; // very important set swap as default type + $markets = $exchange->load_markets(); + + // fetch swap balance + $balance = $exchange->fetch_balance(); + print_r($balance); + + // create market order and open position + $symbol = 'LTC/USDT:USDT'; + $type = 'market'; + $side = 'buy'; + $amount = 0.1; + $price = null; + $create_order = $exchange->create_order($symbol, $type, $side, $amount, $price); + print_r('Create order id:' . $create_order['id']); + + // check opened position + $symbols = [ $symbol ]; + $positions = $exchange->fetch_positions($symbols); + print_r($positions); + + // Close position by issuing a order in the opposite direction + $side = 'sell'; + $params = array ( + 'reduce_only' => true + ); + $close_position = $exchange->create_order($symbol, $type, $side, $amount, $price, $params); + print_r($close_position); +} + +// ----------------------------------------------------------------------------------------- + +// Example 3 :: USDC Swap : fetch balance, open a position and close it +function example_3($exchange) { + $exchange->options['defaultType'] = 'swap'; // very important set swap as default type + $markets = $exchange->load_markets(); + + // fetch USDC swap balance + // when no symbol is available we can show our intent + // of using USDC endpoints by either using defaultSettle in options or + // settle in params + // Using Options: exchange->$options['defaultSettle'] = 'USDC'; + // Using params: + $balance_params = array( + 'settle' => 'USDC' + ); + $balance = $exchange->fetch_balance($balance_params); + print_r($balance); + + + // create order and open position + // taking into consideration that USDC markets do not support + // market orders + $symbol = 'BTC/USD:USDC'; + $type = 'limit'; + $side = 'buy'; + $amount = 0.01; + $price = 20000; // adjust this accordingly + $create_order = $exchange->create_order($symbol, $type, $side, $amount, $price); + print_r('Create order id:' . $create_order['id']); + + // check if the order was filled and the position opened + $symbols = [ $symbol ]; + $positions = $exchange->fetch_positions($symbols); + print_r($positions); + + // close position (assuming it was already opened) by issuing an order in the opposite direction + $side = 'sell'; + $params = array ( + 'reduce_only' => true + ); + $close_position = $exchange->create_order($symbol, $type, $side, $amount, $price, $params); + print_r($close_position); +} + +// ----------------------------------------------------------------------------------------- + +// Example 3 :: Future : fetch balance, create stop-order and check open stop-orders +function example_4($exchange) { + $exchange->options['defaultType'] = 'future'; // very important set future as default type + $markets = $exchange->load_markets(); + + // fetch future balance + $balance = $exchange->fetch_balance(); + print_r($balance); + + + // create stop-order + $symbol = 'ETH/USD:ETH-220930'; + $type = 'limit'; + $side = 'buy'; + $amount = 10; // in USD for inverse futures + $price = 1200; + $stop_order_params = array( + 'position_idx' => 0, // 0 One-Way Mode, 1 Buy-side, 2 Sell-side, default = 0 + 'stopPrice' => 1000, // mandatory for stop orders + 'basePrice' => 1100 // mandatory for stop orders + ); + $stop_order = $exchange->create_order($symbol, $type, $side, $amount, $price, $stop_order_params); + print_r('Create order id:' . $stop_order['id']); + + // check opened stop-order + $open_order_params = array( + 'stop' => true + ); + $open_orders = $exchange->fetch_open_orders($symbol, null, null, $open_order_params); + print_r($open_orders); + + // cancell all open stop-orders + $cancel_orders = $exchange->cancel_all_orders($symbol, $open_order_params); + print_r($cancel_orders); +} + +// ----------------------------------------------------------------------------------------- + +function main($exchange) { + example_1($exchange); + example_2($exchange); + example_3($exchange); + example_4($exchange); +} + +main($exchange) + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/bytetrade-create-order.md b/docs/ccxt/wiki/examples/php/bytetrade-create-order.md new file mode 100644 index 0000000..52d85d2 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/bytetrade-create-order.md @@ -0,0 +1,32 @@ +- [Bytetrade Create Order](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', +)); + +$exchange->load_markets(); +$exchange->verbose = true; + +$symbol = 'BTC/USDT'; +$type = 'limit'; +$side = 'buy'; +$amount = 0.000865; +$price = 11560; + +$order = $exchange->create_order($symbol, $type, $side, $amount, $price); +print_r ($order); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/cache-exchange-instance-reuse.md b/docs/ccxt/wiki/examples/php/cache-exchange-instance-reuse.md new file mode 100644 index 0000000..11d6a72 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/cache-exchange-instance-reuse.md @@ -0,0 +1,34 @@ +- [Cache Exchange Instance Reuse](./examples/php/) + + + ```php + set_markets($loaded_cache['markets'], $loaded_cache['currencies']); + print("{$exchange_id} Loaded markets from cache in " . (microtime(true) - $start_time) . " seconds\n"); + } else { + $markets = $exchange->load_markets(); + file_put_contents($cache_location, json_encode(['markets'=>$markets, 'currencies'=>$exchange->currencies])); + print("{$exchange_id} Loaded fresh markets in " . (microtime(true) - $start_time) . " seconds\n"); + } + return $exchange; +} + +$exchange1 = create_exchange('bittrex', ['custom_id'=>'mybittrex1']); +print ($exchange1->fetch_trades('BTC/USDT')[0]); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/cancel-order.md b/docs/ccxt/wiki/examples/php/cancel-order.md new file mode 100644 index 0000000..a005f5a --- /dev/null +++ b/docs/ccxt/wiki/examples/php/cancel-order.md @@ -0,0 +1,41 @@ +- [Cancel Order](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', + // 'verbose' => true, +)); + +try { + + $symbol = 'XRP/BTC'; + + // if you want to find out your open orders, you can use the below code, + if ($exchange->has['fetchOpenOrders']) { + $open_orders = $exchange->fetchOpenOrders($symbol); + } else if ($exchange->has['fetchOrders']) { + $all_orders = $exchange->fetchOrders($symbol); + $open_orders = $exchange->filter_by($all_orders, 'status', 'open'); + } else { + echo ($exchange->id . ' fetch(Open)Orders not supported yet'); + } + + // now, depending the $open_orders array, fill the below ID + $orderId = 'xxxxxxxx'; + + // to cancel multiple orders together asynchronously, see the "async-await-multiple.php" example file to adopt the code + $exchange->cancel_order($orderId, $symbol); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/cli.md b/docs/ccxt/wiki/examples/php/cli.md new file mode 100644 index 0000000..7f6ff9b --- /dev/null +++ b/docs/ccxt/wiki/examples/php/cli.md @@ -0,0 +1,210 @@ +- [Cli](./examples/php/) + + + ```php + 2) { + # first we filter the args + $verbose = count(array_filter($argv, function ($option) { return strstr($option, '--verbose') !== false; })) > 0; + $args = array_values(array_filter($argv, function ($option) { return strstr($option, '--verbose') === false; })); + + $demo = count(array_filter($argv, function ($option) { return strstr($option, '--demo') !== false; })) > 0; + $args = array_values(array_filter($argv, function ($option) { return strstr($option, '--demo') === false; })); + + $test = count(array_filter($args, function ($option) { return strstr($option, '--test') !== false || strstr($option, '--testnet') !== false || strstr($option, '--sandbox') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--test') === false && strstr($option, '--testnet') === false && strstr($option, '--sandbox') === false; })); + + $debug = count(array_filter($args, function ($option) { return strstr($option, '--debug') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--debug') === false; })); + + $spot = count(array_filter($args, function ($option) { return strstr($option, '--spot') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--spot') === false; })); + + + $no_keys = count(array_filter($args, function ($option) { return strstr($option, '--no-keys') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--no-keys') === false; })); + + $swap = count(array_filter($args, function ($option) { return strstr($option, '--swap') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--swap') === false; })); + + $future = count(array_filter($args, function ($option) { return strstr($option, '--future') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--future') === false; })); + + $option = count(array_filter($args, function ($option) { return strstr($option, '--option') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--option') === false; })); + + $new_updates = count(array_filter($args, function ($option) { return strstr($option, '--newUpdates') !== false; })) > 0; + $args = array_values(array_filter($args, function ($option) { return strstr($option, '--newUpdates') === false; })); + + $id = $args[1]; + $member = $args[2]; + $args = array_slice($args, 3); + $exchange_found = in_array($id, \ccxt\async\Exchange::$exchanges); + + if ($exchange_found) { + + $keys_global = './keys.json'; + $keys_local = './keys.local.json'; + $keys_file = file_exists($keys_local) ? $keys_local : $keys_global; + + $config = json_decode(file_get_contents($keys_file), true); + $settings = array_key_exists($id, $config) ? $config[$id] : array(); + $config = array_merge($settings, array( + 'verbose' => $verbose && $debug, // set to true for debugging + )); + + // instantiate the exchange by id + $exchange = null; + if (in_array($id, \ccxt\pro\Exchange::$exchanges)) { + $exchange = '\\ccxt\\pro\\' . $id; + } else { + $exchange = '\\ccxt\\async\\' . $id; + } + $exchange = new $exchange($config); + + if ($spot) { + $exchange->options['defaultType'] = 'spot'; + } else if ($swap) { + $exchange->options['defaultType'] = 'swap'; + } else if ($future) { + $exchange->options['defaultType'] = 'future'; + } else if ($option) { + $exchange->options['defaultType'] = 'option'; + } + + if ($new_updates) { + $exchange->newUpdates = true; + } + + if ($test) { + $exchange->set_sandbox_mode(true); + } else if ($demo) { + $exchange->enable_demo_trading(true); + } + + if (!$no_keys) { + // check auth keys in env var + foreach ($exchange->requiredCredentials as $credential => $is_required) { + if ($is_required && !$exchange->$credential ) { + $credential_var = strtoupper($id . '_' . $credential); // example: KRAKEN_SECRET + $credential_value = getenv($credential_var); + if ($credential_value) { + if (str_contains($credential_value, "---BEGIN")) { + $credential_value = str_replace('\n', "\n", $credential_value); + } + $exchange->$credential = $credential_value; + } + } + } + } + + $args = array_map(function ($arg) { + global $exchange; + if ($arg[0] === '{' || $arg[0] === '[') + return json_decode($arg, true); + if ($arg === 'NULL' || $arg === 'null') + return null; + if (preg_match('/^[+-]?[0-9]+$/', $arg)) + return intval ($arg); + if (preg_match('/^[.eE0-9+-]+$/', $arg)) + return floatval ($arg); + if (preg_match('/^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}/', $arg)) + return $exchange->parse8601($arg); + else + return $arg; + }, $args); + + $markets_path = '.cache/' . $exchange->id . '-markets.json'; + if (file_exists($markets_path)) { + $markets = json_decode(file_get_contents($markets_path), true); + $exchange->markets = $markets; + } else { + // yield $exchange->load_markets(); + } + + $exchange->verbose = $verbose; + + echo $exchange->id . '->' . $member . '(' . @implode(', ', $args) . ")\n"; + + $is_ws_method = false; + + if (mb_strpos($member, 'watch') !== false) { + $is_ws_method = true; + } + + while (true) { + + try { + + $result = yield call_user_func_array(array($exchange, $member), $args); + + echo print_r($result, true) . "\n"; + + if (!$is_ws_method) { + # make sure to exit with exit code zero here + exit(0); + } + + } catch (\ccxt\NetworkError $e) { + + echo get_class($e) . ': ' . $e->getMessage() . "\n"; + exit(1); + + } catch (\ccxt\ExchangeError $e) { + + echo get_class($e) . ': ' . $e->getMessage() . "\n"; + exit(1); + + } catch (Exception $e) { + + echo get_class($e) . ': ' . $e->getMessage() . "\n"; + + if (property_exists($exchange, $member)) { + + echo print_r($exchange->$member, true) . "\n"; + + } else { + + echo $exchange->id . '->' . $member . ": no such property\n"; + } + exit(1); + } + } + } else { + + echo 'Exchange ' . $id . " not found\n"; + exit(1); + } + + } else { + print_r('Usage: php -f ' . __FILE__ . " exchange_id member [args...]\n"); + exit(1); + } +}; + +function teste() { + yield 0; +} + +$promise = Async\coroutine($main); +Async\await($promise); + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/coinbase-fetch-all-balances.md b/docs/ccxt/wiki/examples/php/coinbase-fetch-all-balances.md new file mode 100644 index 0000000..08c253c --- /dev/null +++ b/docs/ccxt/wiki/examples/php/coinbase-fetch-all-balances.md @@ -0,0 +1,45 @@ +- [Coinbase Fetch All Balances](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', + // 'verbose' => true, // uncomment for debugging +)); + +$exchange->load_markets(); + +// $exchange->verbose = true; // uncomment for debugging + +$result = array(); +$params = array(); +$loop = true; +do { + $balance = $exchange->fetch_balance($params); + $pagination = $exchange->safe_value($balance['info'], 'pagination'); + if ($pagination === null) { + $loop = false; + } else { + $next_starting_after = $exchange->safe_string ($pagination, 'next_starting_after'); + if ($next_starting_after !== null) { + $params['starting_after'] = $next_starting_after; + } else { + $loop = false; + } + } + echo $exchange->iso8601($exchange->milliseconds()) . "\n"; + $result = $exchange->deep_extend($result, $balance); +} while ($loop); + +echo "======================================================================\n"; +var_dump($result); + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/coinbasepro-cursor-pagination.md b/docs/ccxt/wiki/examples/php/coinbasepro-cursor-pagination.md new file mode 100644 index 0000000..e532111 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/coinbasepro-cursor-pagination.md @@ -0,0 +1,53 @@ +- [Coinbasepro Cursor Pagination](./examples/php/) + + + ```php + 'YOUR_API_KEY', // required for fetch_orders, fetch_my_trades + 'secret' => 'YOUR_SECRET', // required for fetch_orders, fetch_my_trades + 'password' => 'YOUR_PASSWORD', // required for fetch_orders, fetch_my_trades + // 'verbose' => true, // uncomment for debugging +)); + +$exchange->load_markets (); + +// $exchange->verbose = true; // uncomment for debugging + +$all_results = array(); + +$symbol = 'ETH/USD'; +$since = null; +$limit = 100; +$params = array(); + +do { + // any of the following methods should work: + // $results = $exchange->fetch_orders($symbol, $since, $limit, $params); + // $results = $exchange->fetch_my_trades($symbol, $since, $limit, $params); + $results = $exchange->fetch_trades($symbol, $since, $limit, $params); + echo $exchange->iso8601($exchange->milliseconds()); + echo ' fetched ' . count($results) . " results\n"; + $all_results = array_merge ($all_results, $results); + if (count($results) > 0) { + $last = count($results) - 1; + echo ' last result ' . $results[$last]['id'] . ' ' . $results[$last]['datetime'] . "\n"; + echo ' first result ' . $results[0]['id'] . ' ' . $results[0]['datetime'] . "\n"; + } else { + break; + } + @$params['after'] = $exchange->last_response_headers['cb-after'][0]; + +// uncomment one of the following: +// } while (true); // fetch all results forever +} while (count($all_results) < 1000); // fetch up to 1000 results + +echo "fetched " . count($all_results) . " results in total\n"; + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/coinone-markets.md b/docs/ccxt/wiki/examples/php/coinone-markets.md new file mode 100644 index 0000000..5f8c3c0 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/coinone-markets.md @@ -0,0 +1,20 @@ +- [Coinone Markets](./examples/php/) + + + ```php + true, // uncomment for verbose output +)); + +$markets = $exchange->load_markets(); + +var_dump($markets); +echo "\n" . $exchange->name . " supports " . count($markets) . " pairs\n"; + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/compare-two-exchanges-capabilities.md b/docs/ccxt/wiki/examples/php/compare-two-exchanges-capabilities.md new file mode 100644 index 0000000..85533ee --- /dev/null +++ b/docs/ccxt/wiki/examples/php/compare-two-exchanges-capabilities.md @@ -0,0 +1,61 @@ +- [Compare Two Exchanges Capabilities](./examples/php/) + + + ```php + has) ? array_keys($exchange_1->has) : array(); + $keys_2 = is_array($exchange_2->has) ? array_keys($exchange_2->has) : array(); + // check missing from exchange-1 + var_dump('### checking missing functionalities from exchange-1:', $exchange_1->id); + for ($i = 0; $i < count($keys_2); $i++) { + $key = $keys_2[$i]; + if ($exchange_2->has[$key]) { + if (!in_array($key, $keys_1)) { + var_dump($prefix, $key, 'does not exist in', $exchange_1->id, 'as opposed to', $exchange_2->id); + } elseif ($exchange_2->has[$key] !== $exchange_1->has[$key]) { + var_dump($prefix, $key, '> ', $exchange_1->id, ':', $exchange_1->has[$key], ',', $exchange_2->id, ':', $exchange_2->has[$key]); + } + } + } + // check missing from exchange-2 + var_dump('### checking missing functionalities from exchange-2:', $exchange_2->id); + for ($i = 0; $i < count($keys_1); $i++) { + $key = $keys_1[$i]; + if ($exchange_1->has[$key]) { + if (!in_array($key, $keys_2)) { + var_dump($prefix, $key, 'does not exist in', $exchange_2->id, 'as opposed to', $exchange_1->id); + } elseif ($exchange_1->has[$key] !== $exchange_2->has[$key]) { + var_dump($prefix, $key, '> ', $exchange_2->id, ':', $exchange_2->has[$key], ',', $exchange_1->id, ':', $exchange_1->has[$key]); + } + } + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/php/create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..ea616bb --- /dev/null +++ b/docs/ccxt/wiki/examples/php/create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,90 @@ +- [Create Order Position With Takeprofit Stoploss](./examples/php/) + + + ```php + version); + + +// ------------------------------------------------------------------------------ +function example() { + // at this moment, only OKX support embedded stop-loss & take-profit orders in unified manner. other exchanges are being added actively and will be available soon. + return Async\async(function () { + $exchange = new \ccxt\async\okx(array( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + 'password' => 'YOUR_API_PASSWORD', + )); + $symbol = 'DOGE/USDT:USDT'; + $side = 'buy'; // 'buy' | 'sell' + $order_type = 'limit'; // 'market' | 'limit' + $amount = 1; // how many contracts (see `market(symbol).contractSize` to find out coin portion per one contract) + Async\await($exchange->load_markets()); + $market = $exchange->market($symbol); + $ticker = Async\await($exchange->fetch_ticker($symbol)); + $last_price = $ticker['last']; + $ask_price = $ticker['ask']; + $bid_price = $ticker['bid']; + // if order_type is 'market', then price is not needed + $price = null; + // if order_type is 'limit', then set a price at your desired level + if ($order_type === 'limit') { + $price = ($side === 'buy') ? $bid_price * 0.95 : $ask_price * 1.05; // i.e. 5% from current price + } + // set trigger price for stop-loss/take-profit to 2% from current price + // (note, across different exchanges "trigger" price can be also mentioned with different synonyms, like "activation price", "stop price", "conditional price", etc. ) + $stop_loss_trigger_price = ($order_type === 'market' ? $last_price : $price) * ($side === 'buy' ? 0.98 : 1.02); + $take_profit_trigger_price = ($order_type === 'market' ? $last_price : $price) * ($side === 'buy' ? 1.02 : 0.98); + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + $params = array( + 'stopLoss' => array( + 'triggerPrice' => $stop_loss_trigger_price, + 'price' => $stop_loss_trigger_price * 0.98, + ), + 'takeProfit' => array( + 'triggerPrice' => $take_profit_trigger_price, + 'price' => $take_profit_trigger_price * 0.98, + ), + ); + $position_amount = $market['contractSize'] * $amount; + $position_value = $position_amount * $last_price; + // log + var_dump('Going to open a position', 'for', $amount, 'contracts worth', $position_amount, $market['base'], '~', $position_value, $market['settle'], 'using', $side, $order_type, 'order (', ($order_type === 'limit' ? $exchange->price_to_precision($symbol, $price) : ''), '), using the following params:'); + var_dump($params); + var_dump('-----------------------------------------------------------------------'); + try { + $created_order = Async\await($exchange->create_order($symbol, $order_type, $side, $amount, $price, $params)); + var_dump('Created an order', $created_order); + // Fetch all your open orders for this symbol + // - use 'fetchOpenOrders' or 'fetchOrders' and filter with 'open' status + // - note, that some exchanges might return one order object with embedded stoploss/takeprofit fields, while other exchanges might have separate stoploss/takeprofit order objects + $all_open_orders = Async\await($exchange->fetch_open_orders($symbol)); + var_dump('Fetched all your orders for this symbol', $all_open_orders); + } catch(Exception $e) { + var_dump(((string) $e)); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/create-order-ws-example.md b/docs/ccxt/wiki/examples/php/create-order-ws-example.md new file mode 100644 index 0000000..a61a78a --- /dev/null +++ b/docs/ccxt/wiki/examples/php/create-order-ws-example.md @@ -0,0 +1,52 @@ +- [Create Order Ws Example](./examples/php/) + + + ```php + 'MY_API_KEY', + 'secret' => 'MY_SECRET', + )); + $exchange->set_sandbox_mode(true); + $exchange->verbose = true; // uncomment for debugging purposes if necessary + // load markets + Async\await($exchange->load_markets()); + $symbol = 'ETH/USDT'; + $type = 'limit'; + $side = 'buy'; + $amount = 0.01; + $price = 1000; + $orders = []; + for ($i = 1; $i < 5; $i++) { + $response = Async\await($exchange->create_order_ws($symbol, $type, $side, $amount, $price)); + $price += $i; + $orders[] = $response; + } + var_dump($orders); + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/create-orders-example.md b/docs/ccxt/wiki/examples/php/create-orders-example.md new file mode 100644 index 0000000..e90777c --- /dev/null +++ b/docs/ccxt/wiki/examples/php/create-orders-example.md @@ -0,0 +1,52 @@ +- [Create Orders Example](./examples/php/) + + + ```php + 'MY_API_KEY', + 'secret' => 'MY_SECRET', + )); + $exchange->set_sandbox_mode(true); + Async\await($exchange->load_markets()); + $exchange->verbose = true; // uncomment for debugging purposes if necessary + $orders = Async\await($exchange->create_orders([array( + 'symbol' => 'LTC/USDT:USDT', + 'type' => 'limit', + 'side' => 'buy', + 'amount' => 10, + 'price' => 55, +), array( + 'symbol' => 'ETH/USDT:USDT', + 'type' => 'market', + 'side' => 'buy', + 'amount' => 0.5, +)])); + var_dump($orders); + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/create-trailing-amount-order.md b/docs/ccxt/wiki/examples/php/create-trailing-amount-order.md new file mode 100644 index 0000000..9180a63 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/create-trailing-amount-order.md @@ -0,0 +1,61 @@ +- [Create Trailing Amount Order](./examples/php/) + + + ```php + 'MY_API_KEY', + 'secret' => 'MY_SECRET', + )); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + Async\await($exchange->load_markets()); + $symbol = 'BTC/USDT:USDT'; + $order_type = 'market'; + $side = 'sell'; + $amount = 0.0001; + $price = null; + $reduce_only = true; + $trailing_amount = 100; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + $params = array( + 'reduceOnly' => $reduce_only, + 'trailingAmount' => $trailing_amount, + ); + try { + $create_order = Async\await($exchange->create_order($symbol, $order_type, $side, $amount, $price, $params)); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + var_dump($create_order); + } catch(Exception $e) { + var_dump(((string) $e)); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/create-trailing-percent-order.md b/docs/ccxt/wiki/examples/php/create-trailing-percent-order.md new file mode 100644 index 0000000..fdcd8f3 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/create-trailing-percent-order.md @@ -0,0 +1,61 @@ +- [Create Trailing Percent Order](./examples/php/) + + + ```php + 'MY_API_KEY', + 'secret' => 'MY_SECRET', + )); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + Async\await($exchange->load_markets()); + $symbol = 'BTC/USDT:USDT'; + $order_type = 'market'; + $side = 'sell'; + $amount = 0.0001; + $price = null; + $reduce_only = true; + $trailing_percent = 10; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + $params = array( + 'reduceOnly' => $reduce_only, + 'trailingPercent' => $trailing_percent, + ); + try { + $create_order = Async\await($exchange->create_order($symbol, $order_type, $side, $amount, $price, $params)); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingPercentOrder (symbol, order_type, side, amount, price, trailingPercent, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + var_dump($create_order); + } catch(Exception $e) { + var_dump(((string) $e)); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/error-handling-message.md b/docs/ccxt/wiki/examples/php/error-handling-message.md new file mode 100644 index 0000000..c2cc26d --- /dev/null +++ b/docs/ccxt/wiki/examples/php/error-handling-message.md @@ -0,0 +1,56 @@ +- [Error Handling Message](./examples/php/) + + + ```php + 'foo', + 'secret' => 'bar', +)); + +$message = null; + +try { + + $result = $exchange->fetch_balance (); + var_dump ($result); + +// these catch-clauses are showing the proper way of handling the errors + +} catch (\ccxt\AuthenticationError $e) { + + // handle authentication error here + +} catch (\ccxt\NetworkError $e) { + + // your code to handle the network code and retries here + +} catch (\ccxt\ExchangeError $e) { + + // your code to handle an exchange error + +} catch (Exception $e) { + + // This is an example of how NOT TO DO error handling + // One should not rely on the message string contained in the exception + // If you want to access it, that might indicate a design error in your code. + // See: https://github.com/ccxt/ccxt/issues/3053 + + $message = $e->getMessage(); + + if (preg_match ('/[a-z]+\s+(\{.+\})$/iu', $e->getMessage(), $matches)) { + $message = $matches[1]; + } + + echo print_r ($message, true) . "\n"; + +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/exchange-properties.md b/docs/ccxt/wiki/examples/php/exchange-properties.md new file mode 100644 index 0000000..f3845ec --- /dev/null +++ b/docs/ccxt/wiki/examples/php/exchange-properties.md @@ -0,0 +1,65 @@ +- [Exchange Properties](./examples/php/) + + + ```php + 2) { + + $id = $argv[1]; + + $exchange_found = in_array ($id, $exchanges); + + if ($exchange_found) { + + echo 'Instantiating ', $id, ' exchange', "\n"; + + $symbol = $argv[2]; + + // instantiate the exchange by id + $exchange = '\\ccxt\\' . $id; + $exchange = new $exchange(array( + // 'verbose' => true, // uncomment for debug output + // set custom headers if needed + // 'headers' => array( + // 'YOUR_HEADER' => 'YOUR_VALUE', + // ), + )); + + // load all markets from the exchange + $markets = $exchange->load_markets (); + + // you can also set any of the exchange properties after instantiation + // $exchange->verbose = true; + + $ticker = $exchange->fetch_ticker ($symbol); + + // output a list of all market symbols + print_r ($ticker); + + } else { + + echo 'Exchange ', $id, ' not found', "\n"; + print_supported_exchanges (); + } + +} else { + + echo 'Usage: php -f ', __FILE__, ' id symbol', "\n"; + print_supported_exchanges (); + +} + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/fetch-balance.md b/docs/ccxt/wiki/examples/php/fetch-balance.md new file mode 100644 index 0000000..49a7855 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/fetch-balance.md @@ -0,0 +1,28 @@ +- [Fetch Balance](./examples/php/) + + + ```php + true, // for debugging + // 'timeout' => 30000, + "apiKey" => "YOUR_API_KEY", + "secret" => "YOUR_API_SECRET", +)); + +try { + // about balance, read docs at : https://github.com/ccxt/ccxt/wiki/Manual#balance-structure + $result = $exchange->fetch_balance (); + print_r ($result); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/fetch-first-ohlcv-timestamp.md b/docs/ccxt/wiki/examples/php/fetch-first-ohlcv-timestamp.md new file mode 100644 index 0000000..661aaf0 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/fetch-first-ohlcv-timestamp.md @@ -0,0 +1,108 @@ +- [Fetch First Ohlcv Timestamp](./examples/php/) + + + ```php + market($symbol); + $market_type = $exchange->safe_string($market, 'type'); + $features = $exchange->safe_dict($exchange->features, $market_type, array()); + if ($market['subType'] !== null) { + $features = $exchange->safe_dict($features, $market['subType'], array()); + } + $ohlcv = $exchange->safe_dict($features, 'fetchOHLCV'); + if ($ohlcv === null) { + return null; + } + $limit = $exchange->safe_integer($ohlcv, 'limit'); + $fetch_params = array( + 'maxRetriesOnFailure' => 3, + ); + // start loop + $current_since = $exchange->milliseconds() - $milliseconds_per_day * ($limit - 1); + $found_start_time = 0; + // eslint-disable-next-line + while (true) { + $current_since = max($current_since, $minimum_timestamp); + $daily_bars = Async\await($exchange->fetch_ohlcv($symbol, '1d', $current_since, $limit, $fetch_params)); + if (count($daily_bars) <= 0) { + break; // if no days returned, then probably start date was passed + } + $first_ts = $daily_bars[0][0]; + if ($first_ts === $found_start_time) { + // if the first timestamp is equal to the last-fetched timestamp, then break here, because some exchanges still return initial bar even if since is much ahead to listing time + break; + } + $found_start_time = $first_ts; + $current_since = $found_start_time - $milliseconds_per_day * ($limit - 1); // shift 'since' one step back + if (count($daily_bars) === 1) { + // in some cases, some exchanges might still return first bar of chart when endtime overlaps previous day + break; + } + } + // if minute resolution needed + if ($use_minute_timeframe) { + $max_iteration = ((int) ceil($minutes_per_day / $limit)) * 2; + $all_promises = []; + for ($i = 0; $i < $max_iteration; $i++) { + $current_since = $found_start_time - $milliseconds_per_day + $i * $limit * 60 * 1000; // shift one-duration back for more accuracy for different kind of exchanges, like OKX, where first daily bar is offset by one day, but minute bars present + $all_promises[] = $exchange->fetch_ohlcv($symbol, '1m', $current_since, $limit, $fetch_params); + } + $all_responses = Async\await(Promise\all($all_promises)); + // find earliest bar + for ($i = 0; $i < count($all_responses); $i++) { + $response = $all_responses[$i]; + if (count($response) > 0) { + $found_start_time = $response[0][0]; + break; + } + } + } + return $found_start_time; + }) (); +} + + +// ###### Usage ###### +$run_example = false; // set to true to run example + + +if ($run_example) { + $my_ex = new \ccxt\async\binance(); + Async\await($my_ex->load_markets()); + $symbol = 'TRUMP/USDT'; + $earliest_timestamp = Async\await(fetch_first_bar_timestamp($my_ex, $symbol, true)); + var_dump('- Earliest bar timestamp:', $earliest_timestamp, ', readable: ', $my_ex->iso8601($earliest_timestamp)); + var_dump('- market.created value:', $my_ex->market($symbol)['created']); +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/fetch-ohlcv-many-exchanges-continuosly.md b/docs/ccxt/wiki/examples/php/fetch-ohlcv-many-exchanges-continuosly.md new file mode 100644 index 0000000..eae75db --- /dev/null +++ b/docs/ccxt/wiki/examples/php/fetch-ohlcv-many-exchanges-continuosly.md @@ -0,0 +1,75 @@ +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/php/) + + + ```php + fetch_ohlcv($symbol)); + $ohlcv_length = count($ohlcv); + var_dump('Fetched ', $exchange->id, ' - ', $symbol, ' candles. last candle: ', $ohlcv[$ohlcv_length - 1]); + } catch(Exception $e) { + var_dump($e); + break; + } + } + + }) (); +} + + +// start exchanges and fetch OHLCV loop +function start_exchange($exchange_name, $symbols) { + return Async\async(function () use ($exchange_name, $symbols) { + $exchange_class = '\ccxt\async\\'.$exchange_name; + $ex = new $exchange_class(array()); + $promises = []; + for ($i = 0; $i < count($symbols); $i++) { + $symbol = $symbols[$i]; + $promises[] = fetch_ohlcv_continuously($ex, $symbol); + } + Async\await(Promise\all($promises)); + Async\await($ex->close()); + }) (); +} + + +// main function +function example() { + return Async\async(function () { + $exchanges = ['binance', 'okx', 'kraken']; + $symbols = ['BTC/USDT', 'ETH/USDT']; + $promises = []; + for ($i = 0; $i < count($exchanges); $i++) { + $exchange_name = $exchanges[$i]; + $promises[] = start_exchange($exchange_name, $symbols); + } + Async\await(Promise\all($promises)); + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/fetch-ohlcv.md b/docs/ccxt/wiki/examples/php/fetch-ohlcv.md new file mode 100644 index 0000000..387b7be --- /dev/null +++ b/docs/ccxt/wiki/examples/php/fetch-ohlcv.md @@ -0,0 +1,44 @@ +- [Fetch Ohlcv](./examples/php/) + + + ```php + milliseconds() - 86400 * 1000; // last 24 hrs + $ohlcv = Async\await($myex->fetch_ohlcv('BTC/USDT', '1m', $from_timestamp, 3, array( + 'whatever' => 123, + ))); + $length = count($ohlcv); + if ($length > 0) { + $last_price = $ohlcv[$length - 1][4]; + var_dump('Fetched ', $length, ' candles for ', $myex->id, ': last close ', $last_price); + } else { + var_dump('No candles have been fetched'); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/fetch-order.md b/docs/ccxt/wiki/examples/php/fetch-order.md new file mode 100644 index 0000000..af62a12 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/fetch-order.md @@ -0,0 +1,95 @@ +- [Fetch Order](./examples/php/) + + + ```php + 'YOUR_API_KEY', // edit this line + 'secret' => 'YOUR_SECRET', // edit this line + + // this is not required! uncomment only if you want to debug it + // 'verbose' => true, + +)); + +// ---------------------------------------------------------------------------- + +if ($exchange->has['fetchOrder'] === false) { + + echo $exchange->id . " does not support fetchOrder() yet\n"; + exit(); + +} else if ($exchange->has['fetchOrder'] === 'emulated') { + + echo $exchange->id . " fetchOrder() is 'emulated' and relies " . + "on the `.orders` cache as described in the Manual:\n" . + "https://github.com/ccxt/ccxt/wiki/Manual#orders-cache\n"; + + exit(); + +} + +// ---------------------------------------------------------------------------- + +if ($exchange->has['fetchOrder'] === true) { + + // this is the order id returned from by any of the order API methods + // createOrder(), fetchOrders(), fetchOpenOrders(), fetchClosedOrders() + $order_id = '45125111901'; // edit this line + + // most of exchanges will not require the symbol argument, but some of + // the exchanges will require it, and it's safe to always pass the + // symbol argument to fetchOrder along with the order id + $symbol = 'ETH/BTC'; // edit this line + + // these params are exchange-specific, most of exchanges don't require them + // some exchanges or methods may require this or that parameter in certain + // cases, consult the exchanges' API docs to get a list of all params + $params = array( + // 'param1' => 'value1', // uncomment and edit if necessary + // 'param2' => 'value2', // uncomment and edit if necessary + ); + + try { + + $order = $exchange->fetch_order($order_id, $symbol, $params); + print_r($order); + + } catch (\ccxt\NetworkError $e) { + + // in case of a networking or a connectivity error instead of simply + // printing the error message here, the application should define + // the behavior or a recover-and-retry strategy, because networking + // errors are temporary and occasionally happen with all exchanges + // a retry after a while may be enough, depending on the error + echo get_class ($e) . ': ' . $e->getMessage() . "\n"; + + } catch (\ccxt\ExchangeError $e) { + + // in case of an exchange error the application should stop and signal + // the error to the developer or to the user, human interference is + // required to resolve an exchange error in each specific case + echo get_class($e) . ': ' . $e->getMessage() . "\n"; + + } catch (Exception $e) { + + echo get_class($e) . ': ' . $e->getMessage() . "\n"; + + } + +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/fetch-ticker.md b/docs/ccxt/wiki/examples/php/fetch-ticker.md new file mode 100644 index 0000000..2e7b496 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/fetch-ticker.md @@ -0,0 +1,45 @@ +- [Fetch Ticker](./examples/php/) + + + ```php + true, // for debugging + 'timeout' => 30000, +)); + +// If you want to use test-mode (a.k.a. sandbox), uncomment the following line: +// $exchange->set_sandbox_mode(true); + +$symbol = 'ETH/USDT'; + +try { + if (array_key_exists($symbol, $exchange->markets)) { + $market = $exchange->market($symbol); + } else { + echo $exchange->id . ' does not have market symbol ' . $symbol . "; Supported symbols:\n"; + echo print_r($exchange->symbols, true) . "\n"; + exit(); + } + if($market['active']) { + $result = $exchange->fetch_ticker($symbol); + echo "Ticker: " . $result['symbol'] . ', 24hr high: '. $result['high']. "\n"; + } else { + echo $exchange->id . ' market ' . $symbol . " is not active!\n"; + } +} catch (Exception $e) { + if ($e instanceof \ccxt\NetworkError) { + echo '[Network Error] ' . $e->getMessage() . "\n"; + } else { + echo '['. get_class($e) . '] ' . $e->getMessage() . "\n"; + } +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/fetch-tickers.md b/docs/ccxt/wiki/examples/php/fetch-tickers.md new file mode 100644 index 0000000..3c3cd30 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/fetch-tickers.md @@ -0,0 +1,46 @@ +- [Fetch Tickers](./examples/php/) + + + ```php + true, // for debugging + 'timeout' => 30000, +)); + +$markets = $exchange->load_markets(); + +try { + if ($exchange->has['fetchTickers']) { + // one API call for all tickers (preferred way) + $result = $exchange->fetch_tickers (); // note, don't call it for specifically binance more than once in every few seconds. + echo "Called fetchTickers() for all tickers at once. Results count: " . count($result) . "\n"; + } else if ($exchange->has['fetchTicker']) { + // Individual API calls for all tickers one by one (non-preferred way) + echo "fetchTickers() is not supported by " . $exchange->id . ", calling individual fetchTicker() for each symbol instead.\n"; + // fetch one by one (not recommended) + $i = 0; + $test_symbols_amount = 4; + foreach ($markets as $symbol => $m) { + if ($i++ && $i > $test_symbols_amount) { + echo "Stopping after getting " . $test_symbols_amount . " test symbols.\n"; + break; + } + $result = $exchange->fetch_ticker($symbol); + echo "Fetched ticker for " . $result['symbol'] . ", 24hr high: " . $result['high'] . "\n"; + } + } else { + echo "fetchTicker/s() not supported by " . $exchange->id . ", skipping.\n"; + } +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/gateio-futures.md b/docs/ccxt/wiki/examples/php/gateio-futures.md new file mode 100644 index 0000000..39e5349 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/gateio-futures.md @@ -0,0 +1,54 @@ +- [Gateio Futures](./examples/php/) + + + ```php + 'YOUR_API_KEY', // ←------------ replace with your keys + 'secret' => 'YOUR_SECRET_KEY', + 'options' => array( + 'defaultType' => 'future', + ), + // 'verbose' => true, // uncomment if debug output is needed +)); + +// Example 1: Creating future (market) order +try { + $markets = $exchange->load_markets (); + + // find a future + $symbol = null; + foreach($markets as $key => $market) { + if ($market['future']) { + $symbol = $market['symbol']; // example BTC/USDT:USDT-22031 + break; + } + } + if ($symbol != null) { + $type = 'market'; + $side = 'buy'; + $amount = 1; + + // placing an order + $order = $exchange->create_order ($symbol, $type, $side, $amount); + var_dump ($order); + + // listing open orders + $open_orders = $exchange->fetch_open_orders($symbol); + var_dump($open_orders); + } + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/gateio-swaps.md b/docs/ccxt/wiki/examples/php/gateio-swaps.md new file mode 100644 index 0000000..7caa46f --- /dev/null +++ b/docs/ccxt/wiki/examples/php/gateio-swaps.md @@ -0,0 +1,91 @@ +- [Gateio Swaps](./examples/php/) + + + ```php + 'YOUR_API_KEY', // ←------------ replace with your keys + 'secret' => 'YOUR_SECRET_KEY', + 'options' => array( + 'defaultType' => 'swap', + ), + // 'verbose' => true, // uncomment if debug output is needed +)); + +// Example 1: Creating and canceling a linear future (limit) order +try { + $markets = $exchange->load_markets (); + $symbol = 'LTC/USDT:USDT'; + $type = 'limit'; + $side = 'buy'; + $amount = 1; + $price = 55; + + // placing an order + $order = $exchange->create_order ($symbol, $type, $side, $amount, $price); + var_dump ($order); + + // listing open orders + $open_orders = $exchange->fetch_open_orders($symbol); + var_dump($open_orders); + + // cancel order + $cancel = $exchange->cancel_order ($order['id'], $symbol); + var_dump ($cancel); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +// Example 2: Creating and canceling a linear future (stop-limit) order with leverage +try { + $markets = $exchange->load_markets (); + $symbol = 'LTC/USDT:USDT'; + $type = 'limit'; + $side = 'buy'; + $amount = 1; + $price = 55; + $stop_price = 130; + + $params = array ( + 'stopPrice' => $stop_price, + ); + + // set leverage + $leverage = $exchange->set_leverage(3, $symbol); + var_dump($leverage); + + // placing an order + $order = $exchange->create_order ($symbol, $type, $side, $amount, $price, $params); + var_dump ($order); + + // listing open orders + $open_orders = $exchange->fetch_open_orders($symbol); + // var_dump($open_orders); + + // cancel order + $cancelParams = array ( + 'isStop' => true, + ); + $cancel = $exchange->cancel_order ($order['id'], $symbol, $cancelParams); + var_dump ($cancel); + + // reset leverage + $leverage = $exchange->set_leverage(1, $symbol); + var_dump($leverage); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/huobi-fetch-balance.md b/docs/ccxt/wiki/examples/php/huobi-fetch-balance.md new file mode 100644 index 0000000..65adbe4 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/huobi-fetch-balance.md @@ -0,0 +1,32 @@ +- [Huobi Fetch Balance](./examples/php/) + + + ```php + 'YOUR_API_KEY', // ←------------ replace with your keys + 'secret' => 'YOUR_SECRET', + // 'verbose' => true, // uncomment if debug output is needed +)); + +try { + + $balance = $exchange->fetch_balance (); + var_dump ($balance); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (\ccxt\ExchangeError $e) { + echo '[Exchange Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/huobi-futures.md b/docs/ccxt/wiki/examples/php/huobi-futures.md new file mode 100644 index 0000000..8d9cc93 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/huobi-futures.md @@ -0,0 +1,53 @@ +- [Huobi Futures](./examples/php/) + + + ```php + 'YOUR_API_KEY', // ←------------ replace with your keys + 'secret' => 'YOUR_SECRET_KEY', + 'options' => array( + 'defaultType' => 'future', + ) + // 'verbose' => true, // uncomment if debug output is needed +)); + +try { + + $markets = $exchange->load_markets (); + + // creating and canceling a linear swap (limit) order + $symbol = 'ADA/USD:ADA-220121'; // the last segment is the date of expiration (can be next week, next quarter, ...) adjust it accordingly + $order_type = 'limit'; + $side = 'buy'; + $offset = 'open'; + $leverage = 1; + $amount = 1; + $price = 1; + + $params = array ( + 'offset' => $offset, + 'lever_rate' => $leverage, + ); + + $order = $exchange->create_order ($symbol, $order_type, $side, $amount, $price, $params); + var_dump ($order); + $cancel = $exchange->cancel_order ($order['id'], $symbol); + var_dump ($cancel); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (\ccxt\ExchangeError $e) { + echo '[Exchange Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/huobi-swaps.md b/docs/ccxt/wiki/examples/php/huobi-swaps.md new file mode 100644 index 0000000..075c8f9 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/huobi-swaps.md @@ -0,0 +1,48 @@ +- [Huobi Swaps](./examples/php/) + + + ```php + 'YOUR_API_KEY', // ←------------ replace with your keys + 'secret' => 'YOUR_SECRET_KEY', + // 'verbose' => true, // uncomment if debug output is needed +)); + +try { + + $markets = $exchange->load_markets (); + + // creating a linear swap (limit) order + $symbol = 'ADA/USDT:USDT'; + $order_type = 'limit'; + $side = 'buy'; + $offset = 'open'; + $leverage = 1; + $amount = 1; + $price = 1; + + $params = array ( + 'offset' => $offset, + 'lever_rate' => $leverage, + ); + + $order = $exchange->create_order ($symbol, $order_type, $side, $amount, $price, $params); + var_dump ($order['id']); + +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (\ccxt\ExchangeError $e) { + echo '[Exchange Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/indodax-fetch-balance-create-order-cancel-order.md b/docs/ccxt/wiki/examples/php/indodax-fetch-balance-create-order-cancel-order.md new file mode 100644 index 0000000..8bba5a7 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/indodax-fetch-balance-create-order-cancel-order.md @@ -0,0 +1,68 @@ +- [Indodax Fetch Balance Create Order Cancel Order](./examples/php/) + + + ```php + 'YOUR_API_KEY', // ←------------ replace with your keys + 'secret' => 'YOUR_SECRET', +)); + +//----------------------------------------------------------------------------- +// querying balance + +$balance = $exchange->fetch_balance(); + +print_r($balance); + +// do whatever you need here with your balance... + +//----------------------------------------------------------------------------- +// placing and canceling orders + +$symbol = 'BTC/IDR'; // bitcoin contract according to bitmex futures coding +$type = 'limit'; +$side = 'sell'; // or 'buy' +$amount = 1.0; +$price = 6500.0; // or None + +// extra params and overrides if necessary +$params = array( + // ... +); + +// buying + +$buy_order1 = $exchange->create_limit_buy_order($symbol, $amount, $price, $params); +echo "Buy order 1:\n"; +print_r($buy_order1); + +$buy_order2 = $exchange->create_order($symbol, $type, 'buy', $amount, $price, $params); +// order side hardcoded here ↑ for example +echo "Buy order 2:\n"; +print_r($buy_order2); + +// selling + +$sell_order1 = $exchange->create_limit_sell_order($symbol, $amount, $price, $params); +echo "Sell order 1:\n"; +print_r($sell_order1); + +$sell_order2 = $exchange->create_order ($symbol, $type, $side, $amount, $price, $params); +// order side from a variable here ↑ for example +echo "Sell order 2:\n"; +print_r($sell_order2); + +// canceling + +$exchange->cancel_order($buy_order1['id'], $symbol); +$exchange->cancel_order($buy_order2['id'], $symbol); +$exchange->cancel_order($sell_order1['id'], $symbol); +$exchange->cancel_order($sell_order2['id'], $symbol); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/kraken-create-and-close-position.md b/docs/ccxt/wiki/examples/php/kraken-create-and-close-position.md new file mode 100644 index 0000000..89b9766 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/kraken-create-and-close-position.md @@ -0,0 +1,77 @@ +- [Kraken Create And Close Position](./examples/php/) + + + ```php + version); + + +// ------------------------------------------------------------------------------ +function example() { + return Async\async(function () { + $exchange = new \ccxt\async\kraken(array( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + )); + $symbol = 'UNI/USD'; + $side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + $order_type = 'market'; // set it to 'market' or 'limit' + $amount = 1; + $leverage = 2; + Async\await($exchange->load_markets()); + $market = $exchange->market($symbol); + // if order_type is 'market', then price is not needed + $price = null; + // if order_type is 'limit', then set a price at your desired level + // you can fetch the ticker and update price + // const ticker = await exchange.fetchTicker (symbol); + // const last_price = ticker['last']; + // const ask_price = ticker['ask']; + // const bid_price = ticker['bid']; + // if (order_type === 'limit') { + // price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + // } + $params = array( + 'leverage' => $leverage, + ); + // log + var_dump('Going to open a position', 'for', $amount, 'worth', $amount, $market['base'], '~', $market['settle'], 'using', $side, $order_type, 'order (', ($order_type === 'limit' ? $exchange->price_to_precision($symbol, $price) : ''), '), using the following params:'); + var_dump($params); + var_dump('-----------------------------------------------------------------------'); + try { + $created_order = Async\await($exchange->create_order($symbol, $order_type, $side, $amount, $price, $params)); + var_dump('Created an order', $created_order); + // Fetch all your closed orders for this symbol (because we used market order) + // - use 'fetchClosedOrders' or 'fetchOrders' and filter with 'closed' status + $all_closed_orders = Async\await($exchange->fetch_closed_orders($symbol)); + var_dump('Fetched all your closed orders for this symbol', $all_closed_orders); + $all_open_positions = Async\await($exchange->fetch_positions($symbol)); + var_dump('Fetched all your positions for this symbol', $all_open_positions); + } catch(Exception $e) { + var_dump(((string) $e)); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/kraken-query-ledgers.md b/docs/ccxt/wiki/examples/php/kraken-query-ledgers.md new file mode 100644 index 0000000..118fa54 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/kraken-query-ledgers.md @@ -0,0 +1,34 @@ +- [Kraken Query Ledgers](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET_KEY', +)); + +// get ledgers +$ledgers = $exchange->privatePostLedgers (); + +// get ledger ids +$ids = array_keys ($ledgers['result']['ledger']); + +// get ledger entries for ledger id +$ledger_entries = $exchange->privatePostQueryLedgers(array( + 'id' => $ids[0], +)); + +var_dump ($ledger_entries); + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/kucoin-fetch-all-deposit-addresses.md b/docs/ccxt/wiki/examples/php/kucoin-fetch-all-deposit-addresses.md new file mode 100644 index 0000000..70a5961 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/kucoin-fetch-all-deposit-addresses.md @@ -0,0 +1,93 @@ +- [Kucoin Fetch All Deposit Addresses](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + 'password' => 'YOUR_API_PASSWORD', + 'options' => array( + 'versions' => array( + 'public' => array( + 'GET' => array( + 'currencies/{currency}' => 'v2', + ), + ), + ), + ), +)); + +$markets = $exchange->load_markets(); + +// $exchange->verbose = true; // uncomment for debugging purposes if necessary + +function fetch_create_deposit_address_helper($exchange, $code, $chain = null) { + $response = null; + try { + $response = $exchange->fetch_deposit_address($code, $chain ? array('chain' => strtolower($chain)) : array()); + if ((!$response['address']) || (!strlen($response['address']))) { + throw new \ccxt\ExchangeError ($exchange->id); + } + } catch (\ccxt\ExchangeError $e) { + $response = $exchange->create_deposit_address($code, $chain ? array('chain' => strtolower($chain)) : array()); + } + return $response; +} + +function fetch_create_deposit_address($exchange, $code, $chainName, $chain = null) { + try { + $response = fetch_create_deposit_address_helper($exchange, $code, $chain); + echo $code, ' has a ', $chainName, ' address ', $response['address'], ($response['tag'] && strlen($response['tag'])) ? ':' . $response['tag'] : '', "\n"; + return $response; + } catch (\ccxt\ExchangeError $e) { + echo 'Failed to fetch or create ', $code, ' ', $chainName, ' address: ', $e->getMessage(), "\n"; + } +} + +$codes = array_keys($exchange->currencies); +$results = array(); +foreach ($codes as $code) { + $response = $exchange->public_get_currencies_currency(array('currency' => $code)); + $currency = $exchange->safe_value($response, 'data'); + if ($currency) { + $chains = $exchange->safe_value($currency, 'chains'); + if ((count($chains) > 1) && ($code !== 'BNB')) { + foreach ($chains as $chain) { + echo "\n\nhere", $code, "\n\n"; + $chainName = $exchange->safe_string($chain, 'chainName'); + $address = fetch_create_deposit_address($exchange, $code, $chainName, $chainName); + if (!isset($results[$code])) { + $results[$code] = array(); + } + $results[$code][$chainName] = $address; + } + } else { + $chain = $exchange->safe_value($chains, 0); + $chainName = $exchange->safe_string($chain, 'chainName'); + $address = fetch_create_deposit_address($exchange, $code, $chainName); + if (!isset($results[$code])) { + $results[$code] = array(); + } + $results[$code][$chainName] = $address; + } + } else { + echo $code, ' has no addresses', "\n"; + } +} + + +print_r($results); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/kucoin-implicit-inner-transfer-v1.md b/docs/ccxt/wiki/examples/php/kucoin-implicit-inner-transfer-v1.md new file mode 100644 index 0000000..0321960 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/kucoin-implicit-inner-transfer-v1.md @@ -0,0 +1,126 @@ +- [Kucoin Implicit Inner Transfer V1](./examples/php/) + + + ```php + 'YOUR_API_KEY', // edit this line + 'secret' => 'YOUR_SECRET', // edit this line + 'password' => 'YOUR_APIKEY_PASSWORD', // edit this line + + // this is not required! uncomment only if you want to debug it + // 'verbose' => true, + +)); + +// ---------------------------------------------------------------------------- +// https://docs.kucoin.com/#inner-transfer + +// the difference between unified currency codes and exchange-specific +// currency ids is explained here: https://github.com/ccxt/ccxt/wiki/Manual#symbols-and-market-ids + +$code = 'BTC'; // a unified currency code, edit this line + +$from = 'main'; // or 'trade', edit this line +$to = 'trade'; // or 'main', edit this line + +$amount = '0.123'; // edit this line + +// ---------------------------------------------------------------------------- +// load "from" and "to" accounts + +function get_account_id($exchange, $type, $code) { + + // load markets first + $exchange->load_markets(); // this will be executed only once + + // convert from a common unified currency code to exchange-specific currency id + $currency_id = $exchange->currency_id($code); + + echo "Loading a '" . $type . "' account for '" . $code . "'\n"; + + $accounts = $exchange->private_get_accounts(array( + 'type' => $type, + )); + $data = $exchange->safe_value($accounts, 'data', array()); + $accounts_by_currency_id = $exchange->index_by($accounts['data'], 'currency'); + + $account_id = null; + + if (!array_key_exists($currency_id, $accounts_by_currency_id)) { + + echo "Could not find a '" . $type . "' account for '" . $code . "'\n"; + echo "Trying to create a new '" . $type . "' account for '" . $code . "'\n"; + + try { + + $response = $exchange->private_post_accounts(array( + 'type' => $type, + 'currency' => $currency_id + )); + + echo "Successfully created a new '" . $type . "' account for '" . $code . "'\n"; + + $account_id = $response['data']['id']; + + } catch (Exception $e) { + + echo "Failed to create a new '" . $type . "' account for '" . $code . "'\n"; + echo get_class($e) . ': ' . $e->getMessage() . "\n"; + exit(); + } + + } else { + + $account_id = $accounts_by_currency_id[$currency_id]['id']; + } + + echo "Successfully loaded a '" . $type . "' account for '" . $code . "': " . $account_id . "\n"; + return $account_id; +} + +// ---------------------------------------------------------------------------- + +$from_account_id = get_account_id($exchange, $from, $code); // payer (obtained through the "list account" interface) +$to_account_id = get_account_id($exchange, $to, $code); // receiver + +echo "Transferring '" . $amount . "' '" . $code . "' from '" . $from . "' account '" . $from_account_id . "' to '" . $to . "' account '" . $to_account_id . "'\n"; + +// set the arguments for the implicit method +$params = array( + + // set a unique identifier for this transfer + // can be any arbitrary string that has not been used yet + 'clientOid' => $exchange->uuid(), + + 'payAccountId' => $from_account_id, + 'recAccountId' => $to_account_id, + + 'amount' => $amount, // a string, transfer amount +); + +try { + + $response = $exchange->private_post_accounts_inner_transfer($params); + print_r($response); + +} catch (Exception $e) { + + echo get_class($e) . ': ' . $e->getMessage() . "\n"; + +} + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/latoken-example.md b/docs/ccxt/wiki/examples/php/latoken-example.md new file mode 100644 index 0000000..6d68125 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/latoken-example.md @@ -0,0 +1,116 @@ +- [Latoken Example](./examples/php/) + + + ```php + load_markets(); + +echo "-------------------------------------------------------------------\n"; + +echo $exchange->id, " has:\n"; +var_dump($exchange->has); + +// public API + +echo "-------------------------------------------------------------------\n"; + +$markets = array_values($exchange->markets); +echo 'Loaded ', count($markets), ' ', $exchange->id, " markets:\n"; +// var_dump($markets); + +echo "-------------------------------------------------------------------\n"; + +$currencies = array_values($exchange->currencies); +echo 'Loaded ', count($currencies), ' ', $exchange->id, " currencies:\n"; +// var_dump($currencies); + +echo "-------------------------------------------------------------------\n"; + +$time = $exchange->fetch_time(); +echo 'Exchange time: ', $exchange->iso8601($time), "\n"; + +echo "-------------------------------------------------------------------\n"; + +$ticker = $exchange->fetch_ticker($symbol); +var_dump($ticker); + +echo "-------------------------------------------------------------------\n"; + +$tickers = $exchange->fetch_tickers(); +echo 'Loaded ', count($tickers), ' ', $exchange->id, " tickers:\n"; +// var_dump($tickers); + +echo "-------------------------------------------------------------------\n"; + +$orderbook = $exchange->fetch_order_book ($symbol); +var_dump($orderbook); + +echo "-------------------------------------------------------------------\n"; + +$trades = $exchange->fetch_trades($symbol); +var_dump(array_map(function ($x) use ($exchange) { + return $exchange->omit($x, array('info', 'timestamp')); +}, $trades)); + +echo "-------------------------------------------------------------------\n"; + +// private API + +if ($exchange->check_required_credentials(false)) { + + $balance = $exchange->fetch_balance(); + var_dump($exchange->omit($balance, array('info'))); + + echo "-------------------------------------------------------------------\n"; + + $order = $exchange->create_order($symbol, 'limit', 'buy', 0.001, 10000); + var_dump($order); + + echo "-------------------------------------------------------------------\n"; + + $open_orders = $exchange->fetch_open_orders($symbol); + var_dump($open_orders); + + echo "-------------------------------------------------------------------\n"; + + $canceled = $exchange->cancel_order($order['id'], $order['symbol']); + var_dump($canceled); + + echo "-------------------------------------------------------------------\n"; + + $closed_orders = $exchange->fetch_closed_orders($symbol); + var_dump($closed_orders); + + echo "-------------------------------------------------------------------\n"; + + $canceled_orders = $exchange->fetch_canceled_orders($symbol); + var_dump($canceled_orders); + + echo "-------------------------------------------------------------------\n"; + + $my_trades = $exchange->fetch_my_trades($symbol); + var_dump($my_trades); + +} + +?> + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/load-all-at-once-async.md b/docs/ccxt/wiki/examples/php/load-all-at-once-async.md new file mode 100644 index 0000000..192ef9f --- /dev/null +++ b/docs/ccxt/wiki/examples/php/load-all-at-once-async.md @@ -0,0 +1,62 @@ +- [Load All At Once Async](./examples/php/) + + + ```php + id . "...\n"; + $markets = yield $exchange->load_markets (); + $msg = count (array_values ($markets)) . " markets: " . + implode (', ', array_slice ($exchange->symbols, 0, 5)) . "...\n"; + } catch (\ccxt\RequestTimeout $e) { + $msg = '[Timeout Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\DDoSProtection $e) { + $msg = '[DDoS Protection Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\AuthenticationError $e) { + $msg = '[Authentication Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\ExchangeNotAvailable $e) { + $msg = '[Exchange Not Available] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\NotSupported $e) { + $msg = '[Not Supported] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\NetworkError $e) { + $msg = '[Network Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\ExchangeError $e) { + $msg = '[Exchange Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (Exception $e) { + $msg = '[Error] ' . $e->getMessage() . "\n"; + } + echo "--------------------------------------------\n"; + echo $exchange->id . "\n"; + echo $msg; + echo "\n"; +} + +$loop = \React\EventLoop\Factory::create(); +$kernel = \Recoil\React\ReactKernel::create($loop); + +$kernel->execute(function() use ($loop, $kernel) { + $exchanges = \ccxt\Exchange::$exchanges; + + $yields = []; + + foreach ($exchanges as $exchange) { + $id = "\\ccxt_async\\".$exchange; + $exchange = new $id(array('loop' => $loop, 'kernel' => $kernel)); + + $yields[] = loadMarkets($exchange); + } + yield $yields; + +}, $loop); + +$kernel->run(); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/load-all-at-once.md b/docs/ccxt/wiki/examples/php/load-all-at-once.md new file mode 100644 index 0000000..edcf046 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/load-all-at-once.md @@ -0,0 +1,45 @@ +- [Load All At Once](./examples/php/) + + + ```php + id . "\n"; + + try { + $markets = $exchange->load_markets (); + echo count (array_values ($exchange->markets)) . " markets: " . + implode (', ', array_slice ($exchange->symbols, 0, 5)) . "...\n"; + } catch (\ccxt\RequestTimeout $e) { + echo '[Timeout Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\DDoSProtection $e) { + echo '[DDoS Protection Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\AuthenticationError $e) { + echo '[Authentication Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\ExchangeNotAvailable $e) { + echo '[Exchange Not Available] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\NotSupported $e) { + echo '[Not Supported] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (\ccxt\ExchangeError $e) { + echo '[Exchange Error] ' . $e->getMessage() . ' (ignoring)' . "\n"; + } catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; + } + echo "\n"; +} + + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/margin-loan-borrow-buy-sell-repay.md b/docs/ccxt/wiki/examples/php/margin-loan-borrow-buy-sell-repay.md new file mode 100644 index 0000000..bce27e7 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/margin-loan-borrow-buy-sell-repay.md @@ -0,0 +1,115 @@ +- [Margin Loan Borrow Buy Sell Repay](./examples/php/) + + + ```php + 'xxx', + 'secret' => 'xxx', + )); + $symbol = 'BUSD/USDT'; // set target symbol + $margin_mode = 'isolated'; // margin mode (cross or isolated) + $collateral_coin = 'USDT'; // which asset you want to use for margin-borrow collateral + $borrow_coin = 'BUSD'; // which coin to borrow + $order_side = 'sell'; // which side to trade + $amount_to_trade = 14; // how many coins to sell + $order_type = 'limit'; // order type (can be market, limit or etc) + $limit_price = 0.99; // price to sell at (set undefined/null/None if market-order) + $margin_magnitude = 5; // target margin (aka 'leverage'). This might also be obtainable using other unified methods, but for example purposes, we set here manually + // ########## end of user-inputs ########## + // + // for example purposes, let's also check available balance at first + $balance_margin = Async\await($exchange->fetch_balance(array( + 'defaultType' => 'margin', + 'marginMode' => $margin_mode, + ))); // use `defaultType` because of temporary bug, otherwise, after several days, you can use `type` too. + // if we don't have enought coins, then we have to borrow at first + $needed_amount_to_borrow = null; // will be auto-set below + if ($amount_to_trade > $balance_margin[$symbol][$borrow_coin]['free']) { + $needed_amount_to_borrow = $amount_to_trade - $balance_margin[$symbol][$borrow_coin]['free']; + var_dump('hmm, I have only ', $balance_margin[$symbol][$borrow_coin]['free'], ' ', $borrow_coin, ' in margin balance, and still need additional ', $needed_amount_to_borrow, ' to make an order. Lets borrow it.'); + // To initate a borrow, at first, check if we have enough collateral (for this example, as we make a sell-short, we need '-1' to keep for collateral currency) + $needed_collateral_amount = $needed_amount_to_borrow / ($margin_magnitude - 1); + // Check if we have any collateral to get permission for borrow + if ($balance_margin[$symbol][$collateral_coin]['free'] < $needed_collateral_amount) { + // If we don't have enough collateral, then let's try to transfer collateral-asset from spot-balance to margin-balance + var_dump('hmm, I have only ', $balance_margin[$symbol][$collateral_coin]['free'], ' in balance, but ', $needed_collateral_amount, ' collateral is needed. I should transfer ', $needed_collateral_amount, ' from spot'); + // let's check if we have spot balance at all + $balance_spot = Async\await($exchange->fetch_balance(array( + 'type' => 'spot', + ))); + if ($exchange->parse_number($balance_spot[$collateral_coin]['free']) < $needed_collateral_amount) { + var_dump('hmm, I neither do have enough balance on spot - only ', $balance_spot[$collateral_coin]['free'], '. Script can not continue...'); + return; + } else { + var_dump('Transferring ', $needed_collateral_amount, ' to margin account'); + Async\await($exchange->transfer($collateral_coin, $needed_collateral_amount, 'spot', $margin_mode, array( + 'symbol' => $symbol, + ))); + } + } + // now, as we have enough margin collateral, initiate borrow + var_dump('Initiating margin borrow of ', $needed_amount_to_borrow, ' ', $borrow_coin); + $borrow_result = Async\await($exchange->borrow_margin($borrow_coin, $needed_amount_to_borrow, $symbol, array( + 'marginMode' => $margin_mode, + ))); + } + var_dump('Submitting order.'); + $order = Async\await($exchange->create_order($symbol, $order_type, $order_side, $amount_to_trade, $limit_price, array( + 'marginMode' => $margin_mode, + ))); + var_dump('Order was submitted !', $order['id']); + // + // + // ... + // ... + // some time later, if you want to repay the loan back (like 'close the position')... + // ... + // ... + // + // + // set the "repay-back" amount (for this example snippet, this will be same amount that we borrowed above) + if ($needed_amount_to_borrow !== null) { + $amount_to_repay_back = $needed_amount_to_borrow; + // At first, you need to get back the borrowed coin, by making an opposide trade + var_dump('Making purchase back of ', $amount_to_repay_back, ' ', $borrow_coin, ' to repay it back.'); + $purchase_back_price = 1.01; + $order_back = Async\await($exchange->create_order($symbol, $order_type, ($order_side === 'buy' ? 'sell' : 'buy'), $amount_to_repay_back, $purchase_back_price, array( + 'marginMode' => $margin_mode, + ))); + var_dump('Now, repaying the loan.'); + $repay_result = Async\await($exchange->repay_margin($borrow_coin, $amount_to_repay_back, $symbol, array( + 'marginMode' => $margin_mode, + ))); + var_dump('finished.'); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/method-overload-override.md b/docs/ccxt/wiki/examples/php/method-overload-override.md new file mode 100644 index 0000000..a6e4f1c --- /dev/null +++ b/docs/ccxt/wiki/examples/php/method-overload-override.md @@ -0,0 +1,38 @@ +- [Method Overload Override](./examples/php/) + + + ```php + add_method('fetch_ticker', function($symbol, $params = []) { + return 'hello from the overload method'; + }); + var_dump($ex->call_method('fetch_ticker', ['BTC/USDT'])); +} +example_1(); + + +// ############################################### +// ####### APPROACH 2: extend the class ####### +// ############################################### +function example_2() { + $ex = new class extends \ccxt\kucoin { + public function fetch_ticker($symbol, $params = []) { + return 'Hello from the anonymous class!'; + } + }; + var_dump($ex->fetch_ticker('fetch_ticker', ['BTC/USDT'])); +} +example_2(); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/nonce-override.md b/docs/ccxt/wiki/examples/php/nonce-override.md new file mode 100644 index 0000000..cd96e9b --- /dev/null +++ b/docs/ccxt/wiki/examples/php/nonce-override.md @@ -0,0 +1,35 @@ +- [Nonce Override](./examples/php/) + + + ```php + milliseconds(); + } +} + +$exchange = new MillisecondsNonceExchange(array( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_SECRET', +)); + +try { + $symbol = 'ETH/BTC'; + $result = $exchange->fetch_balance($symbol); + var_dump ($result); +} catch (\ccxt\NetworkError $e) { + echo '[Network Error] ' . $e->getMessage() . "\n"; +} catch (\ccxt\ExchangeError $e) { + echo '[Exchange Error] ' . $e->getMessage() . "\n"; +} catch (Exception $e) { + echo '[Error] ' . $e->getMessage() . "\n"; +} + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/order-book-level-depth-extra-param.md b/docs/ccxt/wiki/examples/php/order-book-level-depth-extra-param.md new file mode 100644 index 0000000..329097d --- /dev/null +++ b/docs/ccxt/wiki/examples/php/order-book-level-depth-extra-param.md @@ -0,0 +1,19 @@ +- [Order Book Level Depth Extra Param](./examples/php/) + + + ```php + fetch_order_book ('BTC/USD', $limit)); + + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/phemex-create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/php/phemex-create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..2420010 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/phemex-create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,72 @@ +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + )); + $symbol = 'XRP/USDT:USDT'; + $side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + $order_type = 'limit'; // set it to 'market' or 'limit' + $amount = 1; // how many contracts + $price = 0.5; // set a price at your desired level + // take profit and stop loss prices and types + $take_profit_trigger_price = 0.6; + $stop_loss_trigger_price = 0.4; + $take_profit_limit_price = 0.7; + $stop_loss_limit_price = 0.3; + Async\await($exchange->load_markets()); + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + $params = array( + 'posSide' => 'Long', + 'stopLoss' => array( + 'triggerPrice' => $stop_loss_trigger_price, + 'type' => 'limit', + 'price' => $stop_loss_limit_price, + ), + 'takeProfit' => array( + 'triggerPrice' => $take_profit_trigger_price, + 'type' => 'limit', + 'price' => $take_profit_limit_price, + ), + ); + var_dump('-----------------------------------------------------------------------'); + try { + $created_order = Async\await($exchange->create_order($symbol, $order_type, $side, $amount, $price, $params)); + var_dump('Created an order', $created_order); + // Fetch all your open orders for this symbol + $all_open_orders = Async\await($exchange->fetch_open_orders($symbol)); + var_dump('Fetched all your orders for this symbol', $all_open_orders); + } catch(Exception $e) { + var_dump(((string) $e)); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/proxy-usage.md b/docs/ccxt/wiki/examples/php/proxy-usage.md new file mode 100644 index 0000000..882e3af --- /dev/null +++ b/docs/ccxt/wiki/examples/php/proxy-usage.md @@ -0,0 +1,77 @@ +- [Proxy Usage](./examples/php/) + + + ```php + proxy_url = 'http://188.245.226.105:8090/proxy_url.php?caller=https://ccxt.com&url='; + var_dump(Async\await($my_ex->fetch('https://api.ipify.org/'))); + }) (); +} + + +function example_http_proxy() { + return Async\async(function () { + $my_ex = new \ccxt\async\kucoin(); + $my_ex->http_proxy = 'http://188.245.226.105:8911'; // "httpProxy" or "httpsProxy" (depending on your proxy protocol) + var_dump(Async\await($my_ex->fetch('https://api.ipify.org/'))); + }) (); +} + + +function example_socks_proxy() { + return Async\async(function () { + $my_ex = new \ccxt\async\kucoin(); + $my_ex->socks_proxy = 'socks5://127.0.0.1:1080'; // from protocols: socks, socks5, socks5h + var_dump(Async\await($my_ex->fetch('https://api.ipify.org/'))); + }) (); +} + + +function example_web_sockets() { + return Async\async(function () { + $my_ex = new \ccxt\pro\kucoin(); + $my_ex->http_proxy = 'http://188.245.226.105:8911'; // even though you are using WebSockets, you might also need to set up proxy for the exchange's REST requests + $my_ex->ws_proxy = 'http://188.245.226.105:8911'; // "wsProxy" or "wssProxy" or "wsSocksProxy" (depending on your proxy protocol) + Async\await($my_ex->load_markets()); + // + // To ensure your WS proxy works, uncomment below code and watch the log + // + // myEx.verbose = true; + // await myEx.loadHttpProxyAgent (); + // await myEx.watch ('ws://188.245.226.105:9876/', 'myip'); // in the incoming logs, confirm that you see the proxy IP in "hello" message + // + var_dump(Async\await($my_ex->watch_ticker('BTC/USDT'))); + Async\await($my_ex->close()); + }) (); +} + + +// await example_proxyUrl (); +Async\await(example_http_proxy()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/react-eventloop-with-rate-limiting.md b/docs/ccxt/wiki/examples/php/react-eventloop-with-rate-limiting.md new file mode 100644 index 0000000..f3532fc --- /dev/null +++ b/docs/ccxt/wiki/examples/php/react-eventloop-with-rate-limiting.md @@ -0,0 +1,34 @@ +- [React Eventloop With Rate Limiting](./examples/php/) + + + ```php + fetch_order_book ($symbol); + echo "----------------------------------------------------------------\n"; + echo date ('c') . "\n"; + echo count ($order_book['bids']) . " bids and " . count ($order_book['asks']) . " asks\n"; + echo sprintf ("bid: %.8f ask: %.8f", $order_book['bids'][0][0], $order_book['asks'][0][0]) . "\n"; + + $loop->futureTick ($tick_function); +}; + +$loop->futureTick ($tick_function); +$loop->run (); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/sample-local-proxy-server-with-cors.md b/docs/ccxt/wiki/examples/php/sample-local-proxy-server-with-cors.md new file mode 100644 index 0000000..254a918 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/sample-local-proxy-server-with-cors.md @@ -0,0 +1,77 @@ +- [Sample Local Proxy Server With Cors](./examples/php/) + + + ```php + whitelisted_ips)) { + die("Your IP is forbidden... " . strval($_SERVER['REMOTE_ADDR'])); + } + $this->enable_cors(); + echo $this->fetch_url(filter_var($_GET['url'], FILTER_SANITIZE_URL)); + exit(0); + } +} + +new SampleProxy(); +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/shared-markets.md b/docs/ccxt/wiki/examples/php/shared-markets.md new file mode 100644 index 0000000..56418b1 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/shared-markets.md @@ -0,0 +1,58 @@ +- [Shared Markets](./examples/php/) + + + ```php + verbose = true; // this is a debug output to demonstrate which networking calls are being issued + +if (file_exists($markets_on_disk)) { + + $cache = json_decode(file_get_contents($markets_on_disk), true); + foreach ($keys as $key) { + $exchange->{$key} = $cache[$key]; + } + +} else { + + $exchange->load_markets(); + $cache = array(); + foreach ($keys as $key) { + $cache[$key] = $exchange->{$key}; + } + file_put_contents($markets_on_disk, json_encode($cache)); +} + +$exchange->fetch_ticker('ETH/BTC'); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/symbols.md b/docs/ccxt/wiki/examples/php/symbols.md new file mode 100644 index 0000000..0e7bee8 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/symbols.md @@ -0,0 +1,87 @@ +- [Symbols](./examples/php/) + + + ```php + setHeaders ($headers); + $tbl->addData ($rows); + return $tbl->getTable (); +} + +function market_table_helper ($market) { + return array ( + $market['id'], + $market['symbol'], + $market['base'], + $market['quote'], + $market['taker'], + $market['maker'], + json_encode ($market['precision']), + json_encode ($market['limits']), + + ); +} + +if (count ($argv) > 1) { + + $id = $argv[1]; + + $exchange_found = in_array ($id, $exchanges); + + if ($exchange_found) { + + dump ('Instantiating', green ($id), 'exchange'); + + // instantiate the exchange by id + $exchange = '\\ccxt\\' . $id; + $exchange = new $exchange (); + + // load all markets from the exchange + $markets = $exchange->load_markets (); + + // output a list of all market symbols + dump (green ($id), 'has', count ($exchange->symbols), 'symbols:', yellow (implode (', ', $exchange->symbols))); + + // output a table of all markets + @dump (tabulate(array('id', 'symbol', 'base', 'quote', 'taker', 'maker', 'precision', 'limits'), array_map ('market_table_helper', $markets))); + + } else { + + dump ('Exchange', red ($id), 'not found'); + print_supported_exchanges (); + } + +} else { + + dump ('Usage: php -f', __FILE__, green ('id')); + print_supported_exchanges (); + +} + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/trading-view.md b/docs/ccxt/wiki/examples/php/trading-view.md new file mode 100644 index 0000000..89b088f --- /dev/null +++ b/docs/ccxt/wiki/examples/php/trading-view.md @@ -0,0 +1,33 @@ +- [Trading View](./examples/php/) + + + ```php + fetch_ohlcv($symbol); + +// convert OHLCV → TradingView +$trading_view = $exchange->convert_ohlcv_to_trading_view($ohlcv); + +// convert TradingView → OHCLV +$restored_ohlcvs = $exchange->convert_trading_view_to_ohlcv($trading_view); + +print_r($restored_ohlcvs); + +?> +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watch-OHLCV-For-Symbols.md b/docs/ccxt/wiki/examples/php/watch-OHLCV-For-Symbols.md new file mode 100644 index 0000000..a796f10 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watch-OHLCV-For-Symbols.md @@ -0,0 +1,38 @@ +- [Watch Ohlcv For Symbols](./examples/php/) + + + ```php + watch_ohlcv_for_symbols($subscriptions)); + var_dump($ohlcv); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watch-OHLCV.md b/docs/ccxt/wiki/examples/php/watch-OHLCV.md new file mode 100644 index 0000000..1e2caf5 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watch-OHLCV.md @@ -0,0 +1,39 @@ +- [Watch Ohlcv](./examples/php/) + + + ```php + watch_ohlcv($symbol, $timeframe)); + var_dump($ohlcv); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watch-OrderBook-For-Symbols.md b/docs/ccxt/wiki/examples/php/watch-OrderBook-For-Symbols.md new file mode 100644 index 0000000..8969a45 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watch-OrderBook-For-Symbols.md @@ -0,0 +1,38 @@ +- [Watch Orderbook For Symbols](./examples/php/) + + + ```php + watch_order_book_for_symbols($symbols)); + var_dump($orderbook['symbol'], $orderbook['asks'][0], $orderbook['bids'][0]); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watch-Trades-For-Symbols.md b/docs/ccxt/wiki/examples/php/watch-Trades-For-Symbols.md new file mode 100644 index 0000000..6801e60 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watch-Trades-For-Symbols.md @@ -0,0 +1,38 @@ +- [Watch Trades For Symbols](./examples/php/) + + + ```php + watch_trades_for_symbols($symbols)); + var_dump($trades); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watch-tickers.md b/docs/ccxt/wiki/examples/php/watch-tickers.md new file mode 100644 index 0000000..e1b66f0 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watch-tickers.md @@ -0,0 +1,38 @@ +- [Watch Tickers](./examples/php/) + + + ```php + watch_tickers($symbols)); + var_dump($tickers['BTC/USDT'], $tickers['ETH/USDT'], $tickers['DOGE/USDT']); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watchOHLCVForSymbols.md b/docs/ccxt/wiki/examples/php/watchOHLCVForSymbols.md new file mode 100644 index 0000000..5239037 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watchOHLCVForSymbols.md @@ -0,0 +1,38 @@ +- [Watchohlcvforsymbols](./examples/php/) + + + ```php + watch_ohlcv_for_symbols($subscriptions)); + var_dump($ohlcv); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watchOrderBookForSymbols.md b/docs/ccxt/wiki/examples/php/watchOrderBookForSymbols.md new file mode 100644 index 0000000..4b1c58d --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watchOrderBookForSymbols.md @@ -0,0 +1,38 @@ +- [Watchorderbookforsymbols](./examples/php/) + + + ```php + watch_order_book_for_symbols($symbol)); + var_dump($orderbook['symbol'], $orderbook['asks'][0], $orderbook['bids'][0]); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watchPositions-many-exchanges-continuosly.md b/docs/ccxt/wiki/examples/php/watchPositions-many-exchanges-continuosly.md new file mode 100644 index 0000000..97fa0d5 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watchPositions-many-exchanges-continuosly.md @@ -0,0 +1,85 @@ +- [Watchpositions Many Exchanges Continuosly](./examples/php/) + + + ```php + watch_positions()); + var_dump('Fetched ', $exchange->id, ' - Positions: ', $positions); + } catch(Exception $e) { + var_dump($e); + break; + } + } + + }) (); +} + + +// start exchanges and fetch OHLCV loop +function start_exchange($exchange_name, $config) { + return Async\async(function () use ($exchange_name, $config) { + $exchange_class = '\ccxt\async\\'.$exchange_name; + $ex = new $exchange_class($config); + $promises = []; + $promises[] = watch_positions_continuously($ex); + Async\await(Promise\all($promises)); + Async\await($ex->close()); + }) (); +} + + +// main function +function example() { + return Async\async(function () { + $exchanges = array( + 'binanceusdm' => array( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + ), + 'okx' => array( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + ), + 'huobi' => array( + 'apiKey' => 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + ), + ); + $promises = []; + $exchange_ids = is_array($exchanges) ? array_keys($exchanges) : array(); + for ($i = 0; $i < count($exchange_ids); $i++) { + $exchange_name = $exchange_ids[$i]; + $config = $exchanges[$exchange_name]; + $promises[] = start_exchange($exchange_name, $config); + } + Async\await(Promise\all($promises)); + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watchPositions.md b/docs/ccxt/wiki/examples/php/watchPositions.md new file mode 100644 index 0000000..ec5f817 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watchPositions.md @@ -0,0 +1,40 @@ +- [Watchpositions](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'YOUR_API_SECRET', + )); + while (true) { + $trades = Async\await($exchange->watch_positions()); + var_dump($trades); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watchPositionsForSymbols.md b/docs/ccxt/wiki/examples/php/watchPositionsForSymbols.md new file mode 100644 index 0000000..5937c6e --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watchPositionsForSymbols.md @@ -0,0 +1,41 @@ +- [Watchpositionsforsymbols](./examples/php/) + + + ```php + 'YOUR_API_KEY', + 'secret' => 'Your_API_SECRET', + )); + $symbols = ['BTC/USDT:USDT', 'ETH/USDT:USDT', 'DOGE/USDT:USDT']; + while (true) { + $trades = Async\await($exchange->watch_positions($symbols)); + var_dump($trades); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/php/watchTradesForSymbols.md b/docs/ccxt/wiki/examples/php/watchTradesForSymbols.md new file mode 100644 index 0000000..d45dbf9 --- /dev/null +++ b/docs/ccxt/wiki/examples/php/watchTradesForSymbols.md @@ -0,0 +1,38 @@ +- [Watchtradesforsymbols](./examples/php/) + + + ```php + watch_trades_for_symbols($symbols)); + var_dump($trades); + } + }) (); +} + + +Async\await(example()); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/README.md b/docs/ccxt/wiki/examples/py/README.md new file mode 100644 index 0000000..5917b68 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/README.md @@ -0,0 +1,491 @@ + + +# [<-](Examples?id=python) + +# CCXT Python Examples + +To run Python examples from any folder, type in console: + +```shell +python path/to/example.py # substitute for actual filename here +``` + +Example files starting with `async-` require Python 3.6 with `async`/`await` and async generators support. + +![basic-chart](https://user-images.githubusercontent.com/1294454/29979754-6d62354c-8f4f-11e7-9e0a-22e87b4a093b.jpg) + +## See Also + +[co3k-crypto-currency-note](https://github.com/co3k/co3k-crypto-currency-note/blob/master/Untitled.ipynb) – an example of using ccxt to fetch OHLCV candles from Kraken and charting them with matplotlib in a Jupyter Notebook, made by [co3k](https://github.com/co3k). + + +- [Aiohttp Custom Session Connector](./examples/py/aiohttp-custom-session-connector.md) + +- [All Exchanges](./examples/py/all-exchanges.md) + +- [Arbitrage Pairs](./examples/py/arbitrage-pairs.md) + +- [Asciichart](./examples/py/asciichart.md) + +- [Async Analyse Augur V1 Vs V2 Exchanges](./examples/py/async-analyse-augur-v1-vs-v2-exchanges.md) + +- [Async Balance Coinbasepro](./examples/py/async-balance-coinbasepro.md) + +- [Async Balance Gdax](./examples/py/async-balance-gdax.md) + +- [Async Balance](./examples/py/async-balance.md) + +- [Async Balances](./examples/py/async-balances.md) + +- [Async Basic Callchain](./examples/py/async-basic-callchain.md) + +- [Async Basic Orderbook](./examples/py/async-basic-orderbook.md) + +- [Async Basic Rate Limiter](./examples/py/async-basic-rate-limiter.md) + +- [Async Basic](./examples/py/async-basic.md) + +- [Async Binance Cancel Option Order](./examples/py/async-binance-cancel-option-order.md) + +- [Async Binance Create Margin Order](./examples/py/async-binance-create-margin-order.md) + +- [Async Binance Create Option Order](./examples/py/async-binance-create-option-order.md) + +- [Async Binance Create Trailing Percent Order](./examples/py/async-binance-create-trailing-percent-order.md) + +- [Async Binance Fetch Margin Balance With Options](./examples/py/async-binance-fetch-margin-balance-with-options.md) + +- [Async Binance Fetch Margin Balance With Params](./examples/py/async-binance-fetch-margin-balance-with-params.md) + +- [Async Binance Fetch Option Ohlcv](./examples/py/async-binance-fetch-option-OHLCV.md) + +- [Async Binance Fetch Option Details](./examples/py/async-binance-fetch-option-details.md) + +- [Async Binance Fetch Option Order](./examples/py/async-binance-fetch-option-order.md) + +- [Async Binance Fetch Option Orderbook](./examples/py/async-binance-fetch-option-orderbook.md) + +- [Async Binance Fetch Option Position](./examples/py/async-binance-fetch-option-position.md) + +- [Async Binance Fetch Option Ticker](./examples/py/async-binance-fetch-option-ticker.md) + +- [Async Binance Fetch Ticker Continuously](./examples/py/async-binance-fetch-ticker-continuously.md) + +- [Async Binance Futures Vs Spot](./examples/py/async-binance-futures-vs-spot.md) + +- [Async Binance Margin Borrow](./examples/py/async-binance-margin-borrow.md) + +- [Async Binance Margin Repay](./examples/py/async-binance-margin-repay.md) + +- [Async Binance Usdm Fetch Continuous Klines Ohlcv](./examples/py/async-binance-usdm-fetch-continuous-klines-ohlcv.md) + +- [Async Bitfinex Public Get Symbols](./examples/py/async-bitfinex-public-get-symbols.md) + +- [Async Bitget Perpetual Futures Swaps](./examples/py/async-bitget-perpetual-futures-swaps.md) + +- [Async Bitstamp Create Limit Buy Order](./examples/py/async-bitstamp-create-limit-buy-order.md) + +- [Async Bitstamp Create Order Cancel Order](./examples/py/async-bitstamp-create-order-cancel-order.md) + +- [Async Bittrex Orderbook](./examples/py/async-bittrex-orderbook.md) + +- [Async Bybit Transfer](./examples/py/async-bybit-transfer.md) + +- [Async Fetch Balance](./examples/py/async-fetch-balance.md) + +- [Async Fetch Many Orderbooks Continuously](./examples/py/async-fetch-many-orderbooks-continuously.md) + +- [Async Fetch Ohlcv Indicators Discord Webhook](./examples/py/async-fetch-ohlcv-indicators-discord-webhook.md) + +- [Async Fetch Ohlcv Multiple Symbols Continuously](./examples/py/async-fetch-ohlcv-multiple-symbols-continuously.md) + +- [Async Fetch Order Book From Many Exchanges](./examples/py/async-fetch-order-book-from-many-exchanges.md) + +- [Async Fetch Ticker](./examples/py/async-fetch-ticker.md) + +- [Async Gather Concurrency](./examples/py/async-gather-concurrency.md) + +- [Async Gdax Fetch Order Book Continuously](./examples/py/async-gdax-fetch-order-book-continuously.md) + +- [Async Generator Basic](./examples/py/async-generator-basic.md) + +- [Async Generator Multiple Tickers](./examples/py/async-generator-multiple-tickers.md) + +- [Async Generator Ticker Poller](./examples/py/async-generator-ticker-poller.md) + +- [Async Hollaex Sandbox](./examples/py/async-hollaex-sandbox.md) + +- [Async Instantiate All At Once](./examples/py/async-instantiate-all-at-once.md) + +- [Async Kucoin Rate Limit](./examples/py/async-kucoin-rate-limit.md) + +- [Async Macd](./examples/py/async-macd.md) + +- [Async Market Making Symbols](./examples/py/async-market-making-symbols.md) + +- [Async Multiple Accounts](./examples/py/async-multiple-accounts.md) + +- [Async Multiple Parallel Calls](./examples/py/async-multiple-parallel-calls.md) + +- [Async Okx Create Margin Order](./examples/py/async-okx-create-margin-order.md) + +- [Async Okx Margin Borrow](./examples/py/async-okx-margin-borrow.md) + +- [Async Okx Margin Repay](./examples/py/async-okx-margin-repay.md) + +- [Async Okx Positional Orders](./examples/py/async-okx-positional-orders.md) + +- [Async Orderbooks From Multiple Exchanges At Once](./examples/py/async-orderbooks-from-multiple-exchanges-at-once.md) + +- [Async Orderbooks](./examples/py/async-orderbooks.md) + +- [Async Rtt](./examples/py/async-rtt.md) + +- [Async Theocean Orderbook](./examples/py/async-theocean-orderbook.md) + +- [Async Theocean Tickers](./examples/py/async-theocean-tickers.md) + +- [Async Ticker](./examples/py/async-ticker.md) + +- [Async Tickers From Many Exchanges At Once](./examples/py/async-tickers-from-many-exchanges-at-once.md) + +- [Async Tickers](./examples/py/async-tickers.md) + +- [Async With Threads](./examples/py/async-with-threads.md) + +- [Async](./examples/py/async.md) + +- [Balance Coinbasepro](./examples/py/balance-coinbasepro.md) + +- [Balance Gdax](./examples/py/balance-gdax.md) + +- [Balance Kraken](./examples/py/balance-kraken.md) + +- [Balances](./examples/py/balances.md) + +- [Basic Chart](./examples/py/basic-chart.md) + +- [Basic Rate Limiting](./examples/py/basic-rate-limiting.md) + +- [Binance Batch Orders](./examples/py/binance-batch-orders.md) + +- [Binance Coin Margined Take Profit](./examples/py/binance-coin-margined-take-profit.md) + +- [Binance Conditional Orders](./examples/py/binance-conditional-orders.md) + +- [Binance Create Oco Order With Implicit Methods](./examples/py/binance-create-oco-order-with-implicit-methods.md) + +- [Binance Ema](./examples/py/binance-ema.md) + +- [Binance Fetch All My Trades Paginate By Id](./examples/py/binance-fetch-all-my-trades-paginate-by-id.md) + +- [Binance Fetch All My Trades](./examples/py/binance-fetch-all-my-trades.md) + +- [Binance Fetch All Trades](./examples/py/binance-fetch-all-trades.md) + +- [Binance Fetch Ohlcv Closing Time 1](./examples/py/binance-fetch-ohlcv-closing-time-1.md) + +- [Binance Fetch Ohlcv Closing Time 2](./examples/py/binance-fetch-ohlcv-closing-time-2.md) + +- [Binance Fetch Ohlcv Pagination](./examples/py/binance-fetch-ohlcv-pagination.md) + +- [Binance Fetch Ohlcv Quote Volume](./examples/py/binance-fetch-ohlcv-quote-volume.md) + +- [Binance Fetch Ohlcv To Csv](./examples/py/binance-fetch-ohlcv-to-csv.md) + +- [Binance Fetch Ohlcv](./examples/py/binance-fetch-ohlcv.md) + +- [Binance Fiat](./examples/py/binance-fiat.md) + +- [Binance Futures Margin](./examples/py/binance-futures-margin.md) + +- [Binance Futures Positions](./examples/py/binance-futures-positions.md) + +- [Binance Futures Set Leverage Implicit Api](./examples/py/binance-futures-set-leverage-implicit-api.md) + +- [Binance Futures Set Leverage](./examples/py/binance-futures-set-leverage.md) + +- [Binance Market Order Quote Usdt](./examples/py/binance-market-order-quote-usdt.md) + +- [Binance Poll Balance](./examples/py/binance-poll-balance.md) + +- [Binance Poll Positions](./examples/py/binance-poll-positions.md) + +- [Binance Savings Endpoints](./examples/py/binance-savings-endpoints.md) + +- [Binance Spot Trailing](./examples/py/binance-spot-trailing.md) + +- [Binance Stop Loss Take Profit](./examples/py/binance-stop-loss-take-profit.md) + +- [Binance Test Order](./examples/py/binance-test-order.md) + +- [Binance Universal Transfer](./examples/py/binance-universal-transfer.md) + +- [Binance Usdm Fetch Continuous Klines Ohlcv](./examples/py/binance-usdm-fetch-continuous-klines-ohlcv.md) + +- [Bitfinex Rate Limiting](./examples/py/bitfinex-rate-limiting.md) + +- [Bitget Perpetual Futures Swaps](./examples/py/bitget-perpetual-futures-swaps.md) + +- [Bitmex Cancel Orders](./examples/py/bitmex-cancel-orders.md) + +- [Bitmex Create Order](./examples/py/bitmex-create-order.md) + +- [Bitmex Fetch Ohlcv With Extra Params](./examples/py/bitmex-fetch-ohlcv-with-extra-params.md) + +- [Bitmex Ohlcv Convert 5m To 15m](./examples/py/bitmex-ohlcv-convert-5m-to-15m.md) + +- [Bitmex Order Value](./examples/py/bitmex-order-value.md) + +- [Bittrex Fetch Closed Orders History](./examples/py/bittrex-fetch-closed-orders-history.md) + +- [Build Ohlcv Bars](./examples/py/build-ohlcv-bars.md) + +- [Builtin Rate Limiting Long Poller](./examples/py/builtin-rate-limiting-long-poller.md) + +- [Bybit Usdc Create Option Order](./examples/py/bybit-USDC-create-option-order.md) + +- [Bybit Conditional Orders](./examples/py/bybit-conditional-orders.md) + +- [Bybit Positions](./examples/py/bybit-positions.md) + +- [Bybit Trailling](./examples/py/bybit-trailling.md) + +- [Bybit Updated](./examples/py/bybit-updated.md) + +- [Cli](./examples/py/cli.md) + +- [Coinbase Cancel Order](./examples/py/coinbase-cancel-order.md) + +- [Coinbase Create Order](./examples/py/coinbase-create-order.md) + +- [Coinbase Fetch Ohlcv](./examples/py/coinbase-fetch-OHLCV.md) + +- [Coinbase Fetch Order](./examples/py/coinbase-fetch-order.md) + +- [Coinbase Fetch Ticker](./examples/py/coinbase-fetch-ticker.md) + +- [Coinbase Fetch Trades](./examples/py/coinbase-fetch-trades.md) + +- [Coinbasepro Fetch My Trades Pagination](./examples/py/coinbasepro-fetch-my-trades-pagination.md) + +- [Coinex Futures](./examples/py/coinex-futures.md) + +- [Coinone Fetch Tickers](./examples/py/coinone-fetch-tickers.md) + +- [Coinone Markets](./examples/py/coinone-markets.md) + +- [Compare Two Exchanges Capabilities](./examples/py/compare-two-exchanges-capabilities.md) + +- [Create Order Position With Takeprofit Stoploss](./examples/py/create-order-position-with-takeprofit-stoploss.md) + +- [Create Order Ws Example](./examples/py/create-order-ws-example.md) + +- [Create Orders Example](./examples/py/create-orders-example.md) + +- [Create Trailing Amount Order](./examples/py/create-trailing-amount-order.md) + +- [Create Trailing Percent Order](./examples/py/create-trailing-percent-order.md) + +- [Exchange Save Load Markets Cache](./examples/py/exchange-save-load-markets-cache.md) + +- [Exchanges By Country](./examples/py/exchanges-by-country.md) + +- [Exchanges](./examples/py/exchanges.md) + +- [Fetch All Okex Ohclv](./examples/py/fetch-all-okex-ohclv.md) + +- [Fetch All Tickers](./examples/py/fetch-all-tickers.md) + +- [Fetch Balance Asset Valuation](./examples/py/fetch-balance-asset-valuation.md) + +- [Fetch Bitfinex Ohlcv History](./examples/py/fetch-bitfinex-ohlcv-history.md) + +- [Fetch Coinbasepro Ohlcv Sequentially](./examples/py/fetch-coinbasepro-ohlcv-sequentially.md) + +- [Fetch Create Deposit Address](./examples/py/fetch-create-deposit-address.md) + +- [Fetch First Ohlcv Timestamp](./examples/py/fetch-first-ohlcv-timestamp.md) + +- [Fetch Gdax Ohlcv Sequentially](./examples/py/fetch-gdax-ohlcv-sequentially.md) + +- [Fetch Ohlcv Cex](./examples/py/fetch-ohlcv-cex.md) + +- [Fetch Ohlcv Kraken](./examples/py/fetch-ohlcv-kraken.md) + +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/py/fetch-ohlcv-many-exchanges-continuosly.md) + +- [Fetch Ohlcv Mark Index Price](./examples/py/fetch-ohlcv-mark-index-price.md) + +- [Fetch Ohlcv On New Candle](./examples/py/fetch-ohlcv-on-new-candle.md) + +- [Fetch Ohlcv Sequentially](./examples/py/fetch-ohlcv-sequentially.md) + +- [Fetch Ohlcv](./examples/py/fetch-ohlcv.md) + +- [Fetch Okex Futures](./examples/py/fetch-okex-futures.md) + +- [Fetch Open Orders](./examples/py/fetch-open-orders.md) + +- [Fetch Order Book Rtt](./examples/py/fetch-order-book-rtt.md) + +- [Fetch Orders](./examples/py/fetch-orders.md) + +- [Fetch Ticker Many Exchanges Many Symbols](./examples/py/fetch-ticker-many-exchanges-many-symbols.md) + +- [Fetch_longer_ohlcv_through_multiple_calls_and_save_to_csv](./examples/py/fetch_longer_ohlcv_through_multiple_calls_and_save_to_csv.md) + +- [Gateio Fetch Ohlcv Pagination](./examples/py/gateio-fetch-ohlcv-pagination.md) + +- [Gateio Futures](./examples/py/gateio-futures.md) + +- [Gateio Open Close Contract](./examples/py/gateio-open-close-contract.md) + +- [Gateio Swaps](./examples/py/gateio-swaps.md) + +- [Gdax Fetch My Trades Pagination](./examples/py/gdax-fetch-my-trades-pagination.md) + +- [Hitbtc Withdraw](./examples/py/hitbtc-withdraw.md) + +- [Huobi Futures](./examples/py/huobi-futures.md) + +- [Huobi Open Close Contract](./examples/py/huobi-open-close-contract.md) + +- [Huobi Open Close Position Bbo](./examples/py/huobi-open-close-position-bbo.md) + +- [Huobi Spot](./examples/py/huobi-spot.md) + +- [Huobi Swaps](./examples/py/huobi-swaps.md) + +- [Instantiate All At Once](./examples/py/instantiate-all-at-once.md) + +- [Kraken Conditional Close Order](./examples/py/kraken-conditional-close-order.md) + +- [Kraken Create And Close Position](./examples/py/kraken-create-and-close-position.md) + +- [Kraken Fetch My Trades Pagination](./examples/py/kraken-fetch-my-trades-pagination.md) + +- [Krakenfutures Basic](./examples/py/krakenfutures-basic.md) + +- [Kucoin Fetch All Deposit Addresses By Network](./examples/py/kucoin-fetch-all-deposit-addresses-by-network.md) + +- [Kucoin Fetch All Deposit Addresses](./examples/py/kucoin-fetch-all-deposit-addresses.md) + +- [Kucoin Fetch Closed Orders Pagination](./examples/py/kucoin-fetch-closed-orders-pagination.md) + +- [Kucoin Rate Limit](./examples/py/kucoin-rate-limit.md) + +- [Kucoin Withdraw Chain](./examples/py/kucoin-withdraw-chain.md) + +- [Kucoinfutures Create Stop Order](./examples/py/kucoinfutures-create-stop-order.md) + +- [Latoken Create Order](./examples/py/latoken-create-order.md) + +- [Latoken Example](./examples/py/latoken-example.md) + +- [Manual Rate Limiting Long Poller](./examples/py/manual-rate-limiting-long-poller.md) + +- [Margin Leverage Order Kraken](./examples/py/margin-leverage-order-kraken.md) + +- [Margin Loan Borrow Buy Sell Repay](./examples/py/margin-loan-borrow-buy-sell-repay.md) + +- [Measure Latency](./examples/py/measure-latency.md) + +- [Minimal 2 Lines](./examples/py/minimal-2-lines.md) + +- [Multiple Subscriptions Watchxforsymbols](./examples/py/multiple-subscriptions-watchXForSymbols.md) + +- [Normalize Sparse Candle Timestamps](./examples/py/normalize-sparse-candle-timestamps.md) + +- [Okx Fetch All My Trades](./examples/py/okx-fetch-all-my-trades.md) + +- [Okx Fetch Closed Orders Pagenumber Pagination](./examples/py/okx-fetch-closed-orders-pagenumber-pagination.md) + +- [Okx Position Takeprofit Stoploss](./examples/py/okx-position-takeprofit-stoploss.md) + +- [Okx Transfer](./examples/py/okx-transfer.md) + +- [Order Book Extra Level Depth Param](./examples/py/order-book-extra-level-depth-param.md) + +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/py/phemex-create-order-position-with-takeprofit-stoploss.md) + +- [Phemex Create Stop Order](./examples/py/phemex-create-stop-order.md) + +- [Phemex Leverage Orders](./examples/py/phemex-leverage-orders.md) + +- [Phemex Open Cancel Close Positions](./examples/py/phemex-open-cancel-close-positions.md) + +- [Phemex Perpetual Balance](./examples/py/phemex-perpetual-balance.md) + +- [Phemex Positions](./examples/py/phemex-positions.md) + +- [Phemex Transfer](./examples/py/phemex-transfer.md) + +- [Playing_with_ccxt_example](./examples/py/playing_with_ccxt_example.md) + +- [Poloniex Fetch Ohlcv Continuously](./examples/py/poloniex-fetch-ohlcv-continuously.md) + +- [Poloniex Fetch Ohlcv With Pagination](./examples/py/poloniex-fetch-ohlcv-with-pagination.md) + +- [Poloniex Fetch Order Books](./examples/py/poloniex-fetch-order-books.md) + +- [Poloniex Fetch Trades Continuously](./examples/py/poloniex-fetch-trades-continuously.md) + +- [Poloniex Fetch Trades With Pagination To Csv](./examples/py/poloniex-fetch-trades-with-pagination-to-csv.md) + +- [Poloniex Python2 Memleak Test](./examples/py/poloniex-python2-memleak-test.md) + +- [Poloniex Python3 Memleak Test](./examples/py/poloniex-python3-memleak-test.md) + +- [Proxy Usage](./examples/py/proxy-usage.md) + +- [Rsi](./examples/py/rsi.md) + +- [Rtt](./examples/py/rtt.md) + +- [Sample Local Proxy Server With Cors](./examples/py/sample-local-proxy-server-with-cors.md) + +- [Set_markets_from_exchange](./examples/py/set_markets_from_exchange.md) + +- [Sign In](./examples/py/sign-in.md) + +- [Sort Swap Markets By Hourly Price Change](./examples/py/sort-swap-markets-by-hourly-price-change.md) + +- [Source Ip Address](./examples/py/source-ip-address.md) + +- [Symbols](./examples/py/symbols.md) + +- [Test Server](./examples/py/test-server.md) + +- [Theocean](./examples/py/theocean.md) + +- [Tickers](./examples/py/tickers.md) + +- [Watch Ohlcv For Symbols](./examples/py/watch-OHLCV-For-Symbols.md) + +- [Watch Ohlcv](./examples/py/watch-OHLCV.md) + +- [Watch Orderbook For Symbols](./examples/py/watch-OrderBook-For-Symbols.md) + +- [Watch Trades For Symbols](./examples/py/watch-Trades-For-Symbols.md) + +- [Watch Tickers](./examples/py/watch-tickers.md) + +- [Watchohlcvforsymbols](./examples/py/watchOHLCVForSymbols.md) + +- [Watchorderbookforsymbols](./examples/py/watchOrderBookForSymbols.md) + +- [Watchpositions Many Exchanges Continuosly](./examples/py/watchPositions-many-exchanges-continuosly.md) + +- [Watchpositions](./examples/py/watchPositions.md) + +- [Watchpositionsforsymbols](./examples/py/watchPositionsForSymbols.md) + +- [Watchtradesforsymbols](./examples/py/watchTradesForSymbols.md) + +- [Wazirx Create Cancel Orders](./examples/py/wazirx-create-cancel-orders.md) + +- [Withdraw From One Exchange To Another](./examples/py/withdraw-from-one-exchange-to-another.md) + +- [Ws_test_load](./examples/py/ws_test_load.md) + diff --git a/docs/ccxt/wiki/examples/py/aiohttp-custom-session-connector.md b/docs/ccxt/wiki/examples/py/aiohttp-custom-session-connector.md new file mode 100644 index 0000000..63dc2f0 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/aiohttp-custom-session-connector.md @@ -0,0 +1,31 @@ +- [Aiohttp Custom Session Connector](./examples/py/) + + + ```python + # pip install aiohttp_socks + +import asyncio +import ccxt.async_support as ccxt +import aiohttp +import aiohttp_socks + +async def test(): + + connector = aiohttp_socks.ProxyConnector.from_url('socks5://user:password@127.0.0.1:1080') + session = aiohttp.ClientSession(connector=connector) + + exchange = ccxt.binance({ + 'session': session, + # ... + }) + + # ... + + await exchange.close() # Close the exchange + await session.close() # don't forget to close the session + + # ... + +asyncio.run(test()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/all-exchanges.md b/docs/ccxt/wiki/examples/py/all-exchanges.md new file mode 100644 index 0000000..5824ac1 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/all-exchanges.md @@ -0,0 +1,25 @@ +- [All Exchanges](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +for exchange_id in ccxt.exchanges: + try: + exchange = getattr(ccxt, exchange_id)() + print(exchange_id) + # do what you want with this exchange + # pprint(dir(exchange)) + except Exception as e: + print(e) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/arbitrage-pairs.md b/docs/ccxt/wiki/examples/py/arbitrage-pairs.md new file mode 100644 index 0000000..0205551 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/arbitrage-pairs.md @@ -0,0 +1,136 @@ +- [Arbitrage Pairs](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + +import ccxt # noqa: E402 + + +def style(s, style): + return style + s + '\033[0m' + + +def green(s): + return style(s, '\033[92m') + + +def blue(s): + return style(s, '\033[94m') + + +def yellow(s): + return style(s, '\033[93m') + + +def red(s): + return style(s, '\033[91m') + + +def pink(s): + return style(s, '\033[95m') + + +def bold(s): + return style(s, '\033[1m') + + +def underline(s): + return style(s, '\033[4m') + + +def dump(*args): + print(' '.join([str(arg) for arg in args])) + + +def print_exchanges(): + dump('Supported exchanges:', ', '.join(ccxt.exchanges)) + + +def print_usage(): + dump("Usage: python " + sys.argv[0], green('id1'), yellow('id2'), blue('id3'), '...') + + +proxies = [ + '', # no proxy by default + 'https://crossorigin.me/', + 'https://cors-anywhere.herokuapp.com/', +] + +if len(sys.argv) > 2: + ids = list(sys.argv[1:]) + exchanges = {} + dump(ids) + dump(yellow(' '.join(ids))) + for id in ids: # load all markets from all exchange exchanges + + # instantiate the exchange by id + exchange = getattr(ccxt, id)() + + # save it in a dictionary under its id for future use + exchanges[id] = exchange + + # load all markets from the exchange + markets = exchange.load_markets() + + # basic round-robin proxy scheduler + currentProxy = -1 + maxRetries = len(proxies) + + for numRetries in range(0, maxRetries): + + # try proxies in round-robin fashion + currentProxy = (currentProxy + 1) % len(proxies) + + try: # try to load exchange markets using current proxy + + exchange.proxy = proxies[currentProxy] + exchange.load_markets() + + except ccxt.DDoSProtection as e: + dump(yellow(type(e).__name__), e.args) + except ccxt.RequestTimeout as e: + dump(yellow(type(e).__name__), e.args) + except ccxt.AuthenticationError as e: + dump(yellow(type(e).__name__), e.args) + except ccxt.ExchangeNotAvailable as e: + dump(yellow(type(e).__name__), e.args) + except ccxt.ExchangeError as e: + dump(yellow(type(e).__name__), e.args) + except ccxt.NetworkError as e: + dump(yellow(type(e).__name__), e.args) + except Exception as e: # reraise all other exceptions + raise + + dump(green(id), 'loaded', green(str(len(exchange.symbols))), 'markets') + + dump(green('Loaded all markets')) + + allSymbols = [symbol for id in ids for symbol in exchanges[id].symbols] + + # get all unique symbols + uniqueSymbols = list(set(allSymbols)) + + # filter out symbols that are not present on at least two exchanges + arbitrableSymbols = sorted([symbol for symbol in uniqueSymbols if allSymbols.count(symbol) > 1]) + + # print a table of arbitrable symbols + table = [] + dump(green(' symbol | ' + ''.join([' {:<15} | '.format(id) for id in ids]))) + dump(green(''.join(['-----------------+-' for x in range(0, len(ids) + 1)]))) + + for symbol in arbitrableSymbols: + string = ' {:<15} | '.format(symbol) + row = {} + for id in ids: + # if a symbol is present on a exchange print that exchange's id in the row + string += ' {:<15} | '.format(id if symbol in exchanges[id].symbols else '') + dump(string) + +else: + print_usage() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/asciichart.md b/docs/ccxt/wiki/examples/py/asciichart.md new file mode 100644 index 0000000..207b017 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/asciichart.md @@ -0,0 +1,70 @@ +- [Asciichart](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +# This file is a copied implementation from my asciichart repository on GitHub +# https://github.com/kroitor/asciichart + +from math import cos +# from math import sin +from math import pi +from math import floor +from math import ceil + + +def plot(series, cfg={}): + + minimum = min(series) + maximum = max(series) + + interval = abs(float(maximum) - float(minimum)) + offset = cfg['offset'] if 'offset' in cfg else 3 + # padding = cfg['padding'] if 'padding' in cfg else ' ' + height = cfg['height'] if 'height' in cfg else interval + ratio = height / interval + # print(minimum,ratio,type(minimum)) + min2 = floor(float(minimum) * ratio) + max2 = ceil(float(maximum) * ratio) + + intmin2 = int(min2) + intmax2 = int(max2) + + rows = abs(intmax2 - intmin2) + width = len(series) + offset + # format = cfg['format'] if 'format' in cfg else lambda x: (padding + '{:.2f}'.format(x))[:-len(padding)] + + result = [[' '] * width for i in range(rows + 1)] + + # axis and labels + for y in range(intmin2, intmax2 + 1): + label = '{:8.2f}'.format(float(maximum) - ((y - intmin2) * interval / rows)) + result[y - intmin2][max(offset - len(label), 0)] = label + result[y - intmin2][offset - 1] = '┼' if y == 0 else '┤' + + y0 = int(series[0] * ratio - min2) + result[rows - y0][offset - 1] = '┼' # first value + + for x in range(0, len(series) - 1): # plot the line + y0 = int(round(series[x + 0] * ratio) - intmin2) + y1 = int(round(series[x + 1] * ratio) - intmin2) + if y0 == y1: + result[rows - y0][x + offset] = '─' + else: + result[rows - y1][x + offset] = '╰' if y0 > y1 else '╭' + result[rows - y0][x + offset] = '╮' if y0 > y1 else '╯' + start = min(y0, y1) + 1 + end = max(y0, y1) + for y in range(start, end): + result[rows - y][x + offset] = '│' + + return '\n'.join([''.join(row) for row in result]) + + +if __name__ == '__main__': + width = 180 + series = [15 * cos(i * ((pi * 4) / width)) for i in range(width)] + print(plot(series)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-analyse-augur-v1-vs-v2-exchanges.md b/docs/ccxt/wiki/examples/py/async-analyse-augur-v1-vs-v2-exchanges.md new file mode 100644 index 0000000..60fd297 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-analyse-augur-v1-vs-v2-exchanges.md @@ -0,0 +1,92 @@ +- [Async Analyse Augur V1 Vs V2 Exchanges](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from typing import Optional + + +import ccxt.async_support as ccxt + + +unchecked_exchanges = [] + + +def is_symbol_match( + symbol: str, + allowed_infix: str, + disallowed_infix: Optional[str] = None +) -> bool: + """This function is to keep everything that has allowed_infix=REP, but + excpude everything that has disallowed_infix=DREP, except for when you encounter something like: REPV2/DREP + + Returns True if this symbol is allowed to be in the list. + + Args: + symbol (str): the symbol to evaluate + allowed_infix (str): the allowed infix for both currencies in this symbol + disallowed_infix (Optional[str], optional): the disallowed infix for when the other currency is does not have the allowed infix. Defaults to None. + + Returns: + bool: + """ + parts = symbol.split('/') + + if disallowed_infix: + for i, currency in enumerate(parts): + if disallowed_infix in currency: + # if one currency contains for instance disallowed_infix=DREP, + # then the other currency must contain allowed_infix=REP to be allowed, else disallow + return allowed_infix in parts[i + 1 % 2] + + return any([allowed_infix in currency for currency in parts]) + + +async def check_symbol_infix(exchange, symbol_infix, exclude_infix=None): + try: + await exchange.load_markets() + except Exception as exc: + # exchange could not load_markets for some reason... + unchecked_exchanges.append(exchange.id) + else: + matching_symbols = [ + symbol for symbol in exchange.symbols + if is_symbol_match(symbol, symbol_infix, exclude_infix) + ] + if matching_symbols: + print( + f'on exchange {exchange.id} these symbols contain {symbol_infix}:' + ) + for symbol in matching_symbols: + print(f' - {symbol}:') + # print(f' exchange specific market info: {exchange.markets[symbol]["info"]}') + if 'V1' in symbol: + print(' - marked V1') + if 'V2' in symbol: + print(' - marked V2') + print() + + await exchange.close() + + +async def main(): + tasks = [] + for exchange_id in ccxt.exchanges: + exchange = getattr(ccxt, exchange_id)() + tasks.append( + check_symbol_infix( + exchange, symbol_infix='REP', exclude_infix='DREP' + ) + ) + await asyncio.gather(*tasks) + + print(f'errors for exchanges: {", ".join(unchecked_exchanges)}') + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-balance-coinbasepro.md b/docs/ccxt/wiki/examples/py/async-balance-coinbasepro.md new file mode 100644 index 0000000..915f0d9 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-balance-coinbasepro.md @@ -0,0 +1,29 @@ +- [Async Balance Coinbasepro](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(): + exchange = ccxt.coinbasepro({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'password': "YOUR_PASSWORD", + 'verbose': True, # switch it to False if you don't want the HTTP log + }) + # move to sandbox + exchange.urls['api'] = exchange.urls['test'] + print(await exchange.fetch_balance()) + + +asyncio.run(test()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-balance-gdax.md b/docs/ccxt/wiki/examples/py/async-balance-gdax.md new file mode 100644 index 0000000..b6f6885 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-balance-gdax.md @@ -0,0 +1,29 @@ +- [Async Balance Gdax](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(): + gdax = ccxt.gdax({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'password': "YOUR_PASSWORD", + 'verbose': True, # switch it to False if you don't want the HTTP log + }) + # move gdax to sandbox + gdax.urls['api'] = 'https://api-public.sandbox.gdax.com' + print(await gdax.fetch_balance()) + + +asyncio.run(test()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-balance.md b/docs/ccxt/wiki/examples/py/async-balance.md new file mode 100644 index 0000000..05e57e4 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-balance.md @@ -0,0 +1,27 @@ +- [Async Balance](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(): + bittrex = ccxt.bittrex({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'verbose': True, # switch it to False if you don't want the HTTP log + }) + print(await bittrex.fetch_balance()) + await bittrex.close() + + +asyncio.run(test()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-balances.md b/docs/ccxt/wiki/examples/py/async-balances.md new file mode 100644 index 0000000..20c14cd --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-balances.md @@ -0,0 +1,36 @@ +- [Async Balances](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(exchange): + print(await exchange.fetch_balance()) + await exchange.close() + + +kraken = ccxt.kraken({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'verbose': True, # switch it to False if you don't want the HTTP log +}) +bitfinex = ccxt.bitfinex({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'verbose': True, # switch it to False if you don't want the HTTP log +}) + +[asyncio.ensure_future(test(exchange)) for exchange in [kraken, bitfinex]] +pending = asyncio.Task.all_tasks() +loop = asyncio.get_event_loop() +loop.run_until_complete(asyncio.gather(*pending)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-basic-callchain.md b/docs/ccxt/wiki/examples/py/async-basic-callchain.md new file mode 100644 index 0000000..85b2940 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-basic-callchain.md @@ -0,0 +1,81 @@ +- [Async Basic Callchain](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def run_all_exchanges(exchange_ids): + results = {} + + for exchange_id in exchange_ids: + + exchange = getattr(ccxt, exchange_id)({ + 'options': { + 'useWebapiForFetchingFees': False, + } + }) + + symbol = 'ETH/BTC' + print('Exchange:', exchange_id) + + print(exchange_id, 'symbols:') + markets = await load_markets(exchange, symbol) # ←----------- STEP 1 + print(list(markets.keys())) + + print(symbol, 'ticker:') + ticker = await fetch_ticker(exchange, symbol) # ←------------ STEP 2 + print(ticker) + + print(symbol, 'orderbook:') + orderbook = await fetch_orderbook(exchange, symbol) # ←------ STEP 3 + print(orderbook) + + await exchange.close() # ←----------- LAST STEP GOES AFTER ALL CALLS + + results[exchange_id] = ticker + + return results + + +async def load_markets(exchange, symbol): + try: + result = await exchange.load_markets() + return result + except ccxt.BaseError as e: + print(type(e).__name__, str(e), str(e.args)) + raise e + + +async def fetch_ticker(exchange, symbol): + try: + result = await exchange.fetch_ticker(symbol) + return result + except ccxt.BaseError as e: + print(type(e).__name__, str(e), str(e.args)) + raise e + + +async def fetch_orderbook(exchange, symbol): + try: + result = await exchange.fetch_order_book(symbol) + return result + except ccxt.BaseError as e: + print(type(e).__name__, str(e), str(e.args)) + raise e + + +if __name__ == '__main__': + exchange_ids = ['bitfinex', 'okex', 'exmo'] + exchanges = [] + results = asyncio.run(run_all_exchanges(exchange_ids)) + print([(exchange_id, ticker) for exchange_id, ticker in results.items()]) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-basic-orderbook.md b/docs/ccxt/wiki/examples/py/async-basic-orderbook.md new file mode 100644 index 0000000..d44c879 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-basic-orderbook.md @@ -0,0 +1,33 @@ +- [Async Basic Orderbook](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(): + + exchange = ccxt.okex({ + # 'proxy': 'https://cors-anywhere.herokuapp.com/', + # 'origin': 'foobar', # when using CORS proxies, set this to some random string + }) + + try: + orderbook = await exchange.fetch_order_book('BTC/USDT') + await exchange.close() + return orderbook + except ccxt.BaseError as e: + print(type(e).__name__, str(e), str(e.args)) + raise e + + +asyncio.run(test()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-basic-rate-limiter.md b/docs/ccxt/wiki/examples/py/async-basic-rate-limiter.md new file mode 100644 index 0000000..5c7a517 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-basic-rate-limiter.md @@ -0,0 +1,25 @@ +- [Async Basic Rate Limiter](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance() + for i in range(0, 100): + # this can be any call instead of fetch_ticker, really + print(await exchange.fetch_ticker('ETH/BTC')) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-basic.md b/docs/ccxt/wiki/examples/py/async-basic.md new file mode 100644 index 0000000..4bee834 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-basic.md @@ -0,0 +1,25 @@ +- [Async Basic](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test_binance(): + exchange = ccxt.binance() + markets = await exchange.load_markets() + await exchange.close() + return markets + + +if __name__ == '__main__': + print(asyncio.run(test_binance())) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-cancel-option-order.md b/docs/ccxt/wiki/examples/py/async-binance-cancel-option-order.md new file mode 100644 index 0000000..8c0f248 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-cancel-option-order.md @@ -0,0 +1,44 @@ +- [Async Binance Cancel Option Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + market_id = 'ETH-230214-1525-C' + symbol = 'ETH/USDT:USDT-230214-1525-C' + order_id = 4612100534317768959 + try: + response = await exchange.cancel_order(order_id, symbol) + # Implicit API: + # response = await exchange.eapiPrivateDeleteOrder({ + # 'symbol': market_id, + # 'orderId': order_id, + # }) + pprint(response) + except Exception as e: + print('cancel_order() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-create-margin-order.md b/docs/ccxt/wiki/examples/py/async-binance-create-margin-order.md new file mode 100644 index 0000000..e684097 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-create-margin-order.md @@ -0,0 +1,44 @@ +- [Async Binance Create Margin Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + try: + # change the values here + symbol = 'BTC/USDT' + price = 9000 + amount = 1 + type = 'limit' # or market + side = 'buy' + order = await exchange.create_order(symbol, type, side, amount, price, { + 'type': 'margin', + }) + pprint(order) + except ccxt.InsufficientFunds as e: + print('create_order() failed – not enough funds') + print(e) + except Exception as e: + print('create_order() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-create-option-order.md b/docs/ccxt/wiki/examples/py/async-binance-create-option-order.md new file mode 100644 index 0000000..e0b4b4b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-create-option-order.md @@ -0,0 +1,53 @@ +- [Async Binance Create Option Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + symbol = 'ETH/USDT:USDT-221028-1700-C' + order_type = 'limit' + side = 'buy' + amount = 1 + price = 2.1 + try: + response = await exchange.create_order(symbol, order_type, side, amount, price) + # Implicit API: + # response = await exchange.eapiPrivatePostOrder({ + # # ETH/USDT call option strike 1700 USDT expiry on 2022-10-28 + # 'symbol': 'ETH-221028-1700-C', + # 'side': 'BUY', + # 'type': 'LIMIT', + # 'quantity': 1, + # 'price': 2.1, + # }) + pprint(response) + except ccxt.InsufficientFunds as e: + print('create_order() failed - not enough funds') + print(e) + except Exception as e: + print('create_order() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-create-trailing-percent-order.md b/docs/ccxt/wiki/examples/py/async-binance-create-trailing-percent-order.md new file mode 100644 index 0000000..b26bb11 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-create-trailing-percent-order.md @@ -0,0 +1,53 @@ +- [Async Binance Create Trailing Percent Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + try: + # change the values here + symbol = 'BTC/USDT:USDT' + type = 'market' + side = 'sell' + amount = 0.1 + price = None + order = await exchange.create_order(symbol, type, side, amount, price, { + 'trailingPercent': 5, + 'reduceOnly': True, + # 'trailingTriggerPrice': 45000, + }) + # Or you can call the create_trailing_percent_order method: + # trailing_percent = 5 + # trailing_trigger_price = 45000 + # params = { + # 'reduceOnly': True, + # } + # order = await exchange.create_trailing_percent_order (symbol, type, side, amount, price, trailing_percent, trailing_trigger_price, params) + pprint(order) + except ccxt.InsufficientFunds as e: + print('create_order() failed - not enough funds') + print(e) + except Exception as e: + print('create_order() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-options.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-options.md new file mode 100644 index 0000000..6687f30 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-options.md @@ -0,0 +1,39 @@ +- [Async Binance Fetch Margin Balance With Options](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + "options": { + "fetchBalance": "margin", + }, + # set verbose mode to True for debugging output + # 'verbose': True, + }) + while True: + try: + balance = await exchange.fetch_balance() + pprint(balance) + except Exception as e: + print('fetch_balance() failed') + print(e) + break + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-params.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-params.md new file mode 100644 index 0000000..358de7f --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-margin-balance-with-params.md @@ -0,0 +1,34 @@ +- [Async Binance Fetch Margin Balance With Params](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) + while True: + try: + balance = await exchange.fetch_balance({'type': 'margin'}) + pprint(balance) + except Exception as e: + print('fetch_balance() failed') + print(e) + break + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-option-OHLCV.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-OHLCV.md new file mode 100644 index 0000000..509b38f --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-OHLCV.md @@ -0,0 +1,48 @@ +- [Async Binance Fetch Option Ohlcv](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + market_id = 'ETH-221028-1700-C' + symbol = 'ETH/USDT:USDT-221028-1700-C' + timeframe = '1m' + since = 1592317127349 + limit = 10 + try: + response = await exchange.fetch_OHLCV(symbol, timeframe, since, limit) + # Implicit API: + # response = await exchange.eapiPublicGetKlines({ + # 'symbol': market_id, + # 'interval': timeframe, + # # 'startTime': since, # optional + # # 'limit': limit, # optional + # }) + pprint(response) + except Exception as e: + print('fetch_OHLCV() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-option-details.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-details.md new file mode 100644 index 0000000..b2241a0 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-details.md @@ -0,0 +1,39 @@ +- [Async Binance Fetch Option Details](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + market_id = 'ETH-221028-1700-C' + try: + response = await exchange.eapiPublicGetMark({ + # 'symbol': market_id, # optional + }) + pprint(response) + except Exception as e: + print('eapiPublicGetMark() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-option-order.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-order.md new file mode 100644 index 0000000..90af86a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-order.md @@ -0,0 +1,46 @@ +- [Async Binance Fetch Option Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + market_id = 'ETH-221028-1700-C' + symbol = 'ETH/USDT:USDT-221028-1700-C' + since = 1677102900000 + limit = 10 + order_id = 4612098335294532880 + try: + response = await exchange.fetch_open_orders(symbol, since, limit) + # Implicit API: + # response = await exchange.eapiPrivateGetOpenOrders({ + # # 'symbol': market_id, # optional + # # 'orderId': order_id, # optional + # }) + pprint(response) + except Exception as e: + print('fetch_open_orders() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-option-orderbook.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-orderbook.md new file mode 100644 index 0000000..4f483a1 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-orderbook.md @@ -0,0 +1,44 @@ +- [Async Binance Fetch Option Orderbook](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + market_id = 'ETH-221028-1500-C' + symbol = 'ETH/USDT:USDT-221028-1500-C' + limit = 10 + try: + response = await exchange.fetch_order_book(symbol, limit) + # Implicit API: + # response = await exchange.eapiPublicGetDepth({ + # 'symbol': market_id, + # # 'limit': limit, # optional + # }) + pprint(response) + except Exception as e: + print('fetch_order_book() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-option-position.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-position.md new file mode 100644 index 0000000..d8591c8 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-position.md @@ -0,0 +1,42 @@ +- [Async Binance Fetch Option Position](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + market_id = 'ETH-221028-1700-C' + symbol = 'ETH/USDT:USDT-221028-1700-C' + try: + response = await exchange.fetch_position(symbol) + # Implicit API: + # response = await exchange.eapiPrivateGetPosition({ + # # 'symbol': market_id, # optional + # }) + pprint(response) + except Exception as e: + print('fetch_position() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-option-ticker.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-ticker.md new file mode 100644 index 0000000..da24c15 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-option-ticker.md @@ -0,0 +1,42 @@ +- [Async Binance Fetch Option Ticker](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- +# This example uses the implicit API, in the future we will have options unified which will make things easier. +# You can check if the unified methods are ready-to-use (createOrder, fetchOrder etc) by checking: `is_unified = exchange.has['option']` + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + market_id = 'ETH-221028-1700-C' + symbol = 'ETH/USDT:USDT-221028-1700-C' + try: + response = await exchange.fetch_ticker(symbol) + # Implicit API: + # response = await exchange.eapiPublicGetTicker({ + # # 'symbol': market_id, # optional + # }) + pprint(response) + except Exception as e: + print('fetch_ticker() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-fetch-ticker-continuously.md b/docs/ccxt/wiki/examples/py/async-binance-fetch-ticker-continuously.md new file mode 100644 index 0000000..5b5305f --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-fetch-ticker-continuously.md @@ -0,0 +1,49 @@ +- [Async Binance Fetch Ticker Continuously](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(symbol): + # you can set enableRateLimit = True to enable the built-in rate limiter + # this way you request rate will never hit the limit of an exchange + # the library will throttle your requests to avoid that + + exchange = ccxt.binance() + while True: + print('--------------------------------------------------------------') + print(exchange.iso8601(exchange.milliseconds()), 'fetching', symbol, 'ticker from', exchange.name) + # this can be any call instead of fetch_ticker, really + try: + ticker = await exchange.fetch_ticker(symbol) + print(exchange.iso8601(exchange.milliseconds()), 'fetched', symbol, 'ticker from', exchange.name) + print(ticker) + except ccxt.RequestTimeout as e: + print('[' + type(e).__name__ + ']') + print(str(e)[0:200]) + # will retry + except ccxt.DDoSProtection as e: + print('[' + type(e).__name__ + ']') + print(str(e.args)[0:200]) + # will retry + except ccxt.ExchangeNotAvailable as e: + print('[' + type(e).__name__ + ']') + print(str(e.args)[0:200]) + # will retry + except ccxt.ExchangeError as e: + print('[' + type(e).__name__ + ']') + print(str(e)[0:200]) + break # won't retry + + +asyncio.run(main('BTC/USDT')) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-futures-vs-spot.md b/docs/ccxt/wiki/examples/py/async-binance-futures-vs-spot.md new file mode 100644 index 0000000..d7e2fca --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-futures-vs-spot.md @@ -0,0 +1,51 @@ +- [Async Binance Futures Vs Spot](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def load(exchange, symbol, type='spot'): + exchange.options['defaultType'] = type + await exchange.load_markets(True) + try: + return { + 'balance': await exchange.fetch_balance(), + # you actually want pagination here + # https://github.com/ccxt/ccxt/wiki/Manual#pagination + # but this will do as an example, tweak it for your needs + 'orders': await exchange.fetch_orders(symbol), + 'open orders': await exchange.fetch_open_orders(symbol), + 'closed orders': await exchange.fetch_closed_orders(symbol), + 'my trades': await exchange.fetch_my_trades(symbol), + } + except Exception as e: + print('\n\nError in load() with type =', type, '-', e) + raise e + + +async def run(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) + symbol = 'BTC/USDT' + everything = { + 'spot': await load(exchange, symbol, 'spot'), + 'future': await load(exchange, symbol, 'future'), + } + await exchange.close() + return everything + + +asyncio.run(run()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-margin-borrow.md b/docs/ccxt/wiki/examples/py/async-binance-margin-borrow.md new file mode 100644 index 0000000..a405c8b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-margin-borrow.md @@ -0,0 +1,43 @@ +- [Async Binance Margin Borrow](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + code = 'BTC' + amount = 1 + currency = exchange.currency(code) + try: + response = await exchange.sapi_post_margin_loan({ + 'asset': currency['id'], + 'amount': exchange.currency_to_precision(code, amount) + }) + pprint(response) + except ccxt.InsufficientFunds as e: + print('sapi_post_margin_loan() failed – not enough funds') + print(e) + except Exception as e: + print('sapi_post_margin_loan() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-margin-repay.md b/docs/ccxt/wiki/examples/py/async-binance-margin-repay.md new file mode 100644 index 0000000..7b2529a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-margin-repay.md @@ -0,0 +1,40 @@ +- [Async Binance Margin Repay](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'verbose': True, # for debug output + }) + await exchange.load_markets() + code = 'BTC' + amount = 1 + currency = exchange.currency(code) + try: + response = await exchange.sapi_post_margin_repay({ + 'asset': currency['id'], + 'amount': exchange.currency_to_precision(code, amount) + }) + pprint(response) + except Exception as e: + print('sapi_post_margin_repay() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-binance-usdm-fetch-continuous-klines-ohlcv.md b/docs/ccxt/wiki/examples/py/async-binance-usdm-fetch-continuous-klines-ohlcv.md new file mode 100644 index 0000000..144563c --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-binance-usdm-fetch-continuous-klines-ohlcv.md @@ -0,0 +1,50 @@ +- [Async Binance Usdm Fetch Continuous Klines Ohlcv](./examples/py/) + + + ```python + +# -*- coding: utf-8 -*- + +import os +import sys +from asyncio import run + +import ccxt.async_support as ccxt # noqa: E402 + +print('CCXT Version:', ccxt.__version__) + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +async def main(): + exchange = ccxt.binanceusdm() + try: + await exchange.load_markets() + timeframe = '1m' + limit = 1 + symbol = 'BTC/USDT' + market = exchange.market(symbol) + timeframe = '1m' + params = { + 'pair': market['id'], + 'contractType': 'PERPETUAL', # 'PERPETUAL', 'CURRENT_MONTH', 'NEXT_MONTH', 'CURRENT_QUARTER', 'NEXT_QUARTER' + 'interval': exchange.timeframes[timeframe], + } + # https://binance-docs.github.io/apidocs/futures/en/#continuous-contract-kline-candlestick-data + ohlcvs = await exchange.fapiPublic_get_continuousklines(params) + print(table([o for o in ohlcvs])) + print(table([[exchange.iso8601(int(o[0]))] + o[1:] for o in ohlcvs])) + except Exception as e: + print(type(e).__name__, str(e)) + await exchange.close() + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-bitfinex-public-get-symbols.md b/docs/ccxt/wiki/examples/py/async-bitfinex-public-get-symbols.md new file mode 100644 index 0000000..a8b273a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-bitfinex-public-get-symbols.md @@ -0,0 +1,27 @@ +- [Async Bitfinex Public Get Symbols](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(): + bitfinex = ccxt.bitfinex({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'verbose': True, # switch it to False if you don't want the HTTP log + }) + print(await bitfinex.public_get_symbols()) + await bitfinex.close() + + +asyncio.run(test()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-bitget-perpetual-futures-swaps.md b/docs/ccxt/wiki/examples/py/async-bitget-perpetual-futures-swaps.md new file mode 100644 index 0000000..8fea521 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-bitget-perpetual-futures-swaps.md @@ -0,0 +1,60 @@ +- [Async Bitget Perpetual Futures Swaps](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from asyncio import run + + + +import ccxt.async_support as ccxt + + +async def main(): + exchange = ccxt.bitget({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_API_PASSWORD', + 'options': { + 'defaultType': 'swap', + } + }) + + try: + + markets = await exchange.load_markets() + + # exchange.verbose = True # uncomment for debugging purposes if necessary + + # fetching balance + balance = await exchange.fetch_balance() + print(balance['total']) + + # placing a limit order + symbol = 'ETH/USDT:USDT' + type = 'limit' + side = 'buy' + amount = 1 # how many contracts to buy or sell, integer number of contracts + price = 3000 + order = await exchange.create_order(symbol, type, side, amount, price) + print(order) + + # placing a market order + symbol = 'ETH/USDT:USDT' + type = 'market' + side = 'sell' + amount = 1 # how many contracts to buy or sell, integer number of contracts + order = await exchange.create_order(symbol, type, side, amount) + print(order) + + except Exception as e: + print(type(e).__name__, str(e)) + + await exchange.close() + + +run(main()) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-bitstamp-create-limit-buy-order.md b/docs/ccxt/wiki/examples/py/async-bitstamp-create-limit-buy-order.md new file mode 100644 index 0000000..c0d4dda --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-bitstamp-create-limit-buy-order.md @@ -0,0 +1,50 @@ +- [Async Bitstamp Create Limit Buy Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(): + + exchange = ccxt.bitstamp({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + }) + + response = None + + try: + + await exchange.load_markets() # force-preload markets first + + exchange.verbose = True # this is for debugging + + symbol = 'BTC/USD' # change for your symbol + amount = 1.0 # change the amount + price = 6000.00 # change the price + + try: + + response = await exchange.create_limit_buy_order(symbol, amount, price) + + except Exception as e: + print('Failed to create order with', exchange.id, type(e).__name__, str(e)) + + except Exception as e: + print('Failed to load markets from', exchange.id, type(e).__name__, str(e)) + + await exchange.close() + return response + + +print(asyncio.run(test())) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-bitstamp-create-order-cancel-order.md b/docs/ccxt/wiki/examples/py/async-bitstamp-create-order-cancel-order.md new file mode 100644 index 0000000..d04570a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-bitstamp-create-order-cancel-order.md @@ -0,0 +1,62 @@ +- [Async Bitstamp Create Order Cancel Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +from asyncio import run +import ccxt.async_support as ccxt +from pprint import pprint + + +print('CCXT Version:', ccxt.__version__) + + +async def main(): + exchange = ccxt.bitstamp({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'uid': 'YOUR_UID', + }) + markets = await exchange.load_markets() + exchange.verbose = True # enable verbose mode after loading the markets + print('-------------------------------------------------------------------') + try: + balance = await exchange.fetch_balance() + pprint(balance) + except Exception as e: + print('Failed to fetch the balance') + print(type(e).__name__, str(e)) + order = None + print('-------------------------------------------------------------------') + try: + symbol = 'BTC/USDT' + market = exchange.market(symbol) + base = market['base'] + quote = market['quote'] + pprint(balance[base]) + pprint(balance[quote]) + amount = 0.001 + price = 40000 + order_type = 'limit' + side = 'sell' + order = await exchange.create_order(symbol, order_type, side, amount, price) + pprint(order) + except Exception as e: + print('Failed to place', symbol, 'order') + print(type(e).__name__, str(e)) + print('-------------------------------------------------------------------') + if order is not None: + try: + response = await exchange.cancel_order(order['id'], order['symbol']) + pprint(response) + except Exception as e: + print('Failed to cancel', symbol, 'order') + print(type(e).__name__, str(e)) + print('-------------------------------------------------------------------') + await exchange.close() + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-bittrex-orderbook.md b/docs/ccxt/wiki/examples/py/async-bittrex-orderbook.md new file mode 100644 index 0000000..99882a7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-bittrex-orderbook.md @@ -0,0 +1,33 @@ +- [Async Bittrex Orderbook](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + +if not sys.version >= '3.6': + print('This script requires Python 3.6+') + sys.exit() + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def poll(): + exchange = ccxt.bittrex() + while True: + yield await exchange.fetch_order_book('BTC/USDT') + await asyncio.sleep(exchange.rateLimit / 1000) + + +async def main(): + async for orderbook in poll(): + print(orderbook['bids'][0], orderbook['asks'][0]) + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-bybit-transfer.md b/docs/ccxt/wiki/examples/py/async-bybit-transfer.md new file mode 100644 index 0000000..63a2e50 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-bybit-transfer.md @@ -0,0 +1,36 @@ +- [Async Bybit Transfer](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.bybit({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + try: + pprint(await exchange.fetch_transfers()) # Fetch your transfer history + # pprint(await exchange.transfer('USDT', 1.0, 'swap', 'spot')) # Transfer to the spot wallet + # pprint(await exchange.transfer('USDT', 1.0, 'spot', 'future')) # Transfer to the Derivatives wallet + # pprint(await exchange.transfer('USDT', 1.0, 'spot', 'swap')) # Transfer to the Derivatives wallet + # pprint(await exchange.transfer('USDC', 1.0, 'spot', 'option')) # Transfer to the USDC Derivatives wallet + except Exception as e: + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-fetch-balance.md b/docs/ccxt/wiki/examples/py/async-fetch-balance.md new file mode 100644 index 0000000..f8fe2d8 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-fetch-balance.md @@ -0,0 +1,34 @@ +- [Async Fetch Balance](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(): + exchange = ccxt.bitstamp({ + # "verbose": True, # useful for debugging purposes, uncomment if needed + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'uid': 'YOUR_UID', + # i'm adding a CORS proxy here, because my country is blocked by bitstamp + # you don't need this, so it's safe to comment it out + # "proxy": "https://cors-anywhere.herokuapp.com/", + # "origin": "bitstamp" + }) + print(await exchange.fetch_balance()) + await exchange.close() # don't forget to close it when you're done + return True + +if __name__ == '__main__': + print('CCXT version:', ccxt.__version__) + print(asyncio.run(test())) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-fetch-many-orderbooks-continuously.md b/docs/ccxt/wiki/examples/py/async-fetch-many-orderbooks-continuously.md new file mode 100644 index 0000000..6f166ed --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-fetch-many-orderbooks-continuously.md @@ -0,0 +1,51 @@ +- [Async Fetch Many Orderbooks Continuously](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from asyncio import gather, run + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def symbol_loop(exchange, symbol): + print('Starting the', exchange.id, 'symbol loop with', symbol) + while True: + try: + orderbook = await exchange.fetch_order_book(symbol) + now = exchange.milliseconds() + print(exchange.iso8601(now), exchange.id, symbol, orderbook['asks'][0], orderbook['bids'][0]) + + # --------------------> DO YOUR LOGIC HERE <------------------ + + except Exception as e: + print(str(e)) + # raise e # uncomment to break all loops in case of an error in any one of them + break # you can break just this one loop if it fails + + +async def exchange_loop(exchange_id, symbols): + print('Starting the', exchange_id, 'exchange loop with', symbols) + exchange = getattr(ccxt, exchange_id)() + loops = [symbol_loop(exchange, symbol) for symbol in symbols] + await gather(*loops) + await exchange.close() + + +async def main(): + exchanges = { + 'okex': ['BTC/USDT', 'ETH/BTC', 'ETH/USDT'], + 'binance': ['BTC/USDT', 'ETH/BTC'], + 'bitfinex': ['BTC/USDT'], + } + loops = [exchange_loop(exchange_id, symbols) for exchange_id, symbols in exchanges.items()] + await gather(*loops) + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-fetch-ohlcv-indicators-discord-webhook.md b/docs/ccxt/wiki/examples/py/async-fetch-ohlcv-indicators-discord-webhook.md new file mode 100644 index 0000000..8604087 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-fetch-ohlcv-indicators-discord-webhook.md @@ -0,0 +1,62 @@ +- [Async Fetch Ohlcv Indicators Discord Webhook](./examples/py/) + + + ```python + from asyncio import run, gather, ensure_future +import pandas_ta as ta +import pandas as pd +import ccxt.async_support as ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) + +async def send_discord_webhook_messsage(exchange, symbol, message): + payload = { + "username": "Kj Bot Top 10 Coins 15 Min TF", + "content" : message + } + # change your webhook URL here + url = 'https://discord.com/api/webhooks/xxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' + method = 'POST' + headers = {'Content-Type': 'application/json'} + body = exchange.json(payload) + try: + await exchange.fetch(url, method, headers, body) + except Exception as e: + print(type(e).__name__, str(e)) + + +async def run_ohlcv_loop(exchange, symbol, timeframe, limit): + since = None + while True: + try: + ohlcv = await exchange.fetch_ohlcv(symbol, timeframe, since, limit) + if len(ohlcv): + df = pd.DataFrame(ohlcv, columns=['time', 'open', 'high', 'low', 'close', 'volume']) + rsi = df.ta.rsi() + df = pd.concat([df,rsi], axis=1) + last_row = df.iloc[-1] + previous_row = df.iloc[-2] + if last_row['RSI_14'] and previous_row['RSI_14']: + now = exchange.milliseconds() + iso8601 = exchange.iso8601(now) + print(iso8601, timeframe, symbol, '\tRSI_14 =', last_row['RSI_14']) + rsienterob = previous_row['RSI_14'] < 70 and last_row['RSI_14'] > 70 + if rsienterob: + message = iso8601 + ' ' + timeframe + ' ' + symbol + ' is entering overbought zone' + print(message) + ensure_future(send_discord_webhook_messsage(exchange, symbol, message)) + except Exception as e: + print(type(e).__name__, str(e)) + + +async def main(): + exchange = ccxt.binance() + timeframe = '1m' + limit = 50 + symbols = [ 'BTC/USDT', 'ETH/USDT' ] + loops = [run_ohlcv_loop(exchange, symbol, timeframe, limit) for symbol in symbols] + await gather(*loops) + await exchange.close() + + +run(main()) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-fetch-ohlcv-multiple-symbols-continuously.md b/docs/ccxt/wiki/examples/py/async-fetch-ohlcv-multiple-symbols-continuously.md new file mode 100644 index 0000000..7149d00 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-fetch-ohlcv-multiple-symbols-continuously.md @@ -0,0 +1,41 @@ +- [Async Fetch Ohlcv Multiple Symbols Continuously](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from asyncio import run, gather + +import ccxt.async_support as ccxt # noqa: E402 + +print('CCXT Version:', ccxt.__version__) + + +async def fetch_ohlcv(exchange, symbol, timeframe, limit): + since = None + while True: + try: + ohlcv = await exchange.fetch_ohlcv(symbol, timeframe, since, limit) + if len(ohlcv): + first_candle = ohlcv[0] + datetime = exchange.iso8601(first_candle[0]) + print(datetime, exchange.id, symbol, first_candle[1:]) + except Exception as e: + print(type(e).__name__, str(e)) + + +async def main(): + exchange = ccxt.binance() + timeframe = '1m' + limit = 1 + symbols = [ 'BTC/USDT', 'ETH/USDT' ] + loops = [fetch_ohlcv(exchange, symbol, timeframe, limit) for symbol in symbols] + await gather(*loops) + await exchange.close() + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-fetch-order-book-from-many-exchanges.md b/docs/ccxt/wiki/examples/py/async-fetch-order-book-from-many-exchanges.md new file mode 100644 index 0000000..5ea903e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-fetch-order-book-from-many-exchanges.md @@ -0,0 +1,54 @@ +- [Async Fetch Order Book From Many Exchanges](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +exchange_ids = [ 'binance', 'kucoin', 'huobipro' ] +symbol = 'ETH/BTC' + +async def loop(exchange_id, symbol): + + exchange_class = getattr(ccxt, exchange_id) + exchange = exchange_class() + orderbook = {} + try: + await exchange.load_markets() + # exchange.verbose = True # uncomment for debugging purposes + orderbook = await exchange.fetch_order_book(symbol) + except Exception as e: + print(type(e).__name__, str(e)) + await exchange.close() + return exchange.extend (orderbook, { + 'exchange_id': exchange_id, + 'symbol': symbol, + }) + + +async def run(exchange_ids, symbol): + coroutines = [loop(exchange_id, symbol) for exchange_id in exchange_ids] + return await asyncio.gather(*coroutines) + + +main = run(exchange_ids, symbol) +results = asyncio.run(main) +for result in results: + bids = result['bids'] + asks = result['asks'] + print( + result['exchange_id'], + result['symbol'], + 'top bid', bids[0], 'of', len(bids), 'bids,', + 'top ask', asks[0], 'of', len(asks), 'asks' + ) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-fetch-ticker.md b/docs/ccxt/wiki/examples/py/async-fetch-ticker.md new file mode 100644 index 0000000..bb3124c --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-fetch-ticker.md @@ -0,0 +1,17 @@ +- [Async Fetch Ticker](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + +pprint(asyncio.run(ccxt.binance().fetch_ticker('ETH/BTC'))) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-gather-concurrency.md b/docs/ccxt/wiki/examples/py/async-gather-concurrency.md new file mode 100644 index 0000000..33a75a9 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-gather-concurrency.md @@ -0,0 +1,78 @@ +- [Async Gather Concurrency](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def work(exchange_id): + + # create it once per program lifetime + exchange = getattr(ccxt, exchange_id)() + + print(exchange_id, 'loaded') + + try: + + # load markets once, first and foremost + # https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + await exchange.load_markets() + + # use the same exchange instance to iterate over loaded symbols + # https://github.com/ccxt/ccxt/wiki/Manual#symbols-and-market-ids + + for symbol in exchange.symbols: + + try: + + # fetch the orderbook for each next symbol + orderbook = await exchange.fetch_order_book(symbol) + + # ADD YOUR SUCCESS HANDLING HERE + print(exchange_id, 'fetched', symbol, 'orderbook') + + except Exception as e: + + # ADD YOUR ERROR HANDLING HERE + # https://github.com/ccxt/ccxt/wiki/Manual#error-handling + print(exchange_id, 'could not fetch', symbol, 'orderbook:', type(e).__name__) + + except Exception as e: + + # ADD YOUR ERROR HANDLING HERE + print(exchange_id, 'could not load markets:', type(e).__name__) + + # when you're done, don't forget to close the exchange instance properly + # otherwise you will get "Unclosed client session" exception + await exchange.close() + + +async def main(): + + # https://stackoverflow.com/questions/48483348/limited-concurrency-with-asyncio + max_concurrency = 5 # how many exchanges at once + + tasks = set() + loop = asyncio.get_running_loop() + # loop over all exchanges + for exchange_id in ccxt.exchanges: + + # wait for some exchange to finish before adding a new one + if len(tasks) >= max_concurrency: + _done, tasks = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED) + tasks.add(loop.create_task(work(exchange_id))) + + # wait for the remaining exchanges to finish + await asyncio.wait(tasks) + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-gdax-fetch-order-book-continuously.md b/docs/ccxt/wiki/examples/py/async-gdax-fetch-order-book-continuously.md new file mode 100644 index 0000000..8495f75 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-gdax-fetch-order-book-continuously.md @@ -0,0 +1,28 @@ +- [Async Gdax Fetch Order Book Continuously](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(symbol): + exchange = ccxt.binance() + while True: + print('--------------------------------------------------------------') + print(exchange.iso8601(exchange.milliseconds()), 'fetching', symbol, 'ticker from', exchange.name) + # this can be any call really + ticker = await exchange.fetch_order_book(symbol) + print(exchange.iso8601(exchange.milliseconds()), 'fetched', symbol, 'ticker from', exchange.name) + print(ticker) + + +asyncio.run(main('BTC/USDT')) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-generator-basic.md b/docs/ccxt/wiki/examples/py/async-generator-basic.md new file mode 100644 index 0000000..4bb3a13 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-generator-basic.md @@ -0,0 +1,28 @@ +- [Async Generator Basic](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def poll(): + exchange = ccxt.poloniex() + while True: + yield await exchange.fetch_ticker('ETH/BTC') + + +async def main(): + async for ticker in poll(): + print(ticker) + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-generator-multiple-tickers.md b/docs/ccxt/wiki/examples/py/async-generator-multiple-tickers.md new file mode 100644 index 0000000..0779f0e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-generator-multiple-tickers.md @@ -0,0 +1,28 @@ +- [Async Generator Multiple Tickers](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import ccxt.async_support as ccxt + + +async def poll(tickers): + i = 0 + kraken = ccxt.kraken() + while True: + symbol = tickers[i % len(tickers)] + yield (symbol, await kraken.fetch_ticker(symbol)) + i += 1 + await asyncio.sleep(kraken.rateLimit / 1000) + + +async def main(): + async for (symbol, ticker) in poll(['BTC/USD', 'ETH/BTC', 'BTC/EUR']): + print(symbol, ticker) + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-generator-ticker-poller.md b/docs/ccxt/wiki/examples/py/async-generator-ticker-poller.md new file mode 100644 index 0000000..0c1c238 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-generator-ticker-poller.md @@ -0,0 +1,33 @@ +- [Async Generator Ticker Poller](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def poll(): + kraken = ccxt.kraken({ + 'apiKey': "hEvQNMDIeoCJbr7W/ZBb5CGOrx3G0lWF5B3zqa1JBxdZlEaL8EK+D0Mw", + 'secret': "JaE9wI6Nwgh5oRxiHcVxurwzwBxwc05W/qv/k1srGg4s3EYuXPpNkLLM5NYbbWpM8rCyijIeDavRuqWbU0ZV9A==", + # 'verbose': True, # switch it to False if you don't want the HTTP log + }) + while True: + yield await kraken.fetch_ticker('BTC/USD') + await asyncio.sleep(kraken.rateLimit / 1000) + + +async def main(): + async for ticker in poll(): + print(ticker) + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-hollaex-sandbox.md b/docs/ccxt/wiki/examples/py/async-hollaex-sandbox.md new file mode 100644 index 0000000..d766e7e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-hollaex-sandbox.md @@ -0,0 +1,37 @@ +- [Async Hollaex Sandbox](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from asyncio import run + + + +async def test(): + import ccxt.async_support as ccxt + + print('CCXT Version', ccxt.__version__) + + # local sandbox keys + exchange = ccxt.hollaex({ + 'apiKey': "YOUR_SANDBOX_API_KEY", + 'secret': "YOUR_SANDBOX_SECRET", + }) + + exchange.set_sandbox_mode(True) + + markets = await exchange.load_markets() + + exchange.verbose = True + + balance = await exchange.fetch_balance() + print(f"balance: {balance}") + + await exchange.close() + + +run(test()) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-instantiate-all-at-once.md b/docs/ccxt/wiki/examples/py/async-instantiate-all-at-once.md new file mode 100644 index 0000000..2f46c04 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-instantiate-all-at-once.md @@ -0,0 +1,29 @@ +- [Async Instantiate All At Once](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import asyncio + + +import ccxt.async_support as ccxt # noqa: E402 + +exchanges = {} # a placeholder for your instances + + +async def main(): + for id in ccxt.exchanges: + exchange = getattr(ccxt, id) + exchanges[id] = exchange() + # now exchanges dictionary contains all exchange instances... + print(await exchanges['bittrex'].fetch_order_book('ETH/BTC')) + # close the aiohttp session object + for id in exchanges: + await exchanges[id].close() + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-kucoin-rate-limit.md b/docs/ccxt/wiki/examples/py/async-kucoin-rate-limit.md new file mode 100644 index 0000000..45bd2b7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-kucoin-rate-limit.md @@ -0,0 +1,47 @@ +- [Async Kucoin Rate Limit](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from asyncio import run + + +import ccxt.async_support as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +async def main(): + exchange = ccxt.kucoin() + markets = await exchange.load_markets() + i = 0 + while True: + try: + symbol = 'BTC/USDT' + timeframe = '5m' + since = None + limit = 1000 + ohlcvs = await exchange.fetch_ohlcv(symbol, timeframe, since, limit) + now = exchange.milliseconds() + datetime = exchange.iso8601(now) + print(datetime, i, 'fetched', len(ohlcvs), symbol, timeframe, 'candles', + 'from', exchange.iso8601(ohlcvs[0][0]), + 'to', exchange.iso8601(ohlcvs[len(ohlcvs)-1][0])) + except ccxt.RateLimitExceeded as e: + now = exchange.milliseconds() + datetime = exchange.iso8601(now) + print(datetime, i, type(e).__name__, str(e)) + await exchange.sleep(10000) + except Exception as e: + print(type(e).__name__, str(e)) + raise e + i += 1 + + +run (main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-macd.md b/docs/ccxt/wiki/examples/py/async-macd.md new file mode 100644 index 0000000..f4dc802 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-macd.md @@ -0,0 +1,52 @@ +- [Async Macd](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +from asyncio import gather, run +import pandas_ta as ta +import pandas as pd +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) + +async def run_ohlcv_loop(exchange, symbol, timeframe, limit): + since = None + fast = 12 + slow = 26 + signal = 9 + while True: + try: + ohlcv = await exchange.fetch_ohlcv(symbol, timeframe, since, limit) + if len(ohlcv): + df = pd.DataFrame(ohlcv, columns=['time', 'open', 'high', 'low', 'close', 'volume']) + + macd = df.ta.macd(fast=fast, slow=slow, signal=signal) + df = pd.concat([df, macd], axis=1) + print('----------------------------------------------------------') + print(exchange.iso8601(exchange.milliseconds()), symbol, timeframe) + print(df[-signal:]) + except Exception as e: + print(type(e).__name__, str(e)) + + +async def main(): + exchange = ccxt.binance() + timeframe = '1m' + limit = 50 + symbols = [ + 'BTC/USDT', + 'ETH/USDT', + ] + loops = [run_ohlcv_loop(exchange, symbol, timeframe, limit) for symbol in symbols] + await gather(*loops) + await exchange.close() + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-market-making-symbols.md b/docs/ccxt/wiki/examples/py/async-market-making-symbols.md new file mode 100644 index 0000000..c8fb1ae --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-market-making-symbols.md @@ -0,0 +1,43 @@ +- [Async Market Making Symbols](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +from asyncio import gather, run +from pprint import pprint +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def load_markets(exchange): + results = None + try: + await exchange.load_markets() + print('Loaded', len(exchange.symbols), exchange.id, 'symbols') + results = [] + for market in exchange.markets.values(): + if market['maker'] <= 0: + results.append({'exchange': exchange.id, 'symbol': market['symbol']}) + if len(results) < 1: + results = None + except: + results = None + await exchange.close() + return results + + +async def main(): + exchanges = [getattr(ccxt, exchange_id)() for exchange_id in ccxt.exchanges] + # exchanges = [exchange for exchange in exchanges if exchange.certified] + results = await gather(*[load_markets(exchange) for exchange in exchanges]) + results = [result for result in results if result is not None] + pprint(results) + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-multiple-accounts.md b/docs/ccxt/wiki/examples/py/async-multiple-accounts.md new file mode 100644 index 0000000..2f8e2c0 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-multiple-accounts.md @@ -0,0 +1,37 @@ +- [Async Multiple Accounts](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def fetch_balance_n_times(code, account, n): + exchange_class = getattr(ccxt, account['exchange_id']) + exchange = exchange_class(account['params']) + for i in range(0, n): + balance = await exchange.fetch_balance() + print(exchange.id, code, 'balance:', balance[code]) + await exchange.close() + + +async def test(): + n = 10 # fetch 10 times + code = 'BTC' + accounts = [ + {'exchange_id': 'binance', 'params': {'id': 'Binance1', 'apiKey': 'YOUR_API_KEY_1', 'secret': 'YOUR_API_SECRET_1'}}, + {'exchange_id': 'binance', 'params': {'id': 'Binance2', 'apiKey': 'YOUR_API_KEY_2', 'secret': 'YOUR_API_SECRET_2'}}, + ] + coroutines = [fetch_balance_n_times(code, account, n) for account in accounts] + await asyncio.gather(*coroutines) + +if __name__ == '__main__': + asyncio.run(test()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-multiple-parallel-calls.md b/docs/ccxt/wiki/examples/py/async-multiple-parallel-calls.md new file mode 100644 index 0000000..1d7824e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-multiple-parallel-calls.md @@ -0,0 +1,56 @@ +- [Async Multiple Parallel Calls](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + + +import ccxt.async_support as ccxt +from asyncio import run, gather + +print('CCXT Version:', ccxt.__version__) + +# This example demonstrates how to execute multiple requests asynchronously. +# The requests will be executed in parallel independently of each other. +# In order to let them run in parallel the user has to disable the rate limiter. +# Disabling the rate limiter is not recommended, unless you really know +# what you are doing! If you are too aggressive with your requests and +# you don't do proper request timing precisely, the exchange can ban you! +# https://github.com/ccxt/ccxt/wiki/ +# https://github.com/ccxt/ccxt/wiki/Manual +# https://github.com/ccxt/ccxt/wiki/Manual#rate-limit + + +async def main(): + exchange = ccxt.ftx({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'enableRateLimit': False, # not recommended + }) + markets = await exchange.load_markets() + # exchange.verbose = True # uncomment for debugging purposes + symbol = 'BTC/USDT' + loops = [ + exchange.fetch_balance(), + exchange.fetch_order_book(symbol), + exchange.fetch_open_orders() + ] + results = await gather(*loops) + print('Balance:') + print(results[0]) + print('------------------------------------------------------------------') + print(symbol, 'orderbook:') + print(results[1]) + print('------------------------------------------------------------------') + print('Open orders:') + print(results[2]) + await exchange.close() + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-okx-create-margin-order.md b/docs/ccxt/wiki/examples/py/async-okx-create-margin-order.md new file mode 100644 index 0000000..8962a0d --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-okx-create-margin-order.md @@ -0,0 +1,47 @@ +- [Async Okx Create Margin Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # okx requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication + 'password': 'YOUR_API_PASSWORD', + # 'verbose': True, # for debug output + }) + try: + # change the values here + symbol = 'BTC/USDT' + price = 123.45 + amount = 54.321 + type = 'limit' # or market + side = 'sell' + order = await exchange.create_order(symbol, type, side, amount, price, { + 'margin': True, + 'marginMode': 'cross', + }) + pprint(order) + except ccxt.InsufficientFunds as e: + print('create_order() failed – not enough funds') + print(e) + except Exception as e: + print('create_order() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-okx-margin-borrow.md b/docs/ccxt/wiki/examples/py/async-okx-margin-borrow.md new file mode 100644 index 0000000..14d5feb --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-okx-margin-borrow.md @@ -0,0 +1,41 @@ +- [Async Okx Margin Borrow](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # okx requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication + 'password': 'YOUR_API_PASSWORD', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + code = 'BTC' + amount = 1 + try: + response = await exchange.borrowCrossMargin(code, amount) + pprint(response) + except ccxt.InsufficientFunds as e: + print('borrowCrossMargin() failed – not enough funds') + print(e) + except Exception as e: + print('borrowCrossMargin() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-okx-margin-repay.md b/docs/ccxt/wiki/examples/py/async-okx-margin-repay.md new file mode 100644 index 0000000..15f994b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-okx-margin-repay.md @@ -0,0 +1,44 @@ +- [Async Okx Margin Repay](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def main(): + exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # okx requires this: https://github.com/ccxt/ccxt/wiki/Manual#authentication + 'password': 'YOUR_API_PASSWORD', + # 'verbose': True, # for debug output + }) + await exchange.load_markets() + code = 'BTC' + amount = 1 + order_id = 'YOUR_ORDER_ID_FROM_BORROWING' + try: + response = await exchange.repayCrossMargin(code, amount, { + 'ordId': order_id, + }) + pprint(response) + except ccxt.InsufficientFunds as e: + print('repayCrossMargin() failed – not enough funds') + print(e) + except Exception as e: + print('repayCrossMargin() failed') + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-okx-positional-orders.md b/docs/ccxt/wiki/examples/py/async-okx-positional-orders.md new file mode 100644 index 0000000..43e587a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-okx-positional-orders.md @@ -0,0 +1,64 @@ +- [Async Okx Positional Orders](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +from pprint import pprint +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 +# or +# import ccxtpro as ccxt + + +print('CCXT Version:', ccxt.__version__) + + +async def main(): + exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', # https://github.com/ccxt/ccxt/wiki/Manual#authentication + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + 'options': { + 'defaultType': 'future', + }, + }) + try: + markets = await exchange.load_markets() + exchange.verbose = True # uncomment for debugging + print('---------------------------------------------------------------') + print('Futures balance:') + futures_balance = await exchange.fetch_balance() + pprint(futures_balance) + print('---------------------------------------------------------------') + print('Futures symbols:') + print([market['symbol'] for market in markets.values() if market['future']]) + print('---------------------------------------------------------------') + symbol = 'BTC/USDT:USDT-201225' # a futures symbol + market = exchange.market(symbol) + pprint(market) + print('---------------------------------------------------------------') + type = '1' # 1:open long 2:open short 3:close long 4:close short for futures + side = None # irrelevant for futures + amount = 1 # how many contracts you want to buy or sell + price = 17000 # limit price + params = { + # 'order_type': '4', # uncomment for a market order, makes limit price irrelevant + # 'leverage': '10', # or '20' + } + order = await exchange.create_order(symbol, type, side, amount, price, params) + print('Order:') + pprint(order) + print('---------------------------------------------------------------') + except Exception as e: + print(type(e).__name__, str(e)) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-orderbooks-from-multiple-exchanges-at-once.md b/docs/ccxt/wiki/examples/py/async-orderbooks-from-multiple-exchanges-at-once.md new file mode 100644 index 0000000..bc71513 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-orderbooks-from-multiple-exchanges-at-once.md @@ -0,0 +1,64 @@ +- [Async Orderbooks From Multiple Exchanges At Once](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import ccxt +import ccxt.async_support as ccxta # noqa: E402 +import time +import os +import sys + + +symbol = 'ETH/BTC' + + +def sync_client(exchange_id): + orderbook = None + exchange = getattr(ccxt, exchange_id)() + try: + exchange.load_markets() + market = exchange.market(symbol) + orderbook = exchange.fetch_order_book(market['symbol']) + except Exception as e: + print(type(e).__name__, str(e)) + return { 'exchange': exchange.id, 'orderbook': orderbook } + + +async def async_client(exchange_id): + orderbook = None + exchange = getattr(ccxta, exchange_id)() + try: + await exchange.load_markets() + market = exchange.market(symbol) + orderbook = await exchange.fetch_order_book(market['symbol']) + except Exception as e: + print(type(e).__name__, str(e)) + await exchange.close() + return { 'exchange': exchange.id, 'orderbook': orderbook } + + +async def multi_orderbooks(exchanges): + input_coroutines = [async_client(exchange) for exchange in exchanges] + orderbooks = await asyncio.gather(*input_coroutines, return_exceptions=True) + return orderbooks + + +if __name__ == '__main__': + + # Consider review request rate limit in the methods you call + exchanges = ["kucoin", "bittrex", "bitfinex", "poloniex", "huobipro"] + + tic = time.time() + a = asyncio.run(multi_orderbooks(exchanges)) + print("async call spend:", time.time() - tic) + + time.sleep(1) + + tic = time.time() + a = [sync_client(exchange) for exchange in exchanges] + print("sync call spend:", time.time() - tic) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-orderbooks.md b/docs/ccxt/wiki/examples/py/async-orderbooks.md new file mode 100644 index 0000000..8a87a91 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-orderbooks.md @@ -0,0 +1,47 @@ +- [Async Orderbooks](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import ccxt +import ccxt.async_support as ccxta # noqa: E402 +import time +import os +import sys + + + +async def async_client(exchange, symbol): + client = getattr(ccxta, exchange)() + await client.load_markets() + if symbol not in client.symbols: + raise Exception(exchange + ' does not support symbol ' + symbol) + while True: + try: + orderbook = await client.fetch_order_book(symbol) + datetime = client.iso8601(client.milliseconds()) + print(datetime, client.id, symbol, orderbook['bids'][0], orderbook['asks'][0]) + except Exception as e: + print(type(e).__name__, e.args, str(e)) # comment if not needed + # break # uncomment to break it + # pass # uncomment to do nothing and just retry again on next iteration + # or add your own reaction according to the purpose of your app + await client.close() + + +async def multi_orderbooks(exchanges, symbol): + input_coroutines = [async_client(exchange, symbol) for exchange in exchanges] + await asyncio.gather(*input_coroutines, return_exceptions=True) + + +if __name__ == '__main__': + + # Consider review request rate limit in the methods you call + exchanges = ["bittrex", "bitfinex", "poloniex"] + symbol = 'ETH/BTC' + + asyncio.run(multi_orderbooks(exchanges, symbol)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-rtt.md b/docs/ccxt/wiki/examples/py/async-rtt.md new file mode 100644 index 0000000..babcbfb --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-rtt.md @@ -0,0 +1,80 @@ +- [Async Rtt](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from asyncio import run +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 +# or +# import ccxtpro as ccxt # if you're using ccxtpro + + +# WARNING! +# This example measures the round-trip time when placing orders with an exchange +# In order to measure the speed of requests it disables the rate-limiting +# Disabling the rate-limiter is required to do an accurate measurement +# If you keep running without a rate limiter for a long time the exchange will ban you +# In a live production system always use either the built-in rate limiter or make your own + + +async def main(): + + # the exchange instance has to be reused + # do not recreate the exchange before each call! + + exchange = ccxt.binance({ + + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + + # 'uid': 'YOUR_UID', # some exchanges require this + # 'password': 'YOUR_API_PASSWORD', # some exchanges require this + + # if you do not rate-limit your requests the exchange can ban you! + 'enableRateLimit': False, # https://github.com/ccxt/ccxt/wiki/Manual#rate-limit + + }) + + await exchange.load_markets() # https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + + # exchange.verbose = True # uncomment for debugging purposes if needed + + symbol = 'BTC/USDC' + market = exchange.market(symbol) + ticker = await exchange.fetch_ticker(symbol) + + amount = market['limits']['amount']['min'] + + # we will place limit buy order at 3/4 of the price to make sure they're not triggered + + price = ticker['last'] * 0.8 + amount = round(market['limits']['cost']['min'] / price, 4) + + results = [] + + for i in range(0, 10): + started = exchange.milliseconds() + order = await exchange.create_order(symbol, 'limit', 'buy', amount, price) + ended = exchange.milliseconds() + elapsed = ended - started + results.append(elapsed) + await exchange.cancel_order(order['id'], order['symbol']) + pprint(order) + pprint(results) + + + rtt = int(sum(results) / len(results)) + print('Successfully tested 10 orders, the average round-trip time per order is', rtt, 'milliseconds') + + await exchange.close() + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-theocean-orderbook.md b/docs/ccxt/wiki/examples/py/async-theocean-orderbook.md new file mode 100644 index 0000000..49620ec --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-theocean-orderbook.md @@ -0,0 +1,33 @@ +- [Async Theocean Orderbook](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + +if not sys.version >= '3.6': + print('This script requires Python 3.6+') + sys.exit() + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def poll(): + exchange = ccxt.theocean() + while True: + yield await exchange.fetch_order_book('WETH/TUSD') + await asyncio.sleep(exchange.rateLimit / 1000) + + +async def main(): + async for orderbook in poll(): + print(orderbook['bids'][0], orderbook['asks'][0]) + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-theocean-tickers.md b/docs/ccxt/wiki/examples/py/async-theocean-tickers.md new file mode 100644 index 0000000..8e898dd --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-theocean-tickers.md @@ -0,0 +1,47 @@ +- [Async Theocean Tickers](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +def get_active_symbols(exchange): + return [symbol for symbol in exchange.symbols if is_active_symbol(exchange, symbol)] + + +def is_active_symbol(exchange, symbol): + return ('.' not in symbol) and (('active' not in exchange.markets[symbol]) or (exchange.markets[symbol]['active'])) + + +async def fetch_ticker(exchange, symbol): + ticker = await exchange.fetchTicker(symbol) + print(exchange.id, symbol, ticker) + return ticker + + +async def fetch_tickers(id): + exchange = getattr(ccxt, id)() + await exchange.load_markets() + print(exchange.id, 'fetching all tickers by simultaneous multiple concurrent requests') + symbols_to_load = get_active_symbols(exchange) + input_coroutines = [fetch_ticker(exchange, symbol) for symbol in symbols_to_load] + tickers = await asyncio.gather(*input_coroutines, return_exceptions=True) + for ticker, symbol in zip(tickers, symbols_to_load): + if not isinstance(ticker, dict): + print(exchange.id, symbol, 'error') + else: + print(exchange.id, symbol, 'ok') + print(exchange.id, 'fetched', len(list(tickers)), 'tickers') + await exchange.close() + + +asyncio.run(fetch_tickers('theocean')) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-ticker.md b/docs/ccxt/wiki/examples/py/async-ticker.md new file mode 100644 index 0000000..428eb7c --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-ticker.md @@ -0,0 +1,28 @@ +- [Async Ticker](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(id, symbol): + exchange = getattr(ccxt, id)() + ticker = await exchange.fetch_ticker(symbol) + await exchange.close() + return ticker + + +if __name__ == '__main__': + id = 'binance' + symbol = 'ETH/BTC' + pprint(asyncio.run(test(id, symbol))) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-tickers-from-many-exchanges-at-once.md b/docs/ccxt/wiki/examples/py/async-tickers-from-many-exchanges-at-once.md new file mode 100644 index 0000000..507ef99 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-tickers-from-many-exchanges-at-once.md @@ -0,0 +1,50 @@ +- [Async Tickers From Many Exchanges At Once](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import ccxt +import ccxt.async_support as ccxta # noqa: E402 +import time +import os +import sys + + + +def sync_client(exchange): + client = getattr(ccxt, exchange)() + tickers = client.fetch_tickers() + return tickers + + +async def async_client(exchange): + client = getattr(ccxta, exchange)() + tickers = await client.fetch_tickers() + await client.close() + return tickers + + +async def multi_tickers(exchanges): + input_coroutines = [async_client(exchange) for exchange in exchanges] + tickers = await asyncio.gather(*input_coroutines, return_exceptions=True) + return tickers + + +if __name__ == '__main__': + + # Consider review request rate limit in the methods you call + exchanges = ["coinex", "bittrex", "bitfinex", "poloniex", "hitbtc"] + + tic = time.time() + a = asyncio.run(multi_tickers(exchanges)) + print("async call spend:", time.time() - tic) + + time.sleep(1) + + tic = time.time() + a = [sync_client(exchange) for exchange in exchanges] + print("sync call spend:", time.time() - tic) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-tickers.md b/docs/ccxt/wiki/examples/py/async-tickers.md new file mode 100644 index 0000000..37dce44 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-tickers.md @@ -0,0 +1,45 @@ +- [Async Tickers](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +def get_active_symbols(exchange): + return [symbol for symbol in exchange.symbols if is_active_symbol(exchange, symbol)] + + +def is_active_symbol(exchange, symbol): + return ('.' not in symbol) and (('active' not in exchange.markets[symbol]) or (exchange.markets[symbol]['active'])) + + +async def fetch_ticker(exchange, symbol): + ticker = await exchange.fetchTicker(symbol) + print(exchange.id, symbol, ticker) + return ticker + + +async def fetch_tickers(exchange): + await exchange.load_markets() + print(exchange.id, 'fetching all tickers by simultaneous multiple concurrent requests') + symbols_to_load = get_active_symbols(exchange) + input_coroutines = [fetch_ticker(exchange, symbol) for symbol in symbols_to_load] + tickers = await asyncio.gather(*input_coroutines, return_exceptions=True) + for ticker, symbol in zip(tickers, symbols_to_load): + if not isinstance(ticker, dict): + print(exchange.id, symbol, 'error') + else: + print(exchange.id, symbol, 'ok') + print(exchange.id, 'fetched', len(list(tickers)), 'tickers') + + +asyncio.run(fetch_tickers(ccxt.bitfinex())) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async-with-threads.md b/docs/ccxt/wiki/examples/py/async-with-threads.md new file mode 100644 index 0000000..668a95b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async-with-threads.md @@ -0,0 +1,42 @@ +- [Async With Threads](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import threading +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def test(loop): + exchange = ccxt.bittrex({ + 'asyncio_loop': loop, + }) + print(await exchange.fetch_ticker('ETH/BTC')) + await exchange.close() + + +def function_in_a_thread(): + # get_event_loop doesn't work inside a thread + loop = asyncio.new_event_loop() + loop.run_until_complete(test(loop)) + + +def another_threaded_function(): + global_loop.run_until_complete(test(global_loop)) + + +global_loop = asyncio.get_event_loop() +thread = threading.Thread(target=function_in_a_thread) +thread2 = threading.Thread(target=another_threaded_function) +thread.start() +thread2.start() +thread.join() +thread2.join() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/async.md b/docs/ccxt/wiki/examples/py/async.md new file mode 100644 index 0000000..7455b86 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/async.md @@ -0,0 +1,38 @@ +- [Async](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import functools +import os +import sys + + +import ccxt.async_support as ccxt # noqa: E402 + + +async def print_ticker(symbol, id): + # verbose mode will show the order of execution to verify concurrency + exchange = getattr(ccxt, id)({'verbose': True}) + print(await exchange.fetch_ticker(symbol)) + await exchange.close() + + +if __name__ == '__main__': + + symbol = 'ETH/BTC' + print_ethbtc_ticker = functools.partial(print_ticker, symbol) + [asyncio.ensure_future(print_ethbtc_ticker(id)) for id in [ + 'bitfinex', + 'poloniex', + 'kraken', + 'bittrex', + 'hitbtc', + ]] + loop = asyncio.get_event_loop() + pending = asyncio.all_tasks(loop) + loop.run_until_complete(asyncio.gather(*pending)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/balance-coinbasepro.md b/docs/ccxt/wiki/examples/py/balance-coinbasepro.md new file mode 100644 index 0000000..1cc4e19 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/balance-coinbasepro.md @@ -0,0 +1,25 @@ +- [Balance Coinbasepro](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +exchange = ccxt.coinbasepro({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'password': 'zdmj8o7byla', + 'verbose': True, # switch it to False if you don't want the HTTP log +}) + +# move to sandbox +exchange.urls['api'] = exchange.urls['test'] + +print(exchange.fetch_balance()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/balance-gdax.md b/docs/ccxt/wiki/examples/py/balance-gdax.md new file mode 100644 index 0000000..46eced7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/balance-gdax.md @@ -0,0 +1,25 @@ +- [Balance Gdax](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +gdax = ccxt.gdax({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'password': "YOUR_PASSWORD", + 'verbose': True, # switch it to False if you don't want the HTTP log +}) + +# move gdax to sandbox +gdax.urls['api'] = 'https://api-public.sandbox.gdax.com' + +print(gdax.fetch_balance()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/balance-kraken.md b/docs/ccxt/wiki/examples/py/balance-kraken.md new file mode 100644 index 0000000..67f6cf2 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/balance-kraken.md @@ -0,0 +1,21 @@ +- [Balance Kraken](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +kraken = ccxt.kraken({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'verbose': True, # switch it to False if you don't want the HTTP log +}) + +print(kraken.fetch_balance()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/balances.md b/docs/ccxt/wiki/examples/py/balances.md new file mode 100644 index 0000000..8c604dc --- /dev/null +++ b/docs/ccxt/wiki/examples/py/balances.md @@ -0,0 +1,87 @@ +- [Balances](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +def style(s, style): + return style + s + '\033[0m' + + +def green(s): + return style(s, '\033[92m') + + +def blue(s): + return style(s, '\033[94m') + + +def yellow(s): + return style(s, '\033[93m') + + +def red(s): + return style(s, '\033[91m') + + +def pink(s): + return style(s, '\033[95m') + + +def bold(s): + return style(s, '\033[1m') + + +def underline(s): + return style(s, '\033[4m') + + +def dump(*args): + print(' '.join([str(arg) for arg in args])) + + +# instantiate exchanges + +coinbasepro = ccxt.coinbasepro({ + 'apiKey': '92560ffae9b8a01d012726c698bcb2f1', # standard + 'secret': '9aHjPmW+EtRRKN/OiZGjXh8OxyThnDL4mMDre4Ghvn8wjMniAr5jdEZJLN/knW6FHeQyiz3dPIL5ytnF0Y6Xwg==', + 'password': '6kszf4aci8r', # requires a password! +}) + +coinbasepro.urls['api'] = coinbasepro.urls['test'] # use the testnet + +hitbtc = ccxt.hitbtc({ + 'apiKey': '18339694544745d9357f9e7c0f7c41bb', + 'secret': '8340a60fb4e9fc73a169c26c7a7926f5', +}) + +try: + # fetch account balance from the exchange + coinbaseproBalance = coinbasepro.fetch_balance() + + # output the result + dump(green(coinbasepro.name), 'balance', coinbaseproBalance) + + # fetch another one + hitbtcBalance = hitbtc.fetch_balance() + + # output the result + dump(green(hitbtc.name), 'balance', hitbtcBalance) + +except ccxt.DDoSProtection as e: + print(type(e).__name__, e.args, 'DDoS Protection (ignoring)') +except ccxt.RequestTimeout as e: + print(type(e).__name__, e.args, 'Request Timeout (ignoring)') +except ccxt.ExchangeNotAvailable as e: + print(type(e).__name__, e.args, 'Exchange Not Available due to downtime or maintenance (ignoring)') +except ccxt.AuthenticationError as e: + print(type(e).__name__, e.args, 'Authentication Error (missing API keys, ignoring)') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/basic-chart.md b/docs/ccxt/wiki/examples/py/basic-chart.md new file mode 100644 index 0000000..cf71082 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/basic-chart.md @@ -0,0 +1,45 @@ +- [Basic Chart](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + +from asciichart import plot + +import ccxt # noqa: E402 +kraken = ccxt.kraken() +coinbasepro = ccxt.coinbasepro() + +symbol = 'BTC/USD' + +# each ohlcv candle is a list of [ timestamp, open, high, low, close, volume ] +index = 4 # use close price from each ohlcv candle + + +def print_chart(exchange, symbol, timeframe): + + print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:') + + # get a list of ohlcv candles + ohlcv = exchange.fetch_ohlcv(symbol, timeframe) + + # get the ohlCv (closing price, index == 4) + series = [x[index] for x in ohlcv] + + # print the chart + print("\n" + plot(series[-120:], {'height': 20})) # print the chart + + last = ohlcv[len(ohlcv) - 1][index] # last closing price + return last + + +last = print_chart(kraken, 'BTC/USD', '1h') +print("\n" + kraken.name + " ₿ = $" + str(last) + "\n") # print last closing price + +last = print_chart(coinbasepro, 'BTC/USD', '1h') +print("\n" + coinbasepro.name + " ₿ = $" + str(last) + "\n") # print last closing price + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/basic-rate-limiting.md b/docs/ccxt/wiki/examples/py/basic-rate-limiting.md new file mode 100644 index 0000000..d794926 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/basic-rate-limiting.md @@ -0,0 +1,29 @@ +- [Basic Rate Limiting](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +from pprint import pprint + +import os +import sys + + +import ccxt # noqa: E402 + + +symbol = 'ETH/BTC' + +exchange = ccxt.poloniex({ + 'enableRateLimit': True, # enabled by default +}) + +# print 10 times with appropriate delay +for i in range(0, 10): + print('--------------------------------------------------------------------') + ticker = exchange.fetch_ticker(symbol) + ticker = exchange.omit(ticker, 'info') + pprint(ticker) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-batch-orders.md b/docs/ccxt/wiki/examples/py/binance-batch-orders.md new file mode 100644 index 0000000..81e65b7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-batch-orders.md @@ -0,0 +1,37 @@ +- [Binance Batch Orders](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binance({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", +}) + + +orders = [ + { + "symbol" : "BTCUSDT", + "side" : "BUY", + "positionSide" : "LONG", + "type" : "MARKET", + "quantity": float(0.005) + } +] + +orders = [exchange.encode_uri_component(exchange.json(order), safe=",") for order in orders] +response = exchange.fapiPrivatePostBatchOrders({ + 'batchOrders': '[' + ','.join(orders) + ']' +}) + +print(response) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-coin-margined-take-profit.md b/docs/ccxt/wiki/examples/py/binance-coin-margined-take-profit.md new file mode 100644 index 0000000..3f9e57d --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-coin-margined-take-profit.md @@ -0,0 +1,42 @@ +- [Binance Coin Margined Take Profit](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.binancecoinm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() + +exchange.verbose = True # uncomment for debugging purposes if necessary + +# edit for your values below + +symbol = 'EOS/USD' +order_type = 'TAKE_PROFIT' +side = 'sell' +amount = YOUR_AMOUNT_HERE +price = YOUR_LIMIT_PRICE_HERE +stopPrice = YOUR_STOP_PRICE +params = {'stopPrice': stopPrice} + +try: + order = exchange.create_order(symbol, order_type, side, amount, price, params) + print(order) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-conditional-orders.md b/docs/ccxt/wiki/examples/py/binance-conditional-orders.md new file mode 100644 index 0000000..df58030 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-conditional-orders.md @@ -0,0 +1,50 @@ +- [Binance Conditional Orders](./examples/py/) + + + ```python + import ccxt +from pprint import pprint + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', +}) + +print('Loading markets from', exchange.id) +exchange.load_markets() +print('Loaded markets from', exchange.id) + +exchange.verbose = True + +symbol = 'ETH/USDT' +type = 'market' +side = 'buy' # long +amount = 10 + +order1 = exchange.create_order(symbol, 'market', 'buy', amount) + +order1_price = order1['price'] +if order1_price is None: + order1_price = order1['average'] +if order1_price is None: + cumulative_quote = float(order1['info']['cumQuote']) + executed_quantity = float(order1['info']['executedQty']) + order1_price = cumulative_quote / executed_quantity + +pprint(order1) + +print('---------------------------------------------------------------------') + +stop_loss_params = {'stopPrice': order1_price * 0.9} +order2 = exchange.create_order(symbol, 'stop_market', 'sell', amount, None, stop_loss_params) +pprint(order2) + +print('---------------------------------------------------------------------') + +take_profit_params = {'stopPrice': order1_price * 1.6} +order3 = exchange.create_order(symbol, 'take_profit_market', 'sell', amount, None, take_profit_params) +pprint(order3) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-create-oco-order-with-implicit-methods.md b/docs/ccxt/wiki/examples/py/binance-create-oco-order-with-implicit-methods.md new file mode 100644 index 0000000..e82379e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-create-oco-order-with-implicit-methods.md @@ -0,0 +1,43 @@ +- [Binance Create Oco Order With Implicit Methods](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'options': {'adjustForTimeDifference': True} +}) + +symbol = 'SCRT/BTC' +market = exchange.market(symbol) +amount = 26 +price = 0.00002 +stop_price = 0.000016 +stop_limit_price = 0.000015 + +response = exchange.private_post_order_oco({ + 'symbol': market['id'], + 'side': 'SELL', # SELL, BUY + 'quantity': exchange.amount_to_precision(symbol, amount), + 'price': exchange.price_to_precision(symbol, price), + 'stopPrice': exchange.price_to_precision(symbol, stop_price), + 'stopLimitPrice': exchange.price_to_precision(symbol, stop_limit_price), # If provided, stopLimitTimeInForce is required + 'stopLimitTimeInForce': 'GTC', # GTC, FOK, IOC + # 'listClientOrderId': exchange.uuid(), # A unique Id for the entire orderList + # 'limitClientOrderId': exchange.uuid(), # A unique Id for the limit order + # 'limitIcebergQty': exchangea.amount_to_precision(symbol, limit_iceberg_quantity), + # 'stopClientOrderId': exchange.uuid() # A unique Id for the stop loss/stop loss limit leg + # 'stopIcebergQty': exchange.amount_to_precision(symbol, stop_iceberg_quantity), + # 'newOrderRespType': 'ACK', # ACK, RESULT, FULL +}) +print(response) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-ema.md b/docs/ccxt/wiki/examples/py/binance-ema.md new file mode 100644 index 0000000..93a4e7e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-ema.md @@ -0,0 +1,34 @@ +- [Binance Ema](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import pandas_ta as ta +import pandas as pd + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +def main(): + exchange = ccxt.binance() + markets = exchange.load_markets() + # exchange.verbose = True # uncomment for debugging purposes + ohlcv = exchange.fetch_ohlcv('BTC/USDT', '1m') + if len(ohlcv): + df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume']) + df['datetime'] = pd.to_datetime(df['timestamp'], unit='ms') + ema = df.ta.ema() + df = pd.concat([df, ema], axis=1) + print(df) + + +main() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades-paginate-by-id.md b/docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades-paginate-by-id.md new file mode 100644 index 0000000..366d9fe --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades-paginate-by-id.md @@ -0,0 +1,59 @@ +- [Binance Fetch All My Trades Paginate By Id](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'options': { + # 'defaultType': 'spot', // spot, future, margin + # }, +}) + + +exchange.load_markets () + +# exchange.verbose = True # uncomment for debugging + +symbol = 'ETH/BTC' +from_id = '0' +params = { 'fromId': from_id } +previous_from_id = from_id + +all_trades = [] + +while True: + + print('------------------------------------------------------------------') + print('Fetching with params', params) + trades = exchange.fetch_my_trades(symbol, None, None, params) + print('Fetched', len(trades), 'trades') + if len(trades): + # for i in range(0, len(trades)): + # trade = trades[i] + # print (i, trade['id'], trade['datetime'], trade['amount']) + last_trade = trades[len(trades) - 1] + if last_trade['id'] == previous_from_id: + break + else: + previous_from_id = last_trade['id'] + params['fromId'] = last_trade['id'] + all_trades = all_trades + trades + else: + break + +print('Fetched', len(all_trades), 'trades') +for i in range(0, len(all_trades)): + trade = all_trades[i] + print (i, trade['id'], trade['datetime'], trade['amount']) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades.md b/docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades.md new file mode 100644 index 0000000..6e25314 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-all-my-trades.md @@ -0,0 +1,55 @@ +- [Binance Fetch All My Trades](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'options': { + # 'defaultType': 'spot', // spot, future, margin + # }, +}) + + +exchange.load_markets () + +# exchange.verbose = True # uncomment for debugging + +symbol = 'BTC/USDT' +day = 24 * 60 * 60 * 1000 +start_time = exchange.parse8601 ('2020-03-01T00:00:00') +now = exchange.milliseconds () + +all_trades = [] + +while start_time < now: + + print('------------------------------------------------------------------') + print('Fetching trades from', exchange.iso8601(start_time)) + end_time = start_time + day + + trades = exchange.fetch_my_trades (symbol, start_time, None, { + 'endTime': end_time, + }) + if len(trades): + last_trade = trades[len(trades) - 1] + start_time = last_trade['timestamp'] + 1 + all_trades = all_trades + trades + else: + start_time = end_time + +print('Fetched', len(all_trades), 'trades') +for i in range(0, len(all_trades)): + trade = all_trades[i] + print (i, trade['id'], trade['datetime'], trade['amount']) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-all-trades.md b/docs/ccxt/wiki/examples/py/binance-fetch-all-trades.md new file mode 100644 index 0000000..3ce83c7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-all-trades.md @@ -0,0 +1,52 @@ +- [Binance Fetch All Trades](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import csv + + +import ccxt # noqa: E402 + +exchange = ccxt.binance() + +markets = exchange.load_markets() +symbol = 'ETH/BTC' +market = exchange.market(symbol) +one_hour = 3600 * 1000 +since = exchange.parse8601('2018-12-12T00:00:00') +now = exchange.milliseconds() +end = exchange.parse8601(exchange.ymd(now) + 'T00:00:00') +previous_trade_id = None +filename = exchange.id + '_' + market['id'] + '.csv' +with open(filename, mode="w") as csv_f: + csv_writer = csv.DictWriter(csv_f, delimiter=",", fieldnames=["timestamp", "size", "price", "side"]) + csv_writer.writeheader() + while since < end: + try: + trades = exchange.fetch_trades(symbol, since) + print(exchange.iso8601(since), len(trades), 'trades') + if len(trades): + last_trade = trades[-1] + if previous_trade_id != last_trade['id']: + since = last_trade['timestamp'] + previous_trade_id = last_trade['id'] + for trade in trades: + csv_writer.writerow({ + 'timestamp': trade['timestamp'], + 'size': trade['amount'], + 'price': trade['price'], + 'side': trade['side'], + }) + else: + since += one_hour + else: + since += one_hour + except ccxt.NetworkError as e: + print(type(e).__name__, str(e)) + exchange.sleep(60000) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-1.md b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-1.md new file mode 100644 index 0000000..18b977d --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-1.md @@ -0,0 +1,23 @@ +- [Binance Fetch Ohlcv Closing Time 1](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + +import ccxt # noqa: E402 + + +exchange = ccxt.binance() +symbol = 'BTC/USDT' +timeframe = '1h' + +timeframe_duration_in_seconds = exchange.parse_timeframe(timeframe) +timeframe_duration_in_milliseconds = timeframe_duration_in_seconds * 1000 +ohlcvs = exchange.fetch_ohlcv(symbol, timeframe) +for ohlcv in ohlcvs: + print([exchange.iso8601(ohlcv[0] + timeframe_duration_in_milliseconds - 1)] + ohlcv[1:]) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-2.md b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-2.md new file mode 100644 index 0000000..c428b7e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-closing-time-2.md @@ -0,0 +1,48 @@ +- [Binance Fetch Ohlcv Closing Time 2](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import asciichart + +import ccxt # noqa: E402 +class MyBinance(ccxt.binance): + def parse_ohlcv(self, ohlcv, market=None): + # + # [ + # 1591478520000, + # "0.02501300", + # "0.02501800", + # "0.02500000", + # "0.02500000", + # "22.19000000", + # 1591478579999, + # "0.55490906", + # 40, + # "10.92900000", + # "0.27336462", + # "0" + # ] + # + return [ + self.safe_integer(ohlcv, 6), + self.safe_number(ohlcv, 1), + self.safe_number(ohlcv, 2), + self.safe_number(ohlcv, 3), + self.safe_number(ohlcv, 4), + self.safe_number(ohlcv, 5), + ] + + +exchange = MyBinance() +symbol = 'BTC/USDT' +timeframe = '1h' + +ohlcvs = exchange.fetch_ohlcv(symbol, timeframe) +for ohlcv in ohlcvs: + print([exchange.iso8601(ohlcv[0])] + ohlcv[1:]) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-pagination.md b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-pagination.md new file mode 100644 index 0000000..0d7e684 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-pagination.md @@ -0,0 +1,43 @@ +- [Binance Fetch Ohlcv Pagination](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import ccxt # noqa: E402 + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +def main(): + exchange = ccxt.binance() + markets = exchange.load_markets() + # exchange.verbose = True # uncomment for debugging purposes if necessary + since = exchange.parse8601('2022-01-01T00:00:00Z') + symbol = 'BTC/USDT' + timeframe = '1h' + all_ohlcvs = [] + while True: + try: + ohlcvs = exchange.fetch_ohlcv(symbol, timeframe, since) + all_ohlcvs += ohlcvs + if len(ohlcvs): + print('Fetched', len(ohlcvs), symbol, timeframe, 'candles from', exchange.iso8601(ohlcvs[0][0])) + since = ohlcvs[-1][0] + 1 + else: + break + except Exception as e: + print(type(e).__name__, str(e)) + print('Fetched', len(all_ohlcvs), symbol, timeframe, 'candles in total') + if len(all_ohlcvs): + print(table([[exchange.iso8601(o[0])] + o[1:] for o in all_ohlcvs])) + + +main() +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-quote-volume.md b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-quote-volume.md new file mode 100644 index 0000000..83580f7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-quote-volume.md @@ -0,0 +1,55 @@ +- [Binance Fetch Ohlcv Quote Volume](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +class Binance(ccxt.binance): + def parse_ohlcv(self, ohlcv, market=None): + # + # [ + # 1591478520000, # open time + # "0.02501300", # open + # "0.02501800", # high + # "0.02500000", # low + # "0.02500000", # close + # "22.19000000", # volume + # 1591478579999, # close time + # "0.55490906", # quote asset volume + # 40, # number of trades + # "10.92900000", # taker buy base asset volume + # "0.27336462", # taker buy quote asset volume + # "0" # ignore + # ] + # + return [ + self.safe_integer(ohlcv, 0), + self.safe_number(ohlcv, 1), + self.safe_number(ohlcv, 2), + self.safe_number(ohlcv, 3), + self.safe_number(ohlcv, 4), + self.safe_number(ohlcv, 7), # << here + ] + +exchange = Binance() +markets = exchange.load_markets() +# exchange.verbose = True # uncomment for debugging purposes if necessary +ohlcv = exchange.fetch_ohlcv('BTC/USDT', '1h') +print(table(ohlcv)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-to-csv.md b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-to-csv.md new file mode 100644 index 0000000..a5e2f42 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv-to-csv.md @@ -0,0 +1,66 @@ +- [Binance Fetch Ohlcv To Csv](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import csv + +import ccxt # noqa: E402 + +def retry_fetch_ohlcv(exchange, max_retries, symbol, timeframe, since, limit): + num_retries = 0 + try: + num_retries += 1 + ohlcv = exchange.fetch_ohlcv(symbol, timeframe, since, limit) + # print('Fetched', len(ohlcv), symbol, 'candles from', exchange.iso8601 (ohlcv[0][0]), 'to', exchange.iso8601 (ohlcv[-1][0])) + return ohlcv + except Exception: + if num_retries > max_retries: + raise # Exception('Failed to fetch', timeframe, symbol, 'OHLCV in', max_retries, 'attempts') + + +def scrape_ohlcv(exchange, max_retries, symbol, timeframe, since, limit): + timeframe_duration_in_seconds = exchange.parse_timeframe(timeframe) + timeframe_duration_in_ms = timeframe_duration_in_seconds * 1000 + timedelta = limit * timeframe_duration_in_ms + now = exchange.milliseconds() + all_ohlcv = [] + fetch_since = since + while fetch_since < now: + ohlcv = retry_fetch_ohlcv(exchange, max_retries, symbol, timeframe, fetch_since, limit) + fetch_since = (ohlcv[-1][0] + 1) if len(ohlcv) else (fetch_since + timedelta) + all_ohlcv = all_ohlcv + ohlcv + if len(all_ohlcv): + print(len(all_ohlcv), 'candles in total from', exchange.iso8601(all_ohlcv[0][0]), 'to', exchange.iso8601(all_ohlcv[-1][0])) + else: + print(len(all_ohlcv), 'candles in total from', exchange.iso8601(fetch_since)) + return exchange.filter_by_since_limit(all_ohlcv, since, None, key=0) + + +def write_to_csv(filename, data): + with open(filename, mode='w') as output_file: + csv_writer = csv.writer(output_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) + csv_writer.writerows(data) + + +def scrape_candles_to_csv(filename, exchange_id, max_retries, symbol, timeframe, since, limit): + # instantiate the exchange by id + exchange = getattr(ccxt, exchange_id)() + # convert since from string to milliseconds integer if needed + if isinstance(since, str): + since = exchange.parse8601(since) + # preload all markets from the exchange + exchange.load_markets() + # fetch all candles + ohlcv = scrape_ohlcv(exchange, max_retries, symbol, timeframe, since, limit) + # save them to csv file + write_to_csv(filename, ohlcv) + print('Saved', len(ohlcv), 'candles from', exchange.iso8601(ohlcv[0][0]), 'to', exchange.iso8601(ohlcv[-1][0]), 'to', filename) + +# Binance's BTC/USDT candles start on 2017-08-17 +scrape_candles_to_csv('binance.csv', 'binance', 3, 'BTC/USDT', '1m', '2017-08-17T00:00:00Z', 100) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv.md b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv.md new file mode 100644 index 0000000..fe2cb15 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fetch-ohlcv.md @@ -0,0 +1,43 @@ +- [Binance Fetch Ohlcv](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import asciichart + +import ccxt # noqa: E402 +binance = ccxt.binance() +symbol = 'BTC/USDT' +timeframe = '1h' + +# each ohlcv candle is a list of [ timestamp, open, high, low, close, volume ] +index = 4 # use close price from each ohlcv candle + +height = 15 +length = 80 + + +def print_chart(exchange, symbol, timeframe): + + print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:') + + # get a list of ohlcv candles + ohlcv = exchange.fetch_ohlcv(symbol, timeframe) + + # get the ohlCv (closing price, index == 4) + series = [x[index] for x in ohlcv] + + # print the chart + print("\n" + asciichart.plot(series[-length:], {'height': height})) # print the chart + + last = ohlcv[len(ohlcv) - 1][index] # last closing price + return last + + +last = print_chart(binance, symbol, timeframe) +print("\n" + binance.name + " ₿ = $" + str(last) + "\n") # print last closing price + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-fiat.md b/docs/ccxt/wiki/examples/py/binance-fiat.md new file mode 100644 index 0000000..b592004 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-fiat.md @@ -0,0 +1,28 @@ +- [Binance Fiat](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() + +fiat_currencies = [currency['code'] for currency in exchange.currencies.values() if currency['info']['isLegalMoney']] + +fiat_markets = [market for market in exchange.markets.values() if ((market['base'] in fiat_currencies) or (market['quote'] in fiat_currencies))] + +for market in fiat_markets: + print(market['symbol']) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-futures-margin.md b/docs/ccxt/wiki/examples/py/binance-futures-margin.md new file mode 100644 index 0000000..8590ae1 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-futures-margin.md @@ -0,0 +1,199 @@ +- [Binance Futures Margin](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +print('CCXT Version:', ccxt.__version__) + +# Must read before your start: +# +# - https://github.com/ccxt/ccxt/wiki/Manual +# - https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods +# - https://github.com/ccxt/ccxt/wiki/Manual#unified-api +# +# In short, Binance's API is structured as follows and you should understand +# the meaning and the difference between ISOLATED vs CROSSED margin mode and +# the difference between Hedged positions vs One-way positions. +# +# - wapi: funding for withdrawals and deposits (wapi) +# - api: spot (api) +# - sapi: spot margin +# - CROSSED margin mode +# - Hedged positions +# - One-way positions +# - ISOLATED margin mode +# - Hedged positions +# - One-way positions +# - fapi: swap/perpetual futures margin +# - CROSSED margin mode +# - Hedged positions +# - One-way positions +# - ISOLATED margin mode +# - Hedged positions +# - One-way positions +# - dapi: classic delivery futures margin +# - CROSSED margin mode +# - Hedged positions +# - One-way positions +# - ISOLATED margin mode +# - Hedged positions +# - One-way positions +# +# You should pick the following: +# +# 1. which API you want to trade (fapi, i believe) +# 2. which specific margin mode you want (CROSSED or ISOLATED) +# 3. which specific position mode you want (Hedged or One-way) +# +# Differences in margin modes: +# +# - CROSSED margin mode = you have one futures-margin account for all your positions, +# if some position requires too much margin, your entire account is affected, +# leaving less margin for the other positions, +# thus you share the same margin _"across"_ all your positions +# +# - ISOLATED margin mode = you have separate futures-margin for each of your positions, +# if some position runs out of margin the other positions are not affected, +# thus your positions are _"isolated"_ from one another +# +# Difference in position modes: +# +# - One-way position mode - when you're in this mode +# there's no such things as LONG or SHORT positions. +# You just buy or sell a number of contracts, and +# if the price goes down, your PnL goes negative, +# if the price goes up, your PnL is positive. +# Thus, the position operates `BOTH` ways, both long and short at the same time, +# the notion of "long" and "short" is abstracted away from you, +# so there's only one way the position can go and that way is called "BOTH". +# +# - Hedge mode - you either enter a `LONG` position or a `SHORT` position and +# your PnL calculation rules depend on that +# so there's a number of ways a position can go +# +# Which specific mode of trading (margin mode + position mode) do you want? + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'future', + }, +}) + +markets = exchange.load_markets() + +symbol = 'BTC/USDT' # YOUR SYMBOL HERE +market = exchange.market(symbol) + +exchange.verbose = True # UNCOMMENT THIS AFTER LOADING THE MARKETS FOR DEBUGGING + +print('----------------------------------------------------------------------') + +print('Fetching your balance:') +response = exchange.fetch_balance() +pprint(response['total']) # make sure you have enough futures margin... +# pprint(response['info']) # more details + +print('----------------------------------------------------------------------') + +# https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data + +print('Getting your positions:') +response = exchange.fapiprivatev2_get_positionrisk() +print(table(response)) + +print('----------------------------------------------------------------------') + +# https://binance-docs.github.io/apidocs/futures/en/#change-position-mode-trade + +print('Getting your current position mode (One-way or Hedge Mode):') +response = exchange.fapiprivate_get_positionside_dual() +if response['dualSidePosition']: + print('You are in Hedge Mode') +else: + print('You are in One-way Mode') + +print('----------------------------------------------------------------------') + +# print('Setting your position mode to One-way:') +# response = exchange.fapiprivate_post_positionside_dual({ +# 'dualSidePosition': False, +# }) +# print(response) + +# print('Setting your positions to Hedge mode:') +# response = exchange.fapiprivate_post_positionside_dual({ +# 'dualSidePosition': True, +# }) +# print(response) + +# print('----------------------------------------------------------------------') + +# # https://binance-docs.github.io/apidocs/futures/en/#change-margin-type-trade + +# print('Changing your', symbol, 'position margin mode to CROSSED:') +# response = exchange.fapiprivate_post_margintype({ +# 'symbol': market['id'], +# 'marginType': 'CROSSED', +# }) +# print(response) + +# print('Changing your', symbol, 'position margin mode to ISOLATED:') +# response = exchange.fapiprivate_post_margintype({ +# 'symbol': market['id'], +# 'marginType': 'ISOLATED', +# }) +# print(response) + +# print('----------------------------------------------------------------------') + +# # https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-futures + +# code = 'USDT' +# amount = 123.45 +# currency = exchange.currency(code) + +# print('Moving', code, 'funds from your spot account to your futures account:') + +# response = exchange.sapi_post_futures_transfer({ +# 'asset': currency['id'], +# 'amount': exchange.currency_to_precision(code, amount), +# # 1: transfer from spot account to USDT-Ⓜ futures account. +# # 2: transfer from USDT-Ⓜ futures account to spot account. +# # 3: transfer from spot account to COIN-Ⓜ futures account. +# # 4: transfer from COIN-Ⓜ futures account to spot account. +# 'type': 1, +# }) + +# print('----------------------------------------------------------------------') + +# # for ISOLATED positions only +# print('Modifying your ISOLATED', symbol, 'position margin:') +# response = exchange.fapiprivate_post_positionmargin({ +# 'symbol': market['id'], +# 'amount': 123.45, # ←-------------- YOUR AMOUNT HERE +# 'positionSide': 'BOTH', # use BOTH for One-way positions, LONG or SHORT for Hedge Mode +# 'type': 1, # 1 = add position margin, 2 = reduce position margin +# }) + +# print('----------------------------------------------------------------------') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-futures-positions.md b/docs/ccxt/wiki/examples/py/binance-futures-positions.md new file mode 100644 index 0000000..a3a5297 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-futures-positions.md @@ -0,0 +1,32 @@ +- [Binance Futures Positions](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_TESTNET_API_KEY', + 'secret': 'YOUR_TESTNET_API_SECRET', + 'options': { + 'defaultType': 'future', + }, +}) + +exchange.set_sandbox_mode(True) # comment if you're not using the testnet +markets = exchange.load_markets() +exchange.verbose = True # debug output + +balance = exchange.fetch_balance() +positions = balance['info']['positions'] +pprint(positions) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-futures-set-leverage-implicit-api.md b/docs/ccxt/wiki/examples/py/binance-futures-set-leverage-implicit-api.md new file mode 100644 index 0000000..ff22919 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-futures-set-leverage-implicit-api.md @@ -0,0 +1,35 @@ +- [Binance Futures Set Leverage Implicit Api](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'future', + } +}) + +exchange.load_markets() + +symbol = 'ADA/USDT' +market = exchange.market(symbol) +leverage = 10 + +response = exchange.fapiprivate_post_leverage({ + 'symbol': market['id'], + 'leverage': leverage, +}) + +print(response) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-futures-set-leverage.md b/docs/ccxt/wiki/examples/py/binance-futures-set-leverage.md new file mode 100644 index 0000000..ea69773 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-futures-set-leverage.md @@ -0,0 +1,25 @@ +- [Binance Futures Set Leverage](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +exchange.load_markets() + +response = exchange.set_leverage(10, 'ADA/USDT') + +print(response) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-market-order-quote-usdt.md b/docs/ccxt/wiki/examples/py/binance-market-order-quote-usdt.md new file mode 100644 index 0000000..18191c9 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-market-order-quote-usdt.md @@ -0,0 +1,58 @@ +- [Binance Market Order Quote Usdt](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +symbol = 'ETH/USDT' + +try: + + print('--------------------------------------------------------------') + + # option 1 – specify price * amount + amount = 1 + price = 4000 + # cost = amount * price + # this line will use the amount * price to calculate the total cost-to-spend (4000) + order = exchange.create_order(symbol, 'market', 'buy', amount, price) + pprint(order) + + print('--------------------------------------------------------------') + + # option 2 – specify + # this line does the same, but you override the cost via extra params + params = { + 'quoteOrderQty': 4000, # binance-specific + } + amount = None + price = None + order = exchange.create_order(symbol, 'market', 'buy', amount, price, params) + pprint(order) + +except Exception as e: + print(type(e).__name__, str(e)) + + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-poll-balance.md b/docs/ccxt/wiki/examples/py/binance-poll-balance.md new file mode 100644 index 0000000..55c58f4 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-poll-balance.md @@ -0,0 +1,41 @@ +- [Binance Poll Balance](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +previous_timestamp = exchange.milliseconds() +while True: + try: + balance = exchange.fetch_balance() + print('--------------------------------------------------------------') + current_timestamp = exchange.milliseconds() + print(exchange.iso8601(current_timestamp), 'balance:') + pprint(balance) + print('Fetched in', current_timestamp - previous_timestamp, 'milliseconds') + previous_timestamp = current_timestamp + except Exception as e: + print(type(e).__name__, str(e)) + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-poll-positions.md b/docs/ccxt/wiki/examples/py/binance-poll-positions.md new file mode 100644 index 0000000..0b83eab --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-poll-positions.md @@ -0,0 +1,34 @@ +- [Binance Poll Positions](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +exchange = ccxt.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) +markets = exchange.load_markets() + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +while True: + try: + positions = exchange.fetch_positions () + print(exchange.iso8601(exchange.milliseconds()), len(positions), 'positions') + print([ [position['symbol'], position['contracts']] for position in positions ]) + except Exception as e: + print(type(e).__name__, str(e)) + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-savings-endpoints.md b/docs/ccxt/wiki/examples/py/binance-savings-endpoints.md new file mode 100644 index 0000000..d9c5acd --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-savings-endpoints.md @@ -0,0 +1,46 @@ +- [Binance Savings Endpoints](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() + +exchange.verbose = True # uncomment for debugging purposes + +response = exchange.sapi_post_lending_customizedfixed_purchase({ + # YOUR PARAMS HERE + # https://binance-docs.github.io/apidocs/spot/en/#purchase-fixed-activity-project-user_data +}) + +pprint(response) + +response = exchange.sapi_post_lending_daily_purchase({ + # YOUR PARAMS HERE + # https://binance-docs.github.io/apidocs/spot/en/#purchase-flexible-product-user_data +}) + +pprint(response) + +response = exchange.sapi_post_lending_daily_redeem({ + # YOUR PARAMS HERE + # https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-user_data +}) + +pprint(response) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-spot-trailing.md b/docs/ccxt/wiki/examples/py/binance-spot-trailing.md new file mode 100644 index 0000000..8fde39a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-spot-trailing.md @@ -0,0 +1,89 @@ +- [Binance Spot Trailing](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +exchange = ccxt.binance({ + 'apiKey': os.environ['BINANCE_APIKEY'], + 'secret': os.environ['BINANCE_SECRET'], +}) + +# You can read more about spot trailing orders here: +# https://github.com/binance/binance-spot-api-docs/blob/master/faqs/trailing-stop-faq.md + +# Example 1: Spot : trailing spot loss +async def example_1(): + markets = await exchange.load_markets(True) + + # create STOP_LOSS_LIMIT BUY with a trailing stop of 5%. + symbol = 'LTC/USDT' + type = 'STOP_LOSS_LIMIT' + side = 'buy' + amount = 0.4 + price = 25 + params = { + 'trailingDelta': 500, # 5% in BIPS + } + exchange.verbose = True + create_order = await exchange.create_order(symbol, type, side, amount, price, params) + print('Create order id:', create_order['id']) + + # cancel created order + canceled_order = await exchange.cancel_order(create_order['id'], symbol) + print(canceled_order) + + await exchange.close() +# Example 2: Spot : TAKE_PROFIT_LIMIT BUY order +async def example_2(): + markets = await exchange.load_markets(True) + + # create TAKE_PROFIT_LIMIT BUY with a trailing stop of 5%. + symbol = 'LTC/USDT' + type = 'TAKE_PROFIT_LIMIT' + side = 'buy' + amount = 0.2 + price = 70 + params = { + 'trailingDelta': 250 # 2.5% in BIPS + } + exchange.verbose = True + create_order = await exchange.create_order(symbol, type, side, amount, price, params) + print('Create order id:', create_order['id']) + + # cancel created order + canceled_order = await exchange.cancel_order(create_order['id'], symbol) + print(canceled_order) + + await exchange.close() +async def main(): + try: + # await example_1() + await example_2() + except Exception as e: + print(e) + await exchange.close() + + + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-stop-loss-take-profit.md b/docs/ccxt/wiki/examples/py/binance-stop-loss-take-profit.md new file mode 100644 index 0000000..e692b74 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-stop-loss-take-profit.md @@ -0,0 +1,46 @@ +- [Binance Stop Loss Take Profit](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +exchange = ccxt.binanceusdm({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() +# exchange.verbose = True # uncomment for debugging purposes + +symbol = 'BTC/USDT' +side = 'buy' +amount = 0.01 +price = None +stopLossPrice = 25000 +takeProfitPrice = 35000 + +try: + + order = exchange.create_order(symbol, 'MARKET', side, amount) + print(order) + + inverted_side = 'sell' if side == 'buy' else 'buy' + + stopLossParams = {'stopPrice': stopLossPrice} + stopLossOrder = exchange.create_order(symbol, 'STOP_MARKET', inverted_side, amount, price, stopLossParams) + print(stopLossOrder) + + takeProfitParams = {'stopPrice': takeProfitPrice} + takeProfitOrder = exchange.create_order(symbol, 'TAKE_PROFIT_MARKET', inverted_side, amount, price, takeProfitParams) + print(takeProfitOrder) + +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-test-order.md b/docs/ccxt/wiki/examples/py/binance-test-order.md new file mode 100644 index 0000000..be70fa8 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-test-order.md @@ -0,0 +1,34 @@ +- [Binance Test Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +symbol = 'ETH/BTC' +type = 'limit' # or 'market' +side = 'sell' # or 'buy' +amount = 1.0 +price = 0.060154 # or None + +# extra params and overrides if needed +params = { + 'test': True, # test if it's valid, but don't actually place it +} + +order = exchange.create_order(symbol, type, side, amount, price, params) + +print(order) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-universal-transfer.md b/docs/ccxt/wiki/examples/py/binance-universal-transfer.md new file mode 100644 index 0000000..43bb2d1 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-universal-transfer.md @@ -0,0 +1,33 @@ +- [Binance Universal Transfer](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +def main(): + + # apiKey must have universal transfer permissions + binance = ccxt.binance({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + }) + binance.load_markets() + + pprint(binance.transfer('USDT', 0.1, 'spot', 'future')) + transfers = binance.fetch_transfers() + pprint('there is ' + str(len(transfers)) + ' transfers') + pprint(binance.transfer('USDT', 0.1, 'spot', 'cross')) # For transfer to cross margin wallet + pprint(binance.transfer('USDT', 0.1, 'spot', 'ADA/USDT')) # For transfer to an isolated margin wallet + + +main() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/binance-usdm-fetch-continuous-klines-ohlcv.md b/docs/ccxt/wiki/examples/py/binance-usdm-fetch-continuous-klines-ohlcv.md new file mode 100644 index 0000000..35f50e9 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/binance-usdm-fetch-continuous-klines-ohlcv.md @@ -0,0 +1,44 @@ +- [Binance Usdm Fetch Continuous Klines Ohlcv](./examples/py/) + + + ```python + +# -*- coding: utf-8 -*- + +import os +import sys + +import ccxt # noqa: E402 + +print('CCXT Version:', ccxt.__version__) + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +exchange = ccxt.binanceusdm() +try: + exchange.load_markets() + timeframe = '1m' + limit = 1 + symbol = 'BTC/USDT' + market = exchange.market(symbol) + timeframe = '1m' + params = { + 'pair': market['id'], + 'contractType': 'PERPETUAL', # 'PERPETUAL', 'CURRENT_MONTH', 'NEXT_MONTH', 'CURRENT_QUARTER', 'NEXT_QUARTER' + 'interval': exchange.timeframes[timeframe], + } + # https://binance-docs.github.io/apidocs/futures/en/#continuous-contract-kline-candlestick-data + ohlcvs = exchange.fapiPublic_get_continuousklines(params) + print(table([o for o in ohlcvs])) + print(table([[exchange.iso8601(int(o[0]))] + o[1:] for o in ohlcvs])) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bitfinex-rate-limiting.md b/docs/ccxt/wiki/examples/py/bitfinex-rate-limiting.md new file mode 100644 index 0000000..de58b0e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bitfinex-rate-limiting.md @@ -0,0 +1,35 @@ +- [Bitfinex Rate Limiting](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +symbol = 'ETH/BTC' + +exchange = ccxt.bitfinex({ + + # BITFINEX RATELIMITS DON'T CORRESPOND TO THEIR DOCUMENTATION! + + # their actual rate limit is significantly more strict than documented! + 'rateLimit': 3000, # once every 3 seconds, 20 times per minute – will work + + # this is their documented ratelimit according to this page: + # https://docs.bitfinex.com/v1/reference#rest-public-orderbook + # 'rateLimit': 1000, # once every second, 60 times per minute – won't work, will throw DDoSProtection +}) + +for i in range(0, 100): + print('--------------------------------------------------------------------') + print(i) + print('sent:', exchange.iso8601(exchange.milliseconds())) + orderbook = exchange.fetch_order_book(symbol) + print('received:', exchange.iso8601(exchange.milliseconds()), 'bid:', orderbook['bids'][0], 'ask:', orderbook['asks'][0]) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bitget-perpetual-futures-swaps.md b/docs/ccxt/wiki/examples/py/bitget-perpetual-futures-swaps.md new file mode 100644 index 0000000..f35ed47 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bitget-perpetual-futures-swaps.md @@ -0,0 +1,56 @@ +- [Bitget Perpetual Futures Swaps](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +def main(): + exchange = ccxt.bitget({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'password': 'YOUR_API_PASSWORD', + 'options': { + 'defaultType': 'swap', + } + }) + + try: + + markets = exchange.load_markets() + + # exchange.verbose = True # uncomment for debugging purposes if necessary + + # fetching balance + balance = exchange.fetch_balance() + print(balance['total']) + + # placing a limit order + symbol = 'ETH/USDT:USDT' + type = 'limit' + side = 'buy' + amount = 1 # how many contracts to buy or sell, integer number of contracts + price = 3000 + order = exchange.create_order(symbol, type, side, amount, price) + print(order) + + # placing a market order + symbol = 'ETH/USDT:USDT' + type = 'market' + side = 'sell' + amount = 1 # how many contracts to buy or sell, integer number of contracts + order = exchange.create_order(symbol, type, side, amount) + print(order) + + except Exception as e: + print(type(e).__name__, str(e)) + + +main() +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bitmex-cancel-orders.md b/docs/ccxt/wiki/examples/py/bitmex-cancel-orders.md new file mode 100644 index 0000000..b34f5a2 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bitmex-cancel-orders.md @@ -0,0 +1,72 @@ +- [Bitmex Cancel Orders](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.bitmex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +# exchange.set_sandbox_mode(True) # uncomment to use the testnet sandbox + +symbol = 'BTC/USD' +type = 'limit' +side = 'buy' +amount = 100 +price = 15000 + +### Creating multiple orders and cancel them +### https://github.com/ccxt/ccxt/issues/10112 + +## Example 1 +## Canceling orders using ClientOrderId + +# create first order +order1 = exchange.create_order(symbol, type, side, amount, price, {'clientOrderId': 'order0001'}) +print(order1['id']) +# create second order +price = 10000 +order2 = exchange.create_order(symbol, type, side, amount, price, {'clientOrderId': 'order0002'}) +print(order2['id']) +# create third order +price = 9000 +order3 = exchange.create_order(symbol, type, side, amount, price, {'clientOrderId': 'order0003'}) +print(order3['id']) +# canceling first order +cancelResponse = exchange.cancel_order(None, None, {'clientOrderId': 'order0001'}) +print(cancelResponse) +# cancel second and third order at the same time +cancelboth = exchange.cancel_orders(None, None, {'clientOrderId': ['order0002','order0003']}) +print(cancelboth) + +## Example 2 +## Canceling orders using OrderId + +# create first order +newOrder1 = exchange.create_order(symbol, type, side, amount, price) +print(newOrder1['id']) +# create second order +price = 10000 +newOrder2 = exchange.create_order(symbol, type, side, amount, price) +print(newOrder2['id']) +# create third order +price = 9000 +newOrder3 = exchange.create_order(symbol, type, side, amount, price) +print(newOrder3['id']) +# canceling first order +cancelResponse = exchange.cancel_order(newOrder1['id']) +print(cancelResponse) +# cancel second and third order at the same time +ids = [newOrder2['id'], newOrder3['id']] +cancelboth = exchange.cancel_orders(ids) +print(cancelboth) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bitmex-create-order.md b/docs/ccxt/wiki/examples/py/bitmex-create-order.md new file mode 100644 index 0000000..db4863c --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bitmex-create-order.md @@ -0,0 +1,33 @@ +- [Bitmex Create Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.bitmex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +symbol = 'BTC/USD:BTC-220624' # bitcoin contract according to https://github.com/ccxt/ccxt/wiki/Manual#symbols-and-market-ids +type = 'StopLimit' # or 'Market', or 'Stop' or 'StopLimit' +side = 'sell' # or 'buy' +amount = 1.0 +price = 6500.0 # or None + +# extra params and overrides +params = { + 'stopPx': 6000.0, # if needed +} + +order = exchange.create_order(symbol, type, side, amount, price, params) +print(order) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bitmex-fetch-ohlcv-with-extra-params.md b/docs/ccxt/wiki/examples/py/bitmex-fetch-ohlcv-with-extra-params.md new file mode 100644 index 0000000..e119c52 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bitmex-fetch-ohlcv-with-extra-params.md @@ -0,0 +1,39 @@ +- [Bitmex Fetch Ohlcv With Extra Params](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time + + +import ccxt # noqa: E402 + +bitmex = ccxt.bitmex() + +# params: +symbol = 'BTC/USD' +timeframe = '1m' +limit = 100 +params = {'partial': False} # ←-------- no reversal + +while True: + + # pay attention to since with respect to limit if you're doing it in a loop + since = bitmex.milliseconds() - limit * 60 * 1000 + + candles = bitmex.fetch_ohlcv(symbol, timeframe, since, limit, params) + num_candles = len(candles) + print('{}: O: {} H: {} L:{} C:{}'.format( + bitmex.iso8601(candles[num_candles - 1][0]), + candles[num_candles - 1][1], + candles[num_candles - 1][2], + candles[num_candles - 1][3], + candles[num_candles - 1][4])) + # * 5 to make distinct delay and to avoid too much load + # / 1000 to convert milliseconds to fractional seconds + time.sleep(bitmex.rateLimit * 5 / 1000) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bitmex-ohlcv-convert-5m-to-15m.md b/docs/ccxt/wiki/examples/py/bitmex-ohlcv-convert-5m-to-15m.md new file mode 100644 index 0000000..71459a5 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bitmex-ohlcv-convert-5m-to-15m.md @@ -0,0 +1,56 @@ +- [Bitmex Ohlcv Convert 5m To 15m](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +bitmex = ccxt.bitmex() + +# fetch 5m OHLCV + +symbol = 'BTC/USD' + +ohlcv5 = bitmex.fetch_ohlcv(symbol, '5m') +ohlcv15 = [] + +# OHLCV key indexes + +timestamp = 0 +open = 1 +high = 2 +low = 3 +close = 4 +volume = 5 + +# convert 5m → 15m + +if len(ohlcv5) > 2: + for i in range(0, len(ohlcv5) - 2, 3): + highs = [ohlcv5[i + j][high] for j in range(0, 3) if ohlcv5[i + j][high]] + lows = [ohlcv5[i + j][low] for j in range(0, 3) if ohlcv5[i + j][low]] + volumes = [ohlcv5[i + j][volume] for j in range(0, 3) if ohlcv5[i + j][volume]] + candle = [ + ohlcv5[i + 0][timestamp], + ohlcv5[i + 0][open], + max(highs) if len(highs) else None, + min(lows) if len(lows) else None, + ohlcv5[i + 2][close], + sum(volumes) if len(volumes) else None, + ] + ohlcv15.append(candle) +else: + raise Exception('Too few 5m candles') + +# do whatever you want with your 15m candles here... + +pprint(ohlcv15) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bitmex-order-value.md b/docs/ccxt/wiki/examples/py/bitmex-order-value.md new file mode 100644 index 0000000..388c382 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bitmex-order-value.md @@ -0,0 +1,48 @@ +- [Bitmex Order Value](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.bitmex() + +markets = exchange.load_markets() +symbol = 'XBTU20' +market = exchange.market(symbol) + +units = { + 'XBT': { 'decimals': 4, 'multiplier': 1, 'name': 'bitcoin' }, + 'mXBT': { 'decimals': 3, 'multiplier': 1000, 'name': 'milli-bitcoin' }, + 'μXBT': { 'decimals': 1, 'multiplier': 1000000, 'name': 'micro-bitcoin' }, + 'XBt': { 'decimals': 0, 'multiplier': 100000000, 'name': 'satoshi' }, +} + +# the following calculation depends on contract specifications +# one XBTU20 contract = 1 USD in Bitcoin + +num_contracts = 1 + +while True: + try: + ticker = exchange.fetch_ticker(symbol) + last_price = ticker['last'] + value = num_contracts / last_price + print('---------------------------------------------------------------') + print(exchange.iso8601(exchange.milliseconds())) + for unit in units: + multiplier = units[unit]['multiplier'] + decimals = units[unit]['decimals'] + name = units[unit]['name'] + rounded_value = exchange.decimal_to_precision(value * multiplier, ccxt.ROUND, decimals) # alternatively, use ccxt.TRUNCATE here + print(num_contracts, symbol, 'contracts =', rounded_value, unit, '(' + name + ')') + except Exception as e: + pass + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bittrex-fetch-closed-orders-history.md b/docs/ccxt/wiki/examples/py/bittrex-fetch-closed-orders-history.md new file mode 100644 index 0000000..a0d7e4d --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bittrex-fetch-closed-orders-history.md @@ -0,0 +1,77 @@ +- [Bittrex Fetch Closed Orders History](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +exchange = ccxt.bittrex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', +}) + +exchange.load_markets() + +symbol = 'ETH/BTC' +market = exchange.markets[symbol] +starting_date = '2017-01-01T00:00:00' +now = exchange.milliseconds() + +print("\nFetching history for:", symbol, "\n") + +all_orders = [] +since = exchange.parse8601(starting_date) + +while since < now: + + try: + + print('Fetching history for', symbol, 'since', exchange.iso8601(since)) + orders = exchange.fetch_closed_orders(symbol, since) + print('Fetched', len(orders), 'orders') + + all_orders = all_orders + orders + + if len(orders): + + last_order = orders[-1] + since = last_order['timestamp'] + 1 + + else: + + break # no more orders left for this symbol, move to next one + + except Exception as e: + + print(e) + + +# omit the following keys for a compact table output +# otherwise it won't fit into the screen width +omitted_keys = [ + 'info', + 'timestamp', + 'lastTradeTimestamp', + 'fee', +] + +print(table([exchange.omit(order, omitted_keys) for order in all_orders])) +print('Fetched', len(all_orders), symbol, 'orders in total') + +# do whatever you want to do with them, calculate profit loss, etc... + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/build-ohlcv-bars.md b/docs/ccxt/wiki/examples/py/build-ohlcv-bars.md new file mode 100644 index 0000000..7299d1b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/build-ohlcv-bars.md @@ -0,0 +1,66 @@ +- [Build Ohlcv Bars](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code +import asyncio +import ccxt.pro as ccxt # noqa: E402 + + +# AUTO-TRANSPILE # +# Bulding OHLCV array from trades (executions) data is a bit tricky. For example, if you want to build 100 ohlcv bars of 1-minute timeframe, then you have to fetch the 100 minutes of trading data. So, higher timeframe bars require more trading data (i.e. building 100 bars of 1-day timeframe OHLCV would require massive amount of trading data, which might not be desirable for user, because of data-usage rate limits) +async def example_with_fetch_trades(): + exch = ccxt.binance({}) + timeframe = '1m' + symbol = 'OGN/USDT' + since = exch.milliseconds() - 1000 * 60 * 30 # last 30 mins + limit = 1000 + trades = await exch.fetch_trades(symbol, since, limit) + generated_bars = exch.build_ohlcvc(trades, timeframe, since, limit) + # you can ignore 6th index ("count" field) from ohlcv entries, which is not part of OHLCV standard structure and is just added internally by `buildOHLCVC` method + print('[REST] Constructed', len(generated_bars), 'bars from trades: ', generated_bars) + + await exch.close() + +async def example_with_watch_trades(): + exch = ccxt.binance({}) + timeframe = '1m' + symbol = 'DOGE/USDT' + limit = 1000 + since = exch.milliseconds() - 10 * 60 * 1000 * 1000 # last 10 hrs + collected_trades = [] + collected_bars = [] + while True: + ws_trades = await exch.watch_trades(symbol, since, limit, {}) + collected_trades = collected_trades + ws_trades + generated_bars = exch.build_ohlcvc(collected_trades, timeframe, since, limit) + # Note: first bar would be partially constructed bar and its 'open' & 'high' & 'low' prices (except 'close' price) would probably have different values compared to real bar on chart, because the first obtained trade timestamp might be somewhere in the middle of timeframe period, so the pre-period would be missing because we would not have trades data. To fix that, you can get older data with `fetchTrades` to fill up bars till start bar. + for i in range(0, len(generated_bars)): + bar = generated_bars[i] + bar_timestamp = bar[0] + collected_bars_length = len(collected_bars) + last_collected_bar_timestamp = collected_bars[collected_bars_length - 1][0] if collected_bars_length > 0 else 0 + if bar_timestamp == last_collected_bar_timestamp: + # if timestamps are same, just updarte the last bar + collected_bars[collected_bars_length - 1] = bar + elif bar_timestamp > last_collected_bar_timestamp: + collected_bars.append(bar) + # remove the trades from saved array, which were till last collected bar's open timestamp + collected_trades = exch.filter_by_since_limit(collected_trades, bar_timestamp) + # Note: first bar would carry incomplete values, please read comment in "buildOHLCVCFromWatchTrades" method definition for further explanation + print('[WS] Constructed', len(collected_bars), 'bars from', symbol, 'trades: ', collected_bars) + + + await exch.close() + +asyncio.run(example_with_fetch_trades()) + + + +asyncio.run(example_with_watch_trades()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/builtin-rate-limiting-long-poller.md b/docs/ccxt/wiki/examples/py/builtin-rate-limiting-long-poller.md new file mode 100644 index 0000000..522ec13 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/builtin-rate-limiting-long-poller.md @@ -0,0 +1,20 @@ +- [Builtin Rate Limiting Long Poller](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.bitfinex() + +for i in range(0, 10): + # this can be any call instead of fetch_ticker, really + print(exchange.fetch_ticker('BTC/USD')) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bybit-USDC-create-option-order.md b/docs/ccxt/wiki/examples/py/bybit-USDC-create-option-order.md new file mode 100644 index 0000000..61d89e1 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bybit-USDC-create-option-order.md @@ -0,0 +1,32 @@ +- [Bybit Usdc Create Option Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.bybit ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'defaultType': 'option', + # 'verbose': True, # for debug output +}) + +# BASE/QUOTE:SETTLE-YYMMDD-STRIKE-C (end with C for call, end with P for put) +symbol = 'BTC/USD:USDC-221209-18000-C' +amount = 0.01 +price = 280.0 + +try: + order = exchange.create_order(symbol, 'limit', 'buy', amount, price) + pprint(order) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bybit-conditional-orders.md b/docs/ccxt/wiki/examples/py/bybit-conditional-orders.md new file mode 100644 index 0000000..919cb30 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bybit-conditional-orders.md @@ -0,0 +1,28 @@ +- [Bybit Conditional Orders](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +exchange = ccxt.bybit({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() + +# exchange.verbose = True # uncomment for debugging purposes + +params = {'stop_px': 9750, 'base_price':11152} +order = exchange.create_order('BTC/USD', 'market', 'buy', 911, None, params) + +pprint(order) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bybit-positions.md b/docs/ccxt/wiki/examples/py/bybit-positions.md new file mode 100644 index 0000000..c86651e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bybit-positions.md @@ -0,0 +1,36 @@ +- [Bybit Positions](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +from pprint import pprint + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.bybit ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() # https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + +exchange.verbose = True # uncomment for debugging +symbol = 'BTC/USDT:USDT' # https://github.com/ccxt/ccxt/wiki/Manual#contract-naming-conventions +market = exchange.market(symbol) +params = {'subType':'linear' if market['linear'] else 'inverse'} +linear_positions = exchange.fetch_positions([ symbol ], params) +pprint(linear_positions) +symbol = 'BTC/USD:BTC' +market = exchange.market(symbol) +params = {'subType':'linear' if market['linear'] else 'inverse'} +inverse_positions = exchange.fetch_positions([ symbol ], params) +pprint(inverse_positions) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bybit-trailling.md b/docs/ccxt/wiki/examples/py/bybit-trailling.md new file mode 100644 index 0000000..1988f4f --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bybit-trailling.md @@ -0,0 +1,77 @@ +- [Bybit Trailling](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.bybit({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +# exchange.set_sandbox_mode(True) # enable sandbox mode +# Example 1 :: Swap : open position and set trailing stop and close it +async def example_2(): + exchange.options['defaultType'] = 'swap'; # very important set swap as default type + markets = await exchange.load_markets() + + symbol = 'LTC/USDT:USDT' + market = exchange.market(symbol) + + # fetch swap balance + balance = await exchange.fetch_balance() + print(balance) + + # set trailing stop + + # create market order and open position + type = 'market' + side = 'buy' + amount = 0.1 + price = None + create_order = await exchange.create_order(symbol, type, side, amount, price) + print('Create order id:', create_order['id']) + + # set trailing stop + trailing_stop = 30 # YOUR TRAILING STOP + rawSide = 'Buy' # or 'Sell' + params = { + 'symbol': market['id'], + 'side': rawSide, + 'trailing_stop': trailing_stop + } + trailing_response = await exchange.privatePostPrivateLinearPositionTradingStop(params) + print(trailing_response) + + # check opened position + symbols = [ symbol ] + positions = await exchange.fetch_positions(symbols) + print(positions) + + # Close position by issuing a order in the opposite direction + params = { + 'reduce_only': True + } + close_position_order = await exchange.createOrder(symbol, type, side, amount, price, params) + print(close_position_order) + +async def main(): + await example_2() + +asyncio.run(main()) + + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/bybit-updated.md b/docs/ccxt/wiki/examples/py/bybit-updated.md new file mode 100644 index 0000000..a32f4b1 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/bybit-updated.md @@ -0,0 +1,173 @@ +- [Bybit Updated](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.bybit({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + + +# Example 1: Spot : fetch balance, create order, cancel it and check canceled orders +async def example_1(): + exchange.options['defaultType'] = 'spot'; # very important set spot as default type + markets = await exchange.load_markets(True) + + # fetch spot balance + balance = await exchange.fetch_balance() + print(balance) + + # create limit order + symbol = 'LTC/USDT' + type = 'limit' + side = 'buy' + amount = 0.1 + price = 50 + create_order = await exchange.create_order(symbol, type, side, amount, price) + print('Create order id:', create_order['id']) + + # cancel created order + canceled_order = await exchange.cancel_order(create_order['id'], symbol) + print(canceled_order) + + # Check canceled orders (bybit does not have a single endpoint to check orders + # we have to choose whether to check open or closed orders and call fetch_open_orders + # or fetch_closed_orders respectively + orders = await exchange.fetch_closed_orders(symbol) + print(orders) + await exchange.close() +# Example 2 :: Swap : fetch balance, open a position and close it +async def example_2(): + exchange.options['defaultType'] = 'swap'; # very important set swap as default type + markets = await exchange.load_markets(True) + + # fetch swap balance + balance = await exchange.fetch_balance() + print(balance) + + # create market order and open position + symbol = 'LTC/USDT:USDT' + type = 'market' + side = 'buy' + amount = 0.1 + price = None + create_order = await exchange.create_order(symbol, type, side, amount, price) + print('Create order id:', create_order['id']) + + # check opened position + symbols = [ symbol ] + positions = await exchange.fetch_positions(symbols) + print(positions) + + # Close position by issuing a order in the opposite direction + side = 'sell' + params = { + 'reduce_only': True + } + close_position_order = await exchange.createOrder(symbol, type, side, amount, price, params) + print(close_position_order) +# Example 3 :: USDC Swap : fetch balance, open a position and close it +async def example_3(): + exchange.options['defaultType'] = 'swap'; # very important set swap as default type + markets = await exchange.load_markets(True) + + # fetch USDC swap balance + # when no symbol is available we can show our intent + # of using USDC endpoints by either using defaultSettle in options or + # settle in params + # Using Options: exchange.options['defaultSettle'] = 'USDC'; + # Using params: + balanceParams = { + 'settle': 'USDC' + } + balance = await exchange.fetch_balance(balanceParams) + print(balance) + + # create order and open position + # taking into consideration that USDC markets do not support + # market orders + symbol = 'BTC/USD:USDC' + type = 'limit' + side = 'buy' + amount = 0.1 + price = 15000 # adjust this accordingly + create_order = await exchange.create_order(symbol, type, side, amount, price) + print('Create order id:', create_order['id']) + + # check if the order was filled and the position opened + symbols = [ symbol ] + positions = await exchange.fetch_positions(symbols) + print(positions) + + # Close position (assuming it was already opened) by issuing an order in the opposite direction + side = 'sell' + params = { + 'reduce_only': True + } + close_position_order = await exchange.createOrder(symbol, type, side, amount, price, params) + print(close_position_order) +# Example 4 :: Future : fetch balance, create stop-order and check open stop-orders +async def example_4(): + exchange.options['defaultType'] = 'future'; # very important set future as default type + markets = await exchange.load_markets(True) + + # fetch future balance + balance = await exchange.fetch_balance() + print(balance) + + # create stop-order + symbol = 'ETH/USD:ETH-220930' + amount = 10 # in USD for inverse futures + price = 1200 + side = 'buy' + type = 'limit' + stop_order_params = { + 'position_idx': 0, # 0 One-Way Mode, 1 Buy-side, 2 Sell-side, default = 0 + 'stopPrice': 1000, # mandatory for stop orders + 'basePrice': 1100 # mandatory for stop orders + } + stop_order = await exchange.create_order(symbol, type, side, amount, price, stop_order_params) + print('Create order id:', stop_order['id']) + + # check opened stop-order + open_order_params = { + 'stop': True + } + openOrders = await exchange.fetch_open_orders(symbol, None, None, open_order_params) + print(openOrders) + + # cancell all open stop-orders + cancelOrder = await exchange.cancel_all_orders(symbol, open_order_params) + print(cancelOrder) +async def main(): + try: + await example_1() + await example_2() + await example_3() + await example_4() + except Exception as e: + print(e) + await exchange.close() + + + + +asyncio.run(main()) + + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/cli.md b/docs/ccxt/wiki/examples/py/cli.md new file mode 100644 index 0000000..093ed8c --- /dev/null +++ b/docs/ccxt/wiki/examples/py/cli.md @@ -0,0 +1,251 @@ +- [Cli](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import argparse +import os +import re +import sys +import json +import platform +from pprint import pprint +import asyncio +import ccxt.pro as ccxtpro +import ccxt.async_support as ccxt # noqa: E402 + +class Argv(object): + + table = False + verbose = False + sandbox = False + demo = False + testnet = False + test = False + nonce = None + exchange_id = '' + debug = False + cors = False + method = None + symbol = None + spot = False + swap = False + future = False + signIn = False + args = [] + no_keys = False + raw = False + no_load_markets = False + + +argv = Argv() + +parser = argparse.ArgumentParser() + +parser.add_argument('--table', action='store_true', help='output as table') +parser.add_argument('--cors', action='store_true', help='enable CORS proxy') +parser.add_argument('--verbose', action='store_true', help='enable verbose output') +parser.add_argument('--debug', action='store_true', help='enable debug output') +parser.add_argument('--sandbox', action='store_true', help='enable sandbox/testnet') +parser.add_argument('--demo', action='store_true', help='enable demo mode') +parser.add_argument('--testnet', action='store_true', help='enable sandbox/testnet') +parser.add_argument('--test', action='store_true', help='enable sandbox/testnet') +parser.add_argument('--spot', action='store_true', help='enable spot markets') +parser.add_argument('--swap', action='store_true', help='enable swap markets') +parser.add_argument('--future', action='store_true', help='enable future markets') +parser.add_argument('--option', action='store_true', help='enable option markets') +parser.add_argument('--signIn', action='store_true', help='sign in') +parser.add_argument('--no-keys', action='store_true', help='don t load keys') +parser.add_argument('--raw', action='store_true', help='raw output') +parser.add_argument('--no-load-markets', action='store_true', help='no load markets') +parser.add_argument('exchange_id', type=str, help='exchange id in lowercase', nargs='?') +parser.add_argument('method', type=str, help='method or property', nargs='?') +parser.add_argument('args', type=str, help='arguments', nargs='*') + +parser.parse_args(namespace=argv) + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +def print_supported_exchanges(): + print('Supported exchanges: ' + ', '.join(ccxt.exchanges) + '\n') + +def print_usage(): + print('\nThis is an example of a basic command-line interface to all exchanges\n') + print('Usage:\n') + print('python ' + sys.argv[0] + ' exchange_id method "param1" param2 "param3" param4 ...\n') + print('Examples:\n') + print('python ' + sys.argv[0] + ' okcoin fetch_ohlcv BTC/USD 15m') + print('python ' + sys.argv[0] + ' bitfinex fetch_balance') + print('python ' + sys.argv[0] + ' kraken fetch_order_book ETH/BTC\n') + print_supported_exchanges() + +async def main(): + if not argv.raw: + print('Python v' + platform.python_version()) + print('CCXT v' + ccxt.__version__) + + # prefer local testing keys to global keys + keys_global = root + '/keys.json' + keys_local = root + '/keys.local.json' + keys_file = keys_local if os.path.exists(keys_local) else keys_global + + # load the api keys and other settings from a JSON config + with open(keys_file, encoding="utf-8") as file: + keys = json.load(file) + + config = { + # 'verbose': argv.verbose, # set later, after load_markets + 'timeout': 30000, + } + + if not argv.exchange_id: + print_usage() + sys.exit() + + # # check here if we have a arg like this: binance.fetchOrders() + # call_reg = "\s*(\w+)\s*\.\s*(\w+)\s*\(([^()]*)\)" + # match = re.match(call_reg, argv.exchange_id) + # if match is not None: + # groups = match.groups() + # argv.exchange_id = groups[0] + # argv.method = groups[1] + # argv.args = list(map(lambda x: x.strip().replace("'", "\""), groups[2].split(','))) + + # ------------------------------------------------------------------------------ + + if argv.exchange_id not in ccxt.exchanges: + print_usage() + raise Exception('Exchange "' + argv.exchange_id + '" not found.') + + if argv.exchange_id in keys: + config.update(keys[argv.exchange_id]) + + exchange = None + if (argv.exchange_id in ccxtpro.exchanges): + exchange = getattr(ccxtpro, argv.exchange_id)(config) + else: + exchange = getattr(ccxt, argv.exchange_id)(config) + + if argv.spot: + exchange.options['defaultType'] = 'spot' + elif argv.swap: + exchange.options['defaultType'] = 'swap' + elif argv.future: + exchange.options['defaultType'] = 'future' + elif argv.option: + exchange.options['defaultType'] = 'option' + + if not argv.no_keys: + # check auth keys in env var + requiredCredentials = exchange.requiredCredentials + for credential, isRequired in requiredCredentials.items(): + if isRequired and credential and not getattr(exchange, credential, None): + credentialEnvName = (argv.exchange_id + '_' + credential).upper() # example: KRAKEN_APIKEY + if credentialEnvName in os.environ: + credentialValue = os.environ[credentialEnvName] + if credentialValue.startswith('-----BEGIN'): + credentialValue = credentialValue.replace('\\n', '\n') + + setattr(exchange, credential, credentialValue) + + if argv.cors: + exchange.proxy = 'https://cors-anywhere.herokuapp.com/' + exchange.origin = exchange.uuid() + + # pprint(dir(exchange)) + + # ------------------------------------------------------------------------------ + + args = [] + + for arg in argv.args: + + # unpack json objects (mostly for extra params) + if arg[0] == '{' or arg[0] == '[': + args.append(json.loads(arg)) + elif arg == 'None': + args.append(None) + elif re.match(r'^\'(.)+\'$', arg): + args.append(str(arg.replace('\'', ''))) + elif re.match(r'^"(.)+"$', arg): + args.append(str(arg.replace('"', ''))) + elif re.match(r'^[0-9+-]+$', arg): + args.append(int(arg)) + elif re.match(r'^[.eE0-9+-]+$', arg): + args.append(float(arg)) + elif re.match(r'^[0-9]{4}[-]?[0-9]{2}[-]?[0-9]{2}[T\s]?[0-9]{2}[:]?[0-9]{2}[:]?[0-9]{2}', arg): + args.append(exchange.parse8601(arg)) + else: + args.append(arg) + + if argv.testnet or argv.sandbox or argv.test: + exchange.set_sandbox_mode(True) + elif argv.demo: + exchange.enable_demo_trading(True) + + if argv.verbose and argv.debug: + exchange.verbose = argv.verbose + + if not argv.no_load_markets: + markets_path = '.cache/' + exchange.id + '-markets.json' + if os.path.exists(markets_path): + with open(markets_path, 'r') as f: + exchange.markets = json.load(f) + else: + await exchange.load_markets() + + exchange.verbose = argv.verbose # now set verbose mode + + if argv.signIn: + await exchange.sign_in() + + is_ws_method = False + + if argv.method: + method = getattr(exchange, argv.method) + # if it is a method, call it + if callable(method): + if argv.method.startswith('watch'): + is_ws_method = True # handle ws methods + if not argv.raw: + print(f"{argv.exchange_id}.{argv.method}({','.join(map(str, args))})") + + while True: + result = method(*args) + if asyncio.iscoroutine(result): + result = await result + if argv.table: + result = list(result.values()) if isinstance(result, dict) else result + print(table([exchange.omit(v, 'info') for v in result])) + elif argv.raw: + print(exchange.json(result)) + else: + pprint(result) + if not is_ws_method: + await exchange.close() + return + else: # otherwise it's a property, print it + result = method + if argv.table: + result = list(result.values()) if isinstance(result, dict) else result + print(table([exchange.omit(v, 'info') for v in result])) + elif argv.raw: + print(exchange.json(result)) + else: + pprint(result) + await exchange.close() + else: + pprint(dir(exchange)) + + +if __name__ == '__main__': + asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinbase-cancel-order.md b/docs/ccxt/wiki/examples/py/coinbase-cancel-order.md new file mode 100644 index 0000000..7a850cb --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinbase-cancel-order.md @@ -0,0 +1,31 @@ +- [Coinbase Cancel Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.coinbase({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + # 'verbose': True, # for debug output +}) + +order_id = '04204eaf-94d6-444a-b9b7-2f8a485311f6' +# order_ids = ['04204eaf-94d6-444a-b9b7-2f8a485311f6', '7c13a059-d235-46e1-ab43-6794a5836db9'] + +try: + cancel_order = exchange.cancel_order(order_id) + # cancel_orders = exchange.cancel_orders(order_ids) + pprint(cancel_order) + # pprint(cancel_orders) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinbase-create-order.md b/docs/ccxt/wiki/examples/py/coinbase-create-order.md new file mode 100644 index 0000000..f7bba9a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinbase-create-order.md @@ -0,0 +1,37 @@ +- [Coinbase Create Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.coinbase({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + # 'verbose': True, # for debug output +}) + +symbol = 'BTC/USDT' +order_type = 'limit' +side = 'buy' +amount = 0.0003 +order_price = 13500 +stop_params = { + 'triggerPrice': 15000 +} + +try: + limit_order = exchange.create_order(symbol, order_type, side, amount, order_price) + # stop_order = exchange.create_order(symbol, order_type, side, amount, order_price, stop_params) + pprint(limit_order) + # pprint(stop_order) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinbase-fetch-OHLCV.md b/docs/ccxt/wiki/examples/py/coinbase-fetch-OHLCV.md new file mode 100644 index 0000000..17d8c8a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinbase-fetch-OHLCV.md @@ -0,0 +1,32 @@ +- [Coinbase Fetch Ohlcv](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.coinbase({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + # 'verbose': True, # for debug output +}) + +symbol = 'BTC/USDT' +timeframe = '1m' +since = None +limit = None # not used by coinbase + +try: + # Max 300 Candles + candles = exchange.fetch_ohlcv(symbol, timeframe, since, limit) + pprint(candles) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinbase-fetch-order.md b/docs/ccxt/wiki/examples/py/coinbase-fetch-order.md new file mode 100644 index 0000000..c4901f5 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinbase-fetch-order.md @@ -0,0 +1,35 @@ +- [Coinbase Fetch Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.coinbase({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + # 'verbose': True, # for debug output +}) + +order_id = '04204eaf-94d6-444a-b9b7-2f8a485311f6' +symbol = 'BTC/USDT' +since = None +limit = 3 + +try: + fetch_order = exchange.fetch_order(order_id, symbol) + # fetch_orders = exchange.fetch_orders(symbol, since, limit) + # fetch_open_orders = exchange.fetch_open_orders(symbol, since, limit) + pprint(fetch_order) + # pprint(fetch_orders) + # pprint(fetch_open_orders) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinbase-fetch-ticker.md b/docs/ccxt/wiki/examples/py/coinbase-fetch-ticker.md new file mode 100644 index 0000000..5142798 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinbase-fetch-ticker.md @@ -0,0 +1,33 @@ +- [Coinbase Fetch Ticker](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.coinbase({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + # some markets are not supported with v2 like BTC/USDT + 'options': {'fetchTicker': 'fetchTickerV3', 'fetchTickers': 'fetchTickersV3'} # for selecting previous versions + # 'verbose': True, # for debug output +}) + +symbols = ['BTC/USDT', 'ETH/USDT'] +symbol = 'BTC/USDT' + +try: + tickers = exchange.fetch_tickers(symbols) + ticker = exchange.fetch_ticker(symbol) + pprint(tickers) + pprint(ticker) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinbase-fetch-trades.md b/docs/ccxt/wiki/examples/py/coinbase-fetch-trades.md new file mode 100644 index 0000000..5a44681 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinbase-fetch-trades.md @@ -0,0 +1,32 @@ +- [Coinbase Fetch Trades](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.coinbase({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + # 'verbose': True, # for debug output +}) + +symbol = 'BTC/USDT' +since = None # not used by coinbase +limit = 3 + +try: + trades = exchange.fetch_trades(symbol, since, limit) + my_trades = exchange.fetch_my_trades(symbol, since, limit) + pprint(trades) + pprint(my_trades) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinbasepro-fetch-my-trades-pagination.md b/docs/ccxt/wiki/examples/py/coinbasepro-fetch-my-trades-pagination.md new file mode 100644 index 0000000..3d11de4 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinbasepro-fetch-my-trades-pagination.md @@ -0,0 +1,46 @@ +- [Coinbasepro Fetch My Trades Pagination](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + +import ccxt # noqa: E402 + +''' +Example snippet to traverse CoinBase Pro pagination. +Useful for reaching back more than 100 myTrades, the same works +for fetchClosedOrders +''' + +exchange = ccxt.coinbasepro({ + "apiKey": "123456", + "secret": "/abcdefghijklmnop/w==", + "password": "987654321", + "enableRateLimit": True +}) + +param_key = '' +param_value = '' +allMyTrades = [] + +while True: + myTrades = exchange.fetch_my_trades(symbol='BTC/USD', params={param_key: param_value}) + + # Handle with pagination ... + if exchange.last_response_headers._store.get('cb-after'): + param_key = 'after' + param_value = exchange.last_response_headers._store['cb-after'][1] + + allMyTrades.extend(myTrades) + + else: + allMyTrades.extend(myTrades) + break + +for trade in allMyTrades: + print(trade) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinex-futures.md b/docs/ccxt/wiki/examples/py/coinex-futures.md new file mode 100644 index 0000000..a18e631 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinex-futures.md @@ -0,0 +1,87 @@ +- [Coinex Futures](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.coinex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +# Example 1 :: Swap : fetch balance, create a limit swap order with leverage +async def example_1(): + exchange.options['defaultType'] = 'swap' + exchange.options['defaultMarginMode'] = 'cross' # or isolated + markets = await exchange.load_markets() + + # fetch swap balance + balance = await exchange.fetch_balance() + print(balance) + + # set the desired leverage (has to be made before placing the order and for a specific symbol) + leverage = 8 + symbol = 'ADA/USDT:USDT' + leverage_response = await exchange.set_leverage(leverage, symbol) + + # create limit order + symbol = 'ADA/USDT:USDT' + type = 'limit' + side = 'buy' + amount = 50 + price = 0.3 + create_order = await exchange.create_order(symbol, type, side, amount, price) + print('Create order id:', create_order['id']) +# Example 2 :: Swap :: open a position and close it +async def example_2(): + exchange.options['defaultType'] = 'swap'; # very important set swap as default type + exchange.options['defaultMarginMode'] = 'cross' # or isolated + markets = await exchange.load_markets() + + + # set the desired leverage (has to be made before placing the order and for a specific symbol) + leverage = 3 + symbol = 'ADA/USDT:USDT' + leverage_response = await exchange.set_leverage(leverage, symbol) + + # create market order and open position + symbol = 'ADA/USDT:USDT' + type = 'market' + side = 'buy' + amount = 55 + price = None + create_order = await exchange.create_order(symbol, type, side, amount, price) + print('Create order id:', create_order['id']) + + # check opened position + position = await exchange.fetch_position(symbol) + print(position) + + # Close position by issuing a market order in the opposite direction + side = 'sell' + params = { + 'reduce_only': True + } + close_position_order = await exchange.createOrder(symbol, type, side, amount, price, params) + print(close_position_order) +async def main(): + await example_1() + await example_2() + +asyncio.run(main()) + + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinone-fetch-tickers.md b/docs/ccxt/wiki/examples/py/coinone-fetch-tickers.md new file mode 100644 index 0000000..c5a9ca0 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinone-fetch-tickers.md @@ -0,0 +1,31 @@ +- [Coinone Fetch Tickers](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +exchange = ccxt.coinone({ + # 'verbose': True, # uncomment for verbose output +}) + +# fetch all +tickers = exchange.fetch_tickers() +for symbol, ticker in tickers.items(): + print(ticker) + +print("\n") + +# fetch one by one +markets = exchange.load_markets() +for symbol in markets.keys(): + ticker = exchange.fetch_ticker(symbol) + print(ticker) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/coinone-markets.md b/docs/ccxt/wiki/examples/py/coinone-markets.md new file mode 100644 index 0000000..7f6325b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/coinone-markets.md @@ -0,0 +1,22 @@ +- [Coinone Markets](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +exchange = ccxt.coinone({ + # 'verbose': True, # uncomment for verbose output +}) + +markets = exchange.load_markets() +pprint(markets) +print('\n', exchange.name, 'supports', len(markets), 'pairs') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/compare-two-exchanges-capabilities.md b/docs/ccxt/wiki/examples/py/compare-two-exchanges-capabilities.md new file mode 100644 index 0000000..98ab3eb --- /dev/null +++ b/docs/ccxt/wiki/examples/py/compare-two-exchanges-capabilities.md @@ -0,0 +1,43 @@ +- [Compare Two Exchanges Capabilities](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +async def example(): + prefix = '-' + exchange_1 = ccxt.okx() + exchange_2 = ccxt.htx() + keys_1 = list(exchange_1.has.keys()) + keys_2 = list(exchange_2.has.keys()) + # check missing from exchange-1 + print('### checking missing functionalities from exchange-1:', exchange_1.id) + for i in range(0, len(keys_2)): + key = keys_2[i] + if exchange_2.has[key]: + if not key in keys_1: + print(prefix, key, 'does not exist in', exchange_1.id, 'as opposed to', exchange_2.id) + elif exchange_2.has[key] != exchange_1.has[key]: + print(prefix, key, '> ', exchange_1.id, ':', exchange_1.has[key], ',', exchange_2.id, ':', exchange_2.has[key]) + # check missing from exchange-2 + print('### checking missing functionalities from exchange-2:', exchange_2.id) + for i in range(0, len(keys_1)): + key = keys_1[i] + if exchange_1.has[key]: + if not key in keys_2: + print(prefix, key, 'does not exist in', exchange_2.id, 'as opposed to', exchange_1.id) + elif exchange_1.has[key] != exchange_2.has[key]: + print(prefix, key, '> ', exchange_2.id, ':', exchange_2.has[key], ',', exchange_1.id, ':', exchange_1.has[key]) + + await exchange_1.close() + await exchange_2.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/py/create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..df95ab5 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,73 @@ +- [Create Order Position With Takeprofit Stoploss](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +print('CCXT Version:', ccxt.version) + +async def example(): + # at this moment, only OKX support embedded stop-loss & take-profit orders in unified manner. other exchanges are being added actively and will be available soon. + exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + }) + symbol = 'DOGE/USDT:USDT' + side = 'buy' # 'buy' | 'sell' + order_type = 'limit' # 'market' | 'limit' + amount = 1 # how many contracts (see `market(symbol).contractSize` to find out coin portion per one contract) + await exchange.load_markets() + market = exchange.market(symbol) + ticker = await exchange.fetch_ticker(symbol) + last_price = ticker['last'] + ask_price = ticker['ask'] + bid_price = ticker['bid'] + # if order_type is 'market', then price is not needed + price = None + # if order_type is 'limit', then set a price at your desired level + if order_type == 'limit': + price = bid_price * 0.95 if (side == 'buy') else ask_price * 1.05 # i.e. 5% from current price + # set trigger price for stop-loss/take-profit to 2% from current price + # (note, across different exchanges "trigger" price can be also mentioned with different synonyms, like "activation price", "stop price", "conditional price", etc. ) + stop_loss_trigger_price = (last_price if order_type == 'market' else price) * (0.98 if side == 'buy' else 1.02) + take_profit_trigger_price = (last_price if order_type == 'market' else price) * (1.02 if side == 'buy' else 0.98) + # when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + params = { + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + 'price': stop_loss_trigger_price * 0.98, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + 'price': take_profit_trigger_price * 0.98, + }, + } + position_amount = market['contractSize'] * amount + position_value = position_amount * last_price + # log + print('Going to open a position', 'for', amount, 'contracts worth', position_amount, market['base'], '~', position_value, market['settle'], 'using', side, order_type, 'order (', (exchange.price_to_precision(symbol, price) if order_type == 'limit' else ''), '), using the following params:') + print(params) + print('-----------------------------------------------------------------------') + try: + created_order = await exchange.create_order(symbol, order_type, side, amount, price, params) + print('Created an order', created_order) + # Fetch all your open orders for this symbol + # - use 'fetchOpenOrders' or 'fetchOrders' and filter with 'open' status + # - note, that some exchanges might return one order object with embedded stoploss/takeprofit fields, while other exchanges might have separate stoploss/takeprofit order objects + all_open_orders = await exchange.fetch_open_orders(symbol) + print('Fetched all your orders for this symbol', all_open_orders) + except Exception as e: + print(str(e)) + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/create-order-ws-example.md b/docs/ccxt/wiki/examples/py/create-order-ws-example.md new file mode 100644 index 0000000..df5f8c7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/create-order-ws-example.md @@ -0,0 +1,41 @@ +- [Create Order Ws Example](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code +import asyncio +import ccxt.pro as ccxt # noqa: E402 + + +# AUTO-TRANSPILE # +async def example(): + exchange = ccxt.binance({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }) + exchange.set_sandbox_mode(True) + exchange.verbose = True # uncomment for debugging purposes if necessary + # load markets + await exchange.load_markets() + symbol = 'ETH/USDT' + type = 'limit' + side = 'buy' + amount = 0.01 + price = 1000 + orders = [] + for i in range(1, 5): + response = await exchange.create_order_ws(symbol, type, side, amount, price) + price += i + orders.append(response) + print(orders) + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/create-orders-example.md b/docs/ccxt/wiki/examples/py/create-orders-example.md new file mode 100644 index 0000000..848b731 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/create-orders-example.md @@ -0,0 +1,39 @@ +- [Create Orders Example](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +async def example(): + exchange = ccxt.binance({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }) + exchange.set_sandbox_mode(True) + await exchange.load_markets() + exchange.verbose = True # uncomment for debugging purposes if necessary + orders = await exchange.create_orders([{ + 'symbol': 'LTC/USDT:USDT', + 'type': 'limit', + 'side': 'buy', + 'amount': 10, + 'price': 55, +}, { + 'symbol': 'ETH/USDT:USDT', + 'type': 'market', + 'side': 'buy', + 'amount': 0.5, +}]) + print(orders) + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/create-trailing-amount-order.md b/docs/ccxt/wiki/examples/py/create-trailing-amount-order.md new file mode 100644 index 0000000..605e5f0 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/create-trailing-amount-order.md @@ -0,0 +1,47 @@ +- [Create Trailing Amount Order](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +async def example(): + exchange = ccxt.bingx({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }) + # exchange.setSandboxMode (true); + # exchange.verbose = true; # uncomment for debugging purposes if necessary + await exchange.load_markets() + symbol = 'BTC/USDT:USDT' + order_type = 'market' + side = 'sell' + amount = 0.0001 + price = None + reduce_only = True + trailing_amount = 100 + # const trailingTriggerPrice = undefined; # not supported on all exchanges + params = { + 'reduceOnly': reduce_only, + 'trailingAmount': trailing_amount, + } + try: + create_order = await exchange.create_order(symbol, order_type, side, amount, price, params) + # Alternatively use the createTrailingAmountOrder method: + # const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { + # 'reduceOnly': reduceOnly, + # }); + print(create_order) + except Exception as e: + print(str(e)) + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/create-trailing-percent-order.md b/docs/ccxt/wiki/examples/py/create-trailing-percent-order.md new file mode 100644 index 0000000..08f22c2 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/create-trailing-percent-order.md @@ -0,0 +1,47 @@ +- [Create Trailing Percent Order](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +async def example(): + exchange = ccxt.bingx({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }) + # exchange.setSandboxMode (true); + # exchange.verbose = true; # uncomment for debugging purposes if necessary + await exchange.load_markets() + symbol = 'BTC/USDT:USDT' + order_type = 'market' + side = 'sell' + amount = 0.0001 + price = None + reduce_only = True + trailing_percent = 10 + # const trailingTriggerPrice = undefined; # not supported on all exchanges + params = { + 'reduceOnly': reduce_only, + 'trailingPercent': trailing_percent, + } + try: + create_order = await exchange.create_order(symbol, order_type, side, amount, price, params) + # Alternatively use the createTrailingAmountOrder method: + # const create_order = await exchange.createTrailingPercentOrder (symbol, order_type, side, amount, price, trailingPercent, trailingTriggerPrice, { + # 'reduceOnly': reduceOnly, + # }); + print(create_order) + except Exception as e: + print(str(e)) + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/exchange-save-load-markets-cache.md b/docs/ccxt/wiki/examples/py/exchange-save-load-markets-cache.md new file mode 100644 index 0000000..4e22cb7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/exchange-save-load-markets-cache.md @@ -0,0 +1,81 @@ +- [Exchange Save Load Markets Cache](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt.pro as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.bybit({ + # 'apiKey': 'YOUR_API_KEY', + # 'secret': 'YOUR_SECRET_KEY', +}) + +cache = {} # in this example we will save markets cache in this variable, but it can be saved in a file or database + +# We should use this strategy, when we need to recreate the exchange instance +# multiple times, but we don't want to reload the cache every time +# to avoid the extra time and resources needed to load the markets cache + + +async def save_markets_cache(): + global cache + before = exchange.milliseconds() + + markets = await exchange.load_markets() + + after = exchange.milliseconds() + + print("Time to load markets:", after - before, "ms") + + currencies = exchange.currencies + + cache['markets'] = markets + cache['currencies'] = currencies + + +async def instantiate_with_cache(): + global cache + + new_instance = ccxt.bybit({ + 'markets': cache['markets'], + 'currencies': cache['currencies'] + }) + + before = exchange.milliseconds() + + await new_instance.load_markets() + + after = exchange.milliseconds() + + print ("Time to load markets with cache:", after - before, "ms") # as you can see, it is instanteous + +async def main(): + try: + await save_markets_cache() + + await instantiate_with_cache() + + except Exception as e: + print(e) + await exchange.close() + + +asyncio.run(main()) + + +# it should output something like this +# CCXT Version: 4.4.38 +# Time to load markets: 1582 ms +# Time to load markets with cache: 0 ms +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/exchanges-by-country.md b/docs/ccxt/wiki/examples/py/exchanges-by-country.md new file mode 100644 index 0000000..ad3ca0a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/exchanges-by-country.md @@ -0,0 +1,28 @@ +- [Exchanges By Country](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +country = 'US' +exchanges = [] +for exchange_id in ccxt.exchanges: + try: + exchange = getattr(ccxt, exchange_id)() + if country in exchange.countries: + print(country, exchange_id, exchange.countries) + exchanges.append(exchange) + except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/exchanges.md b/docs/ccxt/wiki/examples/py/exchanges.md new file mode 100644 index 0000000..8d4abb7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/exchanges.md @@ -0,0 +1,65 @@ +- [Exchanges](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + +import ccxt # noqa: E402 + + +def style(s, style): + return style + s + '\033[0m' + + +def green(s): + return style(s, '\033[92m') + + +def blue(s): + return style(s, '\033[94m') + + +def yellow(s): + return style(s, '\033[93m') + + +def red(s): + return style(s, '\033[91m') + + +def pink(s): + return style(s, '\033[95m') + + +def bold(s): + return style(s, '\033[1m') + + +def underline(s): + return style(s, '\033[4m') + + +def log(*args): + print(' '.join([str(arg) for arg in args])) + + +exchanges = {} + +for id in ccxt.exchanges: + exchange = getattr(ccxt, id) + exchanges[id] = exchange() + +log('The ccxt library supports', green(str(len(ccxt.exchanges))), 'exchanges:') + +# output a table of all exchanges +log(pink('{:<15} {:<15} {:<15}'.format('id', 'name', 'URL'))) +tuples = list(ccxt.Exchange.keysort(exchanges).items()) +for (id, params) in tuples: + exchange = exchanges[id] + website = exchange.urls['www'][0] if type(exchange.urls['www']) is list else exchange.urls['www'] + log('{:<15} {:<15} {:<15}'.format(exchange.id, exchange.name, website)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-all-okex-ohclv.md b/docs/ccxt/wiki/examples/py/fetch-all-okex-ohclv.md new file mode 100644 index 0000000..ffe27cb --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-all-okex-ohclv.md @@ -0,0 +1,83 @@ +- [Fetch All Okex Ohclv](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 +from ccxt.base.exchange import Exchange # noqa: E402 + + +# An example of OOP / class inheritance in Python + +class ohlcv(Exchange): + def fetch_all_ohlcvs(self, symbol, timeframe, max_retries=3): + print('Loading', self.id, 'markets...') + self.load_markets() + print('Loaded', self.id, 'markets.') + limit = 100 + earliest_timestamp = self.milliseconds() + timeframe_duration_in_seconds = self.parse_timeframe(timeframe) + timeframe_duration_in_ms = timeframe_duration_in_seconds * 1000 + timedelta = limit * timeframe_duration_in_ms + ohlcv_dictionary = {} + ohlcv_list = [] + i = 0 + done = False + while True: + # this printout is here for explanation purposes + print('===========================================================') + print('Iteration', i) + fetch_since = earliest_timestamp - timedelta + print('Fetching', self.id, symbol, timeframe, 'candles from', self.iso8601(fetch_since), 'to', self.iso8601(earliest_timestamp)) + num_retries = 0 + try: + num_retries += 1 + ohlcv = self.fetch_ohlcv(symbol, timeframe, fetch_since, limit) + if (len(ohlcv)): + earliest_timestamp = ohlcv[0][0] - timeframe_duration_in_ms + print('Fetched', len(ohlcv), self.id, symbol, timeframe, 'candles from', self.iso8601(ohlcv[0][0]), 'to', self.iso8601(ohlcv[-1][0])) + else: + print('Fetched', len(ohlcv), self.id, symbol, timeframe, 'candles') + done = True + except Exception: + if num_retries > max_retries: + raise + else: + continue + i += 1 + ohlcv_dictionary = self.extend(ohlcv_dictionary, self.indexBy(ohlcv, 0)) + ohlcv_list = self.sort_by(ohlcv_dictionary.values(), 0) + if len(ohlcv_list): + print('Stored', len(ohlcv_list), self.id, symbol, timeframe, 'candles from', self.iso8601(ohlcv_list[0][0]), 'to', self.iso8601(ohlcv_list[-1][0])) + if done: + break + return ohlcv_list + + +# Another example of OOP / class inheritance. +# This time my_okex class is inherited from two other classes +# both ohlcv and ccxt.okex, and has the methods from both classes. +# This is just an example, it is not necessary do it this way. +# You can combine classes and methods using Python's OOP how you like. + +class my_okex(ohlcv, ccxt.okex): + pass + + +# instantiate your class and call the inherited method + +exchange = my_okex({ + # 'hostname': 'okex.me', # if you're in mainland China +}) + +symbol = 'BTC/USDT' +timeframe = '1m' +ohlcvs = exchange.fetch_all_ohlcvs(symbol, timeframe) +print('Done.') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-all-tickers.md b/docs/ccxt/wiki/examples/py/fetch-all-tickers.md new file mode 100644 index 0000000..935f08a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-all-tickers.md @@ -0,0 +1,76 @@ +- [Fetch All Tickers](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time + +import ccxt # noqa: E402 + + +def print_exchanges(): + print('Supported exchanges:', ', '.join(ccxt.exchanges)) + + +def print_usage(): + print("Usage: python", sys.argv[0], 'id') + print("python", sys.argv[0], 'kraken') + print("python", sys.argv[0], 'coinbasepro') + print_exchanges() + + +try: + + id = sys.argv[1] # get exchange id from command line arguments + + # check if the exchange is supported by ccxt + exchange_found = id in ccxt.exchanges + + if exchange_found: + + print('Instantiating', id) + + # instantiate the exchange by id + exchange = getattr(ccxt, id)() + + if exchange.has['fetchTickers'] != True: + raise ccxt.NotSupported ('Exchange ' + exchange.id + ' does not have the endpoint to fetch all tickers from the API.') + + # load all markets from the exchange + markets = exchange.load_markets() + + try: + + tickers = exchange.fetch_tickers() + for symbol, ticker in tickers.items(): + print( + symbol, + ticker['datetime'], + 'high: ' + str(ticker['high']), + 'low: ' + str(ticker['low']), + 'bid: ' + str(ticker['bid']), + 'ask: ' + str(ticker['ask']), + 'volume: ' + str(ticker['quoteVolume'] or ticker['baseVolume']) + ) + + except ccxt.DDoSProtection as e: + print(type(e).__name__, e.args, 'DDoS Protection (ignoring)') + except ccxt.RequestTimeout as e: + print(type(e).__name__, e.args, 'Request Timeout (ignoring)') + except ccxt.ExchangeNotAvailable as e: + print(type(e).__name__, e.args, 'Exchange Not Available due to downtime or maintenance (ignoring)') + except ccxt.AuthenticationError as e: + print(type(e).__name__, e.args, 'Authentication Error (missing API keys, ignoring)') + else: + print('Exchange', id, 'not found') + print_usage() + +except Exception as e: + + print(type(e).__name__, e.args, str(e)) + print_usage() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-balance-asset-valuation.md b/docs/ccxt/wiki/examples/py/fetch-balance-asset-valuation.md new file mode 100644 index 0000000..cf74485 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-balance-asset-valuation.md @@ -0,0 +1,39 @@ +- [Fetch Balance Asset Valuation](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + + +markets = exchange.load_markets() +# exchange.verbose = True # uncomment for debugging purposes if necessary +balance = exchange.fetch_balance() +tickers = exchange.fetch_tickers() +destination_code = 'USDT' +total_destination_value = 0 +for code, amount in balance['total'].items(): + symbol = code + '/' + destination_code + ticker = tickers.get(symbol, None) + if ticker is not None: + valuation = amount * ticker['last'] + total_destination_value += valuation + print(amount, code, '=', valuation, destination_code) + + +print('Total', total_destination_value, destination_code) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-bitfinex-ohlcv-history.md b/docs/ccxt/wiki/examples/py/fetch-bitfinex-ohlcv-history.md new file mode 100644 index 0000000..ab00d2a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-bitfinex-ohlcv-history.md @@ -0,0 +1,43 @@ +- [Fetch Bitfinex Ohlcv History](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time +import ccxt # noqa: E402 +# common constants + +msec = 1000 +minute = 60 * msec +hold = 30 +exchange = ccxt.bitfinex() +from_datetime = '2017-01-01 00:00:00' +from_timestamp = exchange.parse8601(from_datetime) +now = exchange.milliseconds() +data = [] + +while from_timestamp < now: + + try: + + print(exchange.milliseconds(), 'Fetching candles starting from', exchange.iso8601(from_timestamp)) + ohlcvs = exchange.fetch_ohlcv('BTC/USD', '5m', from_timestamp) + print(exchange.milliseconds(), 'Fetched', len(ohlcvs), 'candles') + if len(ohlcvs) > 0: + first = ohlcvs[0][0] + last = ohlcvs[-1][0] + print('First candle epoch', first, exchange.iso8601(first)) + print('Last candle epoch', last, exchange.iso8601(last)) + # from_timestamp += len(ohlcvs) * minute * 5 # very bad + from_timestamp = ohlcvs[-1][0] + minute * 5 # good + data += ohlcvs + + except (ccxt.ExchangeError, ccxt.AuthenticationError, ccxt.ExchangeNotAvailable, ccxt.RequestTimeout) as error: + + print('Got an error', type(error).__name__, error.args, ', retrying in', hold, 'seconds...') + time.sleep(hold) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-coinbasepro-ohlcv-sequentially.md b/docs/ccxt/wiki/examples/py/fetch-coinbasepro-ohlcv-sequentially.md new file mode 100644 index 0000000..d6773a8 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-coinbasepro-ohlcv-sequentially.md @@ -0,0 +1,39 @@ +- [Fetch Coinbasepro Ohlcv Sequentially](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time + + +import ccxt # noqa: E402 +# common constants + +msec = 1000 +minute = 60 * msec +hold = 30 +exchange = ccxt.coinbasepro() +from_datetime = '2017-09-01 00:00:00' +from_timestamp = exchange.parse8601(from_datetime) +now = exchange.milliseconds() +data = [] + +while from_timestamp < now: + + try: + + print(exchange.milliseconds(), 'Fetching candles starting from', exchange.iso8601(from_timestamp)) + ohlcvs = exchange.fetch_ohlcv('BTC/USD', '1m', from_timestamp) + print(exchange.milliseconds(), 'Fetched', len(ohlcvs), 'candles') + from_timestamp = ohlcvs[-1][0] + data += ohlcvs + + except (ccxt.ExchangeError, ccxt.AuthenticationError, ccxt.ExchangeNotAvailable, ccxt.RequestTimeout) as error: + + print('Got an error', type(error).__name__, error.args, ', retrying in', hold, 'seconds...') + time.sleep(hold) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-create-deposit-address.md b/docs/ccxt/wiki/examples/py/fetch-create-deposit-address.md new file mode 100644 index 0000000..301cae9 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-create-deposit-address.md @@ -0,0 +1,83 @@ +- [Fetch Create Deposit Address](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +# setup + +currency_code = 'DASH' # change me +exchange_id = 'poloniex' # change me + +exchange = getattr(ccxt, exchange_id)({ + + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + + # 'verbose': True, // ←- uncomment this for verbose output + + # additional credentials might be required in exchange-specific cases: + # uid or password for coinbasepro, etc... +}) +if not exchange.has['fetchDepositAddress']: + print('The exchange does not support fetchDepositAddress() yet') + sys.exit() +try: + + print('Trying to fetch deposit address for ' + currency_code + ' from ' + exchange_id + '...') + + fetch_result = exchange.fetch_deposit_address(currency_code) + + print('Successfully fetched deposit address for ' + currency_code) + pprint(fetch_result) + +except ccxt.InvalidAddress as e: + + # never skip proper error handling, whatever it is you're building + # actually, with crypto error handling should be the largest part of your code + + print('The address for ' + currency_code + ' does not exist yet') + + if exchange.has['createDepositAddress']: + + print('Attempting to create a deposit address for ' + currency_code + '...') + + try: + + create_result = exchange.create_deposit_address(currency_code) + + # pprint(create_result) # for debugging + + print('Successfully created a deposit address for ' + currency_code + ', fetching the deposit address now...') + + try: + + fetch_result = exchange.fetch_deposit_address(currency_code) + + print('Successfully fetched deposit address for ' + currency_code) + pprint(fetch_result) + + except Exception as e: + + print('Failed to fetch deposit address for ' + currency_code, type(e).__name__, str(e)) + + except Exception as e: + + print('Failed to create deposit address for ' + currency_code, type(e).__name__, str(e)) + + else: + + print('The exchange does not support createDepositAddress()') + +except Exception as e: + + print('There was an error while fetching deposit address for ' + currency_code, type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-first-ohlcv-timestamp.md b/docs/ccxt/wiki/examples/py/fetch-first-ohlcv-timestamp.md new file mode 100644 index 0000000..1070c36 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-first-ohlcv-timestamp.md @@ -0,0 +1,83 @@ +- [Fetch First Ohlcv Timestamp](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +# ###### Description ###### +# +# This function tries to fetch the "listing time" of a symbol by fetching the earliest available bar in daily resolution. +# Top-tier exchanges also support fetching smaller timeframes (eg. 1 minute) even several years back, so for those exchanges you can also use `useMinuteTimeframe = true` argument to get the timestamp rounded to the earliest minute bar (instead of daily bar timestamp). +# See usage in the end of this file +async def fetch_first_bar_timestamp(exchange, symbol, use_minute_timeframe=False): + # set some constants + milliseconds_per_day = 86400000 + minutes_per_day = 1440 + minimum_timestamp = 1230768000000 # 2009-01-01 (bitcoin created year) + # get market features + market = exchange.market(symbol) + market_type = exchange.safe_string(market, 'type') + features = exchange.safe_dict(exchange.features, market_type, {}) + if market['subType'] is not None: + features = exchange.safe_dict(features, market['subType'], {}) + ohlcv = exchange.safe_dict(features, 'fetchOHLCV') + if ohlcv is None: + return None + limit = exchange.safe_integer(ohlcv, 'limit') + fetch_params = { + 'maxRetriesOnFailure': 3, + } + # start loop + current_since = exchange.milliseconds() - milliseconds_per_day * (limit - 1) + found_start_time = 0 + # eslint-disable-next-line + while True: + current_since = max(current_since, minimum_timestamp) + daily_bars = await exchange.fetch_ohlcv(symbol, '1d', current_since, limit, fetch_params) + if len(daily_bars) <= 0: + break # if no days returned, then probably start date was passed + first_ts = daily_bars[0][0] + if first_ts == found_start_time: + # if the first timestamp is equal to the last-fetched timestamp, then break here, because some exchanges still return initial bar even if since is much ahead to listing time + break + found_start_time = first_ts + current_since = found_start_time - milliseconds_per_day * (limit - 1) # shift 'since' one step back + if len(daily_bars) == 1: + # in some cases, some exchanges might still return first bar of chart when endtime overlaps previous day + break + # if minute resolution needed + if use_minute_timeframe: + max_iteration = int(math.ceil(minutes_per_day / limit)) * 2 + all_promises = [] + for i in range(0, max_iteration): + current_since = found_start_time - milliseconds_per_day + i * limit * 60 * 1000 # shift one-duration back for more accuracy for different kind of exchanges, like OKX, where first daily bar is offset by one day, but minute bars present + all_promises.append(exchange.fetch_ohlcv(symbol, '1m', current_since, limit, fetch_params)) + all_responses = await asyncio.gather(*all_promises) + # find earliest bar + for i in range(0, len(all_responses)): + response = all_responses[i] + if len(response) > 0: + found_start_time = response[0][0] + break + return found_start_time + + +# ###### Usage ###### +run_example = False # set to true to run example + + +if run_example: + my_ex = ccxt.binance() + await my_ex.load_markets() + symbol = 'TRUMP/USDT' + earliest_timestamp = +asyncio.run(fetch_first_bar_timestamp(my_ex, symbol, True)) + print('- Earliest bar timestamp:', earliest_timestamp, ', readable: ', my_ex.iso8601(earliest_timestamp)) + print('- market.created value:', my_ex.market(symbol)['created']) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-gdax-ohlcv-sequentially.md b/docs/ccxt/wiki/examples/py/fetch-gdax-ohlcv-sequentially.md new file mode 100644 index 0000000..90d875d --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-gdax-ohlcv-sequentially.md @@ -0,0 +1,39 @@ +- [Fetch Gdax Ohlcv Sequentially](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time + + +import ccxt # noqa: E402 +# common constants + +msec = 1000 +minute = 60 * msec +hold = 30 +exchange = ccxt.gdax() +from_datetime = '2017-09-01 00:00:00' +from_timestamp = exchange.parse8601(from_datetime) +now = exchange.milliseconds() +data = [] + +while from_timestamp < now: + + try: + + print(exchange.milliseconds(), 'Fetching candles starting from', exchange.iso8601(from_timestamp)) + ohlcvs = exchange.fetch_ohlcv('BTC/USD', '1m', from_timestamp) + print(exchange.milliseconds(), 'Fetched', len(ohlcvs), 'candles') + from_timestamp = ohlcvs[-1][0] + data += ohlcvs + + except (ccxt.ExchangeError, ccxt.AuthenticationError, ccxt.ExchangeNotAvailable, ccxt.RequestTimeout) as error: + + print('Got an error', type(error).__name__, error.args, ', retrying in', hold, 'seconds...') + time.sleep(hold) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ohlcv-cex.md b/docs/ccxt/wiki/examples/py/fetch-ohlcv-cex.md new file mode 100644 index 0000000..56af3a9 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ohlcv-cex.md @@ -0,0 +1,42 @@ +- [Fetch Ohlcv Cex](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import asciichart + +import ccxt # noqa: E402 +exchange = ccxt.cex() +symbol = 'BTC/USD' + +# each ohlcv candle is a list of [ timestamp, open, high, low, close, volume ] +index = 4 # use close price from each ohlcv candle + +length = 80 +height = 15 + + +def print_chart(exchange, symbol, timeframe): + + print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:') + + # get a list of ohlcv candles + ohlcv = exchange.fetch_ohlcv(symbol, timeframe) + + # get the ohlCv (closing price, index == 4) + series = [x[index] for x in ohlcv] + + # print the chart + print("\n" + asciichart.plot(series[-length:], {'height': height})) # print the chart + + last = ohlcv[len(ohlcv) - 1][index] # last closing price + return last + + +last = print_chart(exchange, symbol, '1m') +print("\n" + exchange.name + " ₿ = $" + str(last) + "\n") # print last closing price + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ohlcv-kraken.md b/docs/ccxt/wiki/examples/py/fetch-ohlcv-kraken.md new file mode 100644 index 0000000..b6ab009 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ohlcv-kraken.md @@ -0,0 +1,46 @@ +- [Fetch Ohlcv Kraken](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import asciichartpy + +import ccxt # noqa: E402 +exchange = ccxt.kraken() +symbol = 'LTC/EUR' + +# each ohlcv candle is a list of [ timestamp, open, high, low, close, volume ] +index = 4 # use close price from each ohlcv candle + +length = 80 +height = 15 + + +def print_chart(exchange, symbol, timeframe): + + # get a list of ohlcv candles + ohlcv = exchange.fetch_ohlcv(symbol, timeframe) + + # get the ohlCv (closing price, index == 4) + series = [x[index] for x in ohlcv] + + # print datetime and other values + for x in ohlcv: + print(exchange.iso8601(x[0]), x) + + print("\n" + exchange.name + ' ' + symbol + ' ' + timeframe + ' chart:') + + # print the chart + print("\n" + asciichartpy.plot(series[-length:], {'height': height})) # print the chart + + last = ohlcv[len(ohlcv) - 1][index] # last closing price + return last + + +last = print_chart(exchange, symbol, '1m') +print("\n" + exchange.name + ' last price: ' + str(last) + "\n") # print last closing price + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ohlcv-many-exchanges-continuosly.md b/docs/ccxt/wiki/examples/py/fetch-ohlcv-many-exchanges-continuosly.md new file mode 100644 index 0000000..92b0b9b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ohlcv-many-exchanges-continuosly.md @@ -0,0 +1,50 @@ +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +# fetch and handle constinuosly +async def fetch_ohlcv_continuously(exchange, symbol): + while True: + try: + ohlcv = await exchange.fetch_ohlcv(symbol) + ohlcv_length = len(ohlcv) + print('Fetched ', exchange.id, ' - ', symbol, ' candles. last candle: ', ohlcv[ohlcv_length - 1]) + except Exception as e: + print(e) + break + + +# start exchanges and fetch OHLCV loop +async def start_exchange(exchange_name, symbols): + ex = getattr(ccxt, exchange_name)({}) + promises = [] + for i in range(0, len(symbols)): + symbol = symbols[i] + promises.append(fetch_ohlcv_continuously(ex, symbol)) + await asyncio.gather(*promises) + await ex.close() + + +# main function await ex.close() + +async def example(): + exchanges = ['binance', 'okx', 'kraken'] + symbols = ['BTC/USDT', 'ETH/USDT'] + promises = [] + for i in range(0, len(exchanges)): + exchange_name = exchanges[i] + promises.append(start_exchange(exchange_name, symbols)) + await asyncio.gather(*promises) + + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ohlcv-mark-index-price.md b/docs/ccxt/wiki/examples/py/fetch-ohlcv-mark-index-price.md new file mode 100644 index 0000000..f51831b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ohlcv-mark-index-price.md @@ -0,0 +1,41 @@ +- [Fetch Ohlcv Mark Index Price](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + +import ccxt # noqa: E402 + +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.binanceusdm() + +response = exchange.fetchOHLCV( + symbol='ADA/USDT', + timeframe='1h', + params={"price": 'index'} +) + +pprint(response) + +# Convenience methods -------------------------------------------------------- + +markKlines = exchange.fetchMarkOHLCV( + symbol='ADA/USDT', + timeframe='1h', + params={"price": 'mark'} +) + +indexKlines = exchange.fetchIndexOHLCV( + symbol='ADA/USDT', + timeframe='1h', + params={"price": 'mark'} +) + +pprint(markKlines) +pprint(indexKlines) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ohlcv-on-new-candle.md b/docs/ccxt/wiki/examples/py/fetch-ohlcv-on-new-candle.md new file mode 100644 index 0000000..76652df --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ohlcv-on-new-candle.md @@ -0,0 +1,44 @@ +- [Fetch Ohlcv On New Candle](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time +import ccxt # noqa: E402 +from ccxt.base.decimal_to_precision import ROUND_UP # noqa: E402 +# common constants + +msec = 1000 +minute = 60 * msec +hold = 30 +exchange = ccxt.binance() + +limit = 500 +timeframe = "5m" +interval = exchange.parse_timeframe(timeframe) * 1000 + +while True: + + try: + + print(exchange.milliseconds(), 'Fetching candles') + since = exchange.round_timeframe(timeframe, exchange.milliseconds(), ROUND_UP) - (limit * interval) + ohlcv = exchange.fetch_ohlcv('ETH/BTC', timeframe, since=since, limit=limit) + print(exchange.milliseconds(), 'Fetched', len(ohlcv), 'candles') + first = ohlcv[0][0] + last = ohlcv[-1][0] + print('First candle epoch', first, exchange.iso8601(first)) + print('Last candle epoch', last, exchange.iso8601(last)) + # Calculate time to next candle and sleep for that many seconds + sleeptime = (exchange.round_timeframe(timeframe, last, ROUND_UP) - exchange.milliseconds()) / 1000 + print('sleeping for: ', sleeptime, 's', sleeptime // 60, 'min') + time.sleep(sleeptime) + except (ccxt.ExchangeError, ccxt.AuthenticationError, ccxt.ExchangeNotAvailable, ccxt.RequestTimeout) as error: + + print('Got an error', type(error).__name__, error.args, ', retrying in', hold, 'seconds...') + time.sleep(hold) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ohlcv-sequentially.md b/docs/ccxt/wiki/examples/py/fetch-ohlcv-sequentially.md new file mode 100644 index 0000000..4f758b4 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ohlcv-sequentially.md @@ -0,0 +1,41 @@ +- [Fetch Ohlcv Sequentially](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time +import ccxt # noqa: E402 +# common constants + +msec = 1000 +minute = 60 * msec +hold = 30 +exchange = ccxt.binance() +from_datetime = '2018-01-01 00:00:00' +from_timestamp = exchange.parse8601(from_datetime) +now = exchange.milliseconds() +data = [] + +while from_timestamp < now: + + try: + + print(exchange.milliseconds(), 'Fetching candles starting from', exchange.iso8601(from_timestamp)) + ohlcvs = exchange.fetch_ohlcv('ETH/BTC', '1m', from_timestamp) + print(exchange.milliseconds(), 'Fetched', len(ohlcvs), 'candles') + first = ohlcvs[0][0] + last = ohlcvs[-1][0] + print('First candle epoch', first, exchange.iso8601(first)) + print('Last candle epoch', last, exchange.iso8601(last)) + from_timestamp += len(ohlcvs) * minute + data += ohlcvs + + except (ccxt.ExchangeError, ccxt.AuthenticationError, ccxt.ExchangeNotAvailable, ccxt.RequestTimeout) as error: + + print('Got an error', type(error).__name__, error.args, ', retrying in', hold, 'seconds...') + time.sleep(hold) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ohlcv.md b/docs/ccxt/wiki/examples/py/fetch-ohlcv.md new file mode 100644 index 0000000..2bf9ab2 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ohlcv.md @@ -0,0 +1,30 @@ +- [Fetch Ohlcv](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +async def example(): + myex = ccxt.okx({}) + from_timestamp = myex.milliseconds() - 86400 * 1000 # last 24 hrs + ohlcv = await myex.fetch_ohlcv('BTC/USDT', '1m', from_timestamp, 3, { + 'whatever': 123, + }) + length = len(ohlcv) + if length > 0: + last_price = ohlcv[length - 1][4] + print('Fetched ', length, ' candles for ', myex.id, ': last close ', last_price) + else: + print('No candles have been fetched') + + await myex.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-okex-futures.md b/docs/ccxt/wiki/examples/py/fetch-okex-futures.md new file mode 100644 index 0000000..2888174 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-okex-futures.md @@ -0,0 +1,20 @@ +- [Fetch Okex Futures](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time +import ccxt # noqa: E402 +exchange = ccxt.okex() +exchange.load_markets() +for symbol in exchange.markets: + market = exchange.markets[symbol] + if market['future']: + print('----------------------------------------------------') + print(symbol, exchange.fetchTicker(symbol)) + time.sleep(exchange.rateLimit / 1000) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-open-orders.md b/docs/ccxt/wiki/examples/py/fetch-open-orders.md new file mode 100644 index 0000000..0726f0d --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-open-orders.md @@ -0,0 +1,41 @@ +- [Fetch Open Orders](./examples/py/) + + + ```python + import ccxt +from pprint import pprint + + +print('CCXT Version:', ccxt.__version__) + + +exchange = ccxt.binance({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + + +markets = exchange.load_markets() +# exchange.verbose = True # uncomment for debugging purposes if necessary + +symbol = 'BTC/USDT' # says itself + +# the since argument must be an integer in milliseconds throughout the lib +since = exchange.parse8601('2021-06-20T00:00:00') # parse it from ISO8601 datetime string + +# how many orders to return, max integer or None to use the exchanges' defaults +limit = None + +# your params-overrides here if necessary +params = { + # https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params +} + +try: + # https://github.com/ccxt/ccxt/wiki/Manual#querying-orders + orders = exchange.fetch_open_orders(symbol, since, limit, params) + pprint(orders) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-order-book-rtt.md b/docs/ccxt/wiki/examples/py/fetch-order-book-rtt.md new file mode 100644 index 0000000..b993cba --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-order-book-rtt.md @@ -0,0 +1,60 @@ +- [Fetch Order Book Rtt](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +# WARNING! +# This example measures the round-trip time by fetching the orderbook from an exchange +# In order to measure the speed of requests it disables the rate-limiting +# Disabling the rate-limiter is required to do an accurate measurement +# If you keep running without a rate limiter for a long time the exchange will ban you +# In a live production system always use either the built-in rate limiter or make your own + + +def main(): + + # the exchange instance has to be reused + # do not recreate the exchange before each call! + + exchange = ccxt.binance({ + + # if you do not rate-limit your requests the exchange can ban you! + 'enableRateLimit': False, # https://github.com/ccxt/ccxt/wiki/Manual#rate-limit + + }) + + exchange.load_markets() # https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + + # exchange.verbose = True # uncomment for debugging purposes if needed + + symbol = 'BTC/USDT' + + results = [] + num_iterations = 50 + + for i in range(0, num_iterations): + started = exchange.milliseconds() + orderbook = exchange.fetch_order_book(symbol) + ended = exchange.milliseconds() + elapsed = ended - started + print(elapsed, 'ms') + results.append(elapsed) + + pprint(results) + + rtt = int(sum(results) / len(results)) + print('Successfully tested', num_iterations, 'calls, the average round-trip time per call is', rtt, 'milliseconds') + + +main() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-orders.md b/docs/ccxt/wiki/examples/py/fetch-orders.md new file mode 100644 index 0000000..91acacd --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-orders.md @@ -0,0 +1,25 @@ +- [Fetch Orders](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +exchange = ccxt.bittrex({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + "enableRateLimit": True, +}) + +orders = exchange.fetch_orders() +print(orders) + +order = exchange.fetch_order(orders[0]['id']) +print(order) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch-ticker-many-exchanges-many-symbols.md b/docs/ccxt/wiki/examples/py/fetch-ticker-many-exchanges-many-symbols.md new file mode 100644 index 0000000..a238da7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch-ticker-many-exchanges-many-symbols.md @@ -0,0 +1,66 @@ +- [Fetch Ticker Many Exchanges Many Symbols](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from asyncio import gather, run + + +import ccxt.async_support as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange_ids = ['binance', 'okx', 'gate', 'huobi', 'bitget'] +symbols = ['BTC/USDT', 'ETH/USDT', 'LTC/USDT', 'XRP/USDT'] +from asyncio import gather, run + + +async def fetch_price(exchange, symbol): + try: + ticker = await exchange.fetch_ticker(symbol) + return [ + symbol, + # we use last traded price for this example + # https://github.com/ccxt/ccxt/wiki/Manual#price-tickers + # https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure + ticker['last'], + 'at', + exchange.id + ] + except Exception as e: + print(type(e).__name__, str(e)) + return [symbol, 'not available at', exchange.id] + + +async def compare_symbol(exchanges, symbol): + coroutines = [fetch_price(exchange, symbol) for exchange in exchanges] + results = await gather(*coroutines) + print('') # spacing line + for result in results: + print(*result) + print('') # spacing line + + +async def main(): + exchanges = [getattr(ccxt, exchange_id)() for exchange_id in exchange_ids] + # https://github.com/ccxt/ccxt/wiki/Manual#loading-markets + load_markets = [exchange.load_markets() for exchange in exchanges] + print('Loading markets...') + await gather(*load_markets) + print('Done loading markets.') + print('Loading tickers...') + coroutines = [compare_symbol(exchanges, symbol) for symbol in symbols] + await gather(*coroutines) + close_all = [exchange.close() for exchange in exchanges] + await gather(*close_all) + + + +if __name__ == '__main__': + run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/fetch_longer_ohlcv_through_multiple_calls_and_save_to_csv.md b/docs/ccxt/wiki/examples/py/fetch_longer_ohlcv_through_multiple_calls_and_save_to_csv.md new file mode 100644 index 0000000..f75467c --- /dev/null +++ b/docs/ccxt/wiki/examples/py/fetch_longer_ohlcv_through_multiple_calls_and_save_to_csv.md @@ -0,0 +1,57 @@ +- [Fetch_longer_ohlcv_through_multiple_calls_and_save_to_csv](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import ccxt # noqa: E402 +import numpy as np +from datetime import datetime + + +print('CCXT Version:', ccxt.__version__) + +# data +exchange_name = 'ftx' +symbol = "BTC/USD" +max_candles = 5000 +timeframe = '1h' +start = 1609459200000 # Jan 1, 2021 +ms_per_candle = { + '1m': 60000, + '5m': 300000, + '15m': 900000, + '30m': 1800000, + '1h': 3600000, + '2h': 7200000, + '4h': 14400000, + '8h': 28800000, + '12h': 57600000, + '1d': 86400000, +} + +now = int(datetime.now().timestamp() * 1000) +outfile = f"{symbol.replace('/', '-')}_{timeframe}_{exchange_name}_{start}-{now}.csv" + +# setup +exchange = ccxt.ftx() +exchange.load_markets() +ohlcv = [] + +# make requests for candle data +while start < now: + candles = exchange.fetch_ohlcv(symbol, timeframe, start, max_candles) + ohlcv += candles + start = start + (ms_per_candle[timeframe] * max_candles) + +# write to csv +np.savetxt( + outfile, + ohlcv, + delimiter=",", + fmt='%d,%s,%s,%s,%s,%s' +) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/gateio-fetch-ohlcv-pagination.md b/docs/ccxt/wiki/examples/py/gateio-fetch-ohlcv-pagination.md new file mode 100644 index 0000000..1dec0bb --- /dev/null +++ b/docs/ccxt/wiki/examples/py/gateio-fetch-ohlcv-pagination.md @@ -0,0 +1,48 @@ +- [Gateio Fetch Ohlcv Pagination](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +def main(): + exchange = ccxt.gateio() + markets = exchange.load_markets() + # exchange.verbose = True # uncomment for debugging purposes if necessary + since = exchange.parse8601('2022-01-01T00:00:00Z') + symbol = 'BTC/USDT' + timeframe = '1h' + all_ohlcvs = [] + while True: + try: + ohlcvs = exchange.fetch_ohlcv(symbol, timeframe, since) + all_ohlcvs += ohlcvs + if len(ohlcvs): + print('Fetched', len(ohlcvs), symbol, timeframe, 'candles from', exchange.iso8601(ohlcvs[0][0])) + since = ohlcvs[-1][0] + 1 + else: + break + except Exception as e: + print(type(e).__name__, str(e)) + print('Fetched', len(all_ohlcvs), symbol, timeframe, 'candles in total') + if len(all_ohlcvs): + print(table([[exchange.iso8601(o[0])] + o[1:] for o in all_ohlcvs])) + + +main() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/gateio-futures.md b/docs/ccxt/wiki/examples/py/gateio-futures.md new file mode 100644 index 0000000..f68d816 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/gateio-futures.md @@ -0,0 +1,55 @@ +- [Gateio Futures](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +from random import randint +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.gateio({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'future', + }, +}) + +markets = exchange.load_markets() + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +# Example 1: Creating a future (market) order +try: + # find a valid future + futures = [] + for key in markets: + market = markets[key] + if market['future']: + futures.append(market) + + if len(futures) > 0: + market = futures[0] + symbol = market['symbol'] # example: BTC/USDT:USDT-220318 + type = 'market' + side = 'buy' + amount = 1 + + # placing an order + order = exchange.create_order(symbol, type, side, amount) + print(order) + + # listing open orders + open_orders = exchange.fetch_open_orders(symbol) + print(open_orders) + +except Exception as e: + print(type(e).__name__, str(e)) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/gateio-open-close-contract.md b/docs/ccxt/wiki/examples/py/gateio-open-close-contract.md new file mode 100644 index 0000000..d9c9b46 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/gateio-open-close-contract.md @@ -0,0 +1,59 @@ +- [Gateio Open Close Contract](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.gateio({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'swap', + }, +}) + +# exchange.set_sandbox_mode(True) + +markets = exchange.load_markets() + +exchange.verbose = True # uncomment for debugging purposes if necessary + + +# Example: creating and closing a contract +symbol = 'LTC/USDT:USDT' +order_type = 'market' +side = 'buy' +amount = 1 + +try: + # fetching current balance + balance = exchange.fetch_balance() + # print(balance) + + # placing an order/ opening contract position + order = exchange.create_order(symbol, order_type, side, amount) + # print(order) + + # closing it by issuing an oposite contract + # and therefore close our previous position + side = 'sell' + type = 'market' + reduce_only = True + params = {'reduce_only': reduce_only} + opositeOrder = exchange.create_order(symbol, order_type, side, amount, None, params) + print(opositeOrder) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/gateio-swaps.md b/docs/ccxt/wiki/examples/py/gateio-swaps.md new file mode 100644 index 0000000..eb2bcc9 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/gateio-swaps.md @@ -0,0 +1,83 @@ +- [Gateio Swaps](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +from random import randint +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.gateio({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'future', + }, +}) + +markets = exchange.load_markets() + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +# Example 1: Creating and canceling a linear future (limit) order +symbol = 'LTC/USDT:USDT' +type = 'limit' +side = 'buy' +amount = 1 +price = 55 + +try: + # placing an order + order = exchange.create_order(symbol, type, side, amount, price) + print(order) + + # listing open orders + open_orders = exchange.fetch_open_orders(symbol) + print(open_orders) + + # canceling an order + cancelOrder = exchange.cancel_order(order['id'], symbol) + print(cancelOrder) +except Exception as e: + print(type(e).__name__, str(e)) + + +# Example 2: Creating and canceling a linear future (stop-limit) order with leverage +symbol = 'LTC/USDT:USDT' +type = 'limit' +side = 'buy' +amount = 1 +price = 55 +stop_price = 140 +params = {'stopPrice': stop_price } + +try: + # set leverage + leverage = exchange.set_leverage(3, symbol) + print(leverage) + + # placing an order + order = exchange.create_order(symbol, type, side, amount, price, params) + print(order) + + # listing open orders + open_orders = exchange.fetch_open_orders(symbol) + print(open_orders) + + # canceling an order + cancelParams = {'isStop': True } + cancelOrder = exchange.cancel_order(order['id'], symbol, cancelParams) + print(cancelOrder) + + # reset leverage + exchange.set_leverage(1, symbol) +except Exception as e: + print(type(e).__name__, str(e)) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/gdax-fetch-my-trades-pagination.md b/docs/ccxt/wiki/examples/py/gdax-fetch-my-trades-pagination.md new file mode 100644 index 0000000..baf7428 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/gdax-fetch-my-trades-pagination.md @@ -0,0 +1,46 @@ +- [Gdax Fetch My Trades Pagination](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + +import ccxt # noqa: E402 + +''' +Example snippet to traverse GDAX / CoinBase Pro pagination. +Useful for reaching back more than 100 myTrades, the same works +for fetchClosedOrders +''' + +exchange = ccxt.gdax({ + "apiKey": "123456", + "secret": "/abcdefghijklmnop/w==", + "password": "987654321", + "enableRateLimit": True +}) + +param_key = '' +param_value = '' +allMyTrades = [] + +while True: + myTrades = exchange.fetch_my_trades(symbol='BTC/USD', params={param_key: param_value}) + + # Handle gdax with pagination ... + if exchange.last_response_headers._store.get('cb-after'): + param_key = 'after' + param_value = exchange.last_response_headers._store['cb-after'][1] + + allMyTrades.extend(myTrades) + + else: + allMyTrades.extend(myTrades) + break + +for trade in allMyTrades: + print(trade) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/hitbtc-withdraw.md b/docs/ccxt/wiki/examples/py/hitbtc-withdraw.md new file mode 100644 index 0000000..da745dc --- /dev/null +++ b/docs/ccxt/wiki/examples/py/hitbtc-withdraw.md @@ -0,0 +1,47 @@ +- [Hitbtc Withdraw](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +from pprint import pprint + +import os +import sys + + +import ccxt # noqa: E402 + + +def get_positive_accounts(balance): + result = {} + currencies = list(balance.keys()) + for currency in currencies: + if balance[currency] and balance[currency] > 0: + result[currency] = balance[currency] + return result + + +exchange = ccxt.hitbtc({ + 'apiKey': "YOUR_API_KEY", + 'secret': "YOUR_SECRET", + 'enableRateLimit': True, +}) + + +trading_balance = exchange.fetch_balance() +account_balance = exchange.fetch_balance({'type': 'account'}) + +pprint('Trading balance:') +pprint(get_positive_accounts(trading_balance['total'])) +pprint('Account balance:') +pprint(get_positive_accounts(account_balance['total'])) + + +withdraw = exchange.withdraw('ETH', 0.01, '0x811DCfeb6dC0b9ed825808B6B060Ca469b83fB81') + + +pprint('Withdraw:') +pprint(withdraw) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/huobi-futures.md b/docs/ccxt/wiki/examples/py/huobi-futures.md new file mode 100644 index 0000000..ed7ee5e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/huobi-futures.md @@ -0,0 +1,90 @@ +- [Huobi Futures](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +from random import randint +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.huobi({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'future', + }, +}) + +markets = exchange.load_markets() + + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +# creating and canceling a linear future (limit) order +symbol = 'ETH/USDT:USDT-220121' # the last segment is the date of expiration (can be next week, next quarter, ...) adjust it accordingly +order_type = 'limit' +side = 'buy' +offset = 'open' +leverage = 1 +amount = 1 +price = 1 + +params = {'offset': offset, 'lever_rate': leverage} + +try: + # fetching current balance + balance = exchange.fetch_balance() + print(balance) + + # placing an order + order = exchange.create_order(symbol, order_type, side, amount, price, params) + print(order) + + # listing open orders + open_orders = exchange.fetch_open_orders(symbol) + # print(open_orders) + + # canceling an order + cancelOrder = exchange.cancel_order(order['id'], symbol) + print(cancelOrder) +except Exception as e: + print(type(e).__name__, str(e)) + + +# creating and canceling a inverse future (limit) order +symbol = 'ADA/USD:ADA-220121' # the last segment is the date of expiration (can be next week, next quarter, ...) adjust it accordingly +order_type = 'limit' +side = 'buy' +offset = 'open' +leverage = 1 +amount = 1 # 1 contract = 10 ADA +price = 1 + +params = {'offset': offset, 'lever_rate': leverage} + +try: + # fetching current balance + balance = exchange.fetch_balance() + # print(balance) + + # placing an order + order = exchange.create_order(symbol, order_type, side, amount, price, params) + print(order) + + # listing open orders + open_orders = exchange.fetch_open_orders(symbol) + # print(open_orders) + + # canceling an order + cancelOrder = exchange.cancel_order(order['id'], symbol) + print(cancelOrder) +except Exception as e: + print(type(e).__name__, str(e)) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/huobi-open-close-contract.md b/docs/ccxt/wiki/examples/py/huobi-open-close-contract.md new file mode 100644 index 0000000..0ca81b7 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/huobi-open-close-contract.md @@ -0,0 +1,75 @@ +- [Huobi Open Close Contract](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.huobi({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'options': { + 'defaultType': 'swap', + 'marginType': 'cross' + }, +}) + +markets = exchange.load_markets() + + +exchange.verbose = True # uncomment for debugging purposes if necessary + + +# Example: creating and closing a contract +symbol = 'ADA/USDT:USDT' +order_type = 'limit' # market positions for contracts not available +side = 'buy' +offset = 'open' +leverage = 1 +amount = 1 +price = 1.14615 # adjust this accordingly +client_order_id = 1 + +params = {'offset': offset, 'lever_rate': leverage, 'client_order_id': client_order_id} + +try: + # fetching current balance + balance = exchange.fetch_balance() + # print(balance) + + # # placing an order + order = exchange.create_order(symbol, order_type, side, amount, price, params) + # print(order) + + # # list open position + position = exchange.fetch_position(symbol) + # print(position) + + # closing it by issuing an oposite contract + # warning: since we can only place limit orders + # it might take a while (depending on the price we choose and market fluctuations) + # to the order be fulfilled + # and therefore close our previous position + side = 'sell' + type = 'limit' + offset = 'close' + reduce_only = 1 # 1 : yes, 0: no + client_order_id = 5 + price = 1.11 # adjust this accordingly + params = {'offset': offset, 'reduce_only': reduce_only, 'client_order_id': client_order_id} + opositeOrder = exchange.create_order(symbol, order_type, side, amount, price, params) + print(opositeOrder) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/huobi-open-close-position-bbo.md b/docs/ccxt/wiki/examples/py/huobi-open-close-position-bbo.md new file mode 100644 index 0000000..5fb2e1b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/huobi-open-close-position-bbo.md @@ -0,0 +1,68 @@ +- [Huobi Open Close Position Bbo](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.huobi({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', +}) + +# Example 1 :: Swap : fetch balance, open a position and close it using BBO price +async def example_1(): + markets = await exchange.load_markets(True) + + # fetch swap balance + balance = await exchange.fetch_balance() + print(balance) + + # create market order and open position + symbol = 'ADA/USDT:USDT' + # type = 'opponent' means it will use BB0 (the best bid or offer on the Exchange) as the price, huobi does not support "market" + # other types available are: opponent_fok, optimal_5, optimal_10, optimal_20, etc, etc + # you can check all the types available in the docs: https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-an-order + type = 'opponent' + side = 'buy' + amount = 1 + price = None + create_order = await exchange.create_order(symbol, type, side, amount, price) + print('Create order id:', create_order['id']) + + # check opened position + symbols = [ symbol ] + positions = await exchange.fetch_positions(symbols) + print(positions) + + # Close position by issuing a order in the opposite direction + side = 'sell' + params = { + 'reduceOnly': True + } + close_position_order = await exchange.createOrder(symbol, type, side, amount, price, params) + print(close_position_order) +async def main(): + try: + await example_1() + except Exception as e: + print(e) + await exchange.close() + + +asyncio.run(main()) + + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/huobi-spot.md b/docs/ccxt/wiki/examples/py/huobi-spot.md new file mode 100644 index 0000000..440325e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/huobi-spot.md @@ -0,0 +1,86 @@ +- [Huobi Spot](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +from random import randint +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.huobi({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'options': { + 'defaultType': 'spot', + }, +}) + +markets = exchange.load_markets() + + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +# creating and canceling a stop-limit buy order +symbol = 'ADA/USDT' +order_type = 'limit' +side = 'buy' +offset = 'open' +amount = 10 +price = 0.5 +stopPrice = 0.6 +operator = 'lte' + +params = {'offset': offset, 'stopPrice': stopPrice, 'operator': operator} + +try: + + # Order creation + order = exchange.create_order(symbol, order_type, side, amount, price, params) + print(order) + + # List open positions + open_orders = exchange.fetch_open_orders(symbol, params={"side": "buy"}) + print(open_orders) + + #Order cancelation + cancelOrder = exchange.cancel_order(order['id'], symbol) + print(cancelOrder) +except Exception as e: + print(type(e).__name__, str(e)) + + +# creating and canceling a stop limit sell order +symbol = 'ADA/USDT' +order_type = 'limit' +side = 'sell' +offset = 'open' +amount = 10 +price = 5 +stopPrice = 5 +operator = 'gte' + +params = {'offset': offset, 'stopPrice': stopPrice, 'operator': operator} + +try: + + # Order creation + order = exchange.create_order(symbol, order_type, side, amount, price, params) + print(order) + + # List open positions + open_orders = exchange.fetch_open_orders(symbol, params={"side": "sell"}) + print(open_orders) + + #Order cancelation + cancelOrder = exchange.cancel_order(order['id'], symbol) + print(cancelOrder) +except Exception as e: + print(type(e).__name__, str(e)) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/huobi-swaps.md b/docs/ccxt/wiki/examples/py/huobi-swaps.md new file mode 100644 index 0000000..7a95a10 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/huobi-swaps.md @@ -0,0 +1,92 @@ +- [Huobi Swaps](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.huobi({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET_KEY', + 'options': { + 'defaultType': 'swap', + }, +}) + +markets = exchange.load_markets() + + +# exchange.verbose = True # uncomment for debugging purposes if necessary + + +# creating and canceling a linear swap (limit) order +symbol = 'ADA/USDT:USDT' +order_type = 'limit' +side = 'buy' +offset = 'open' +leverage = 1 +amount = 1 +price = 1 + +params = {'offset': offset, 'lever_rate': leverage} + +try: + # fetching current balance + balance = exchange.fetch_balance() + # print(balance) + + # placing an order + order = exchange.create_order(symbol, order_type, side, amount, price, params) + # print(order) + + # listing open orders + open_orders = exchange.fetch_open_orders(symbol) + # print(open_orders) + + # canceling an order + cancelOrder = exchange.cancel_order(order['id'], symbol) + print(cancelOrder) +except Exception as e: + print(type(e).__name__, str(e)) + + +# creating and canceling inverse swap (limit) order +symbol = 'ADA/USD:ADA' +order_type = 'limit' +side = 'buy' +offset = 'open' +leverage = 1 +amount = 1 +price = 1 + +params = {'offset': offset, 'lever_rate': leverage} + +try: + # fetching current balance + balance = exchange.fetch_balance() + # print(balance) + + # placing an order + order = exchange.create_order(symbol, order_type, side, amount, price, params) + print(order) + + # listing open orders + open_orders = exchange.fetch_open_orders(symbol) + # print(open_orders) + + # canceling an order + cancelOrder = exchange.cancel_order(order['id'], symbol) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/instantiate-all-at-once.md b/docs/ccxt/wiki/examples/py/instantiate-all-at-once.md new file mode 100644 index 0000000..9a36a55 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/instantiate-all-at-once.md @@ -0,0 +1,22 @@ +- [Instantiate All At Once](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +exchanges = {} # a placeholder for your instances + +for id in ccxt.exchanges: + exchange = getattr(ccxt, id) + exchanges[id] = exchange() + +# now exchanges dictionary contains all exchange instances... +exchanges['bittrex'].fetch_order_book('ETH/BTC') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kraken-conditional-close-order.md b/docs/ccxt/wiki/examples/py/kraken-conditional-close-order.md new file mode 100644 index 0000000..ee18113 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kraken-conditional-close-order.md @@ -0,0 +1,48 @@ +- [Kraken Conditional Close Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 +from pprint import pprint + + +exchange = ccxt.kraken({ + # 'apiKey': 'YOUR_API_KEY', + # 'secret': 'YOUR_SECRET', +}) + +markets = exchange.load_markets() + +exchange.verbose = True + +symbol = 'XMR/USD' +ticker = exchange.fetch_ticker(symbol) +last_price = ticker['last'] + +# extra params and overrides +params = { + 'close': { + 'ordertype': 'limit', + 'price': last_price * 1.3, + } +} +amount = 0.05 +price = last_price * 0.7 +order = exchange.create_order(symbol, 'limit', 'buy', amount, price, params) +print('Created order:') +pprint(order) + +fetched_order = exchange.fetch_order(order['id']) +print('Fetched order:') +pprint(fetched_order) + +canceled_order = exchange.cancel_order(order['id']) +print('Canceled order:') +pprint(canceled_order) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kraken-create-and-close-position.md b/docs/ccxt/wiki/examples/py/kraken-create-and-close-position.md new file mode 100644 index 0000000..b725e18 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kraken-create-and-close-position.md @@ -0,0 +1,61 @@ +- [Kraken Create And Close Position](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +print('CCXT Version:', ccxt.version) + +async def example(): + exchange = ccxt.kraken({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }) + symbol = 'UNI/USD' + side = 'buy' # set it to 'buy' for a long position, 'sell' for a short position + order_type = 'market' # set it to 'market' or 'limit' + amount = 1 + leverage = 2 + await exchange.load_markets() + market = exchange.market(symbol) + # if order_type is 'market', then price is not needed + price = None + # if order_type is 'limit', then set a price at your desired level + # you can fetch the ticker and update price + # const ticker = await exchange.fetchTicker (symbol); + # const last_price = ticker['last']; + # const ask_price = ticker['ask']; + # const bid_price = ticker['bid']; + # if (order_type === 'limit') { + # price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; # i.e. 5% from current price + # } + params = { + 'leverage': leverage, + } + # log + print('Going to open a position', 'for', amount, 'worth', amount, market['base'], '~', market['settle'], 'using', side, order_type, 'order (', (exchange.price_to_precision(symbol, price) if order_type == 'limit' else ''), '), using the following params:') + print(params) + print('-----------------------------------------------------------------------') + try: + created_order = await exchange.create_order(symbol, order_type, side, amount, price, params) + print('Created an order', created_order) + # Fetch all your closed orders for this symbol (because we used market order) + # - use 'fetchClosedOrders' or 'fetchOrders' and filter with 'closed' status + all_closed_orders = await exchange.fetch_closed_orders(symbol) + print('Fetched all your closed orders for this symbol', all_closed_orders) + all_open_positions = await exchange.fetch_positions(symbol) + print('Fetched all your positions for this symbol', all_open_positions) + except Exception as e: + print(str(e)) + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kraken-fetch-my-trades-pagination.md b/docs/ccxt/wiki/examples/py/kraken-fetch-my-trades-pagination.md new file mode 100644 index 0000000..bc398df --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kraken-fetch-my-trades-pagination.md @@ -0,0 +1,50 @@ +- [Kraken Fetch My Trades Pagination](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.kraken({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', +}) + +exchange.load_markets() + +# exchange.verbose = True # uncomment for verbose debug output + +exchange.rateLimit = 10000 # set a higher value if you get rate-limiting errors + +all_trades = [] +offset = 0 +while True: + trades = exchange.fetch_my_trades(symbol=None, since=None, limit=None, params={'ofs': offset}) + print('-----------------------------------------------------------------') + print(exchange.iso8601(exchange.milliseconds()), 'Fetched', len(trades), 'trades') + if len(trades) < 1: + break + else: + first = exchange.safe_value(trades, 0) + last = exchange.safe_value(trades, len(trades) - 1) + print('From:', first['datetime']) + print('To:', last['datetime']) + all_trades = trades + all_trades + offset += len(trades) + print(len(all_trades), 'trades fetched in total') + +print('-----------------------------------------------------------------') +print(len(all_trades), 'trades fetched') +first = exchange.safe_value(all_trades, 0) +if first: + last = exchange.safe_value(all_trades, len(all_trades) - 1) + print('First:', first['datetime']) + print('Last:', last['datetime']) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/krakenfutures-basic.md b/docs/ccxt/wiki/examples/py/krakenfutures-basic.md new file mode 100644 index 0000000..32584c6 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/krakenfutures-basic.md @@ -0,0 +1,28 @@ +- [Krakenfutures Basic](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +print("CCXT Version:", ccxt.__version__) + + +exchange = ccxt.krakenfutures() +markets = exchange.load_markets() +# exchange.verbose = True # uncomment for debugging purposes if necessary +print(exchange.name, "supports the following methods:") +pprint(exchange.has) +print(exchange.name, "supports the following trading symbols:") +for symbol in exchange.symbols: + print(symbol) +symbol = 'BTC/USD:USD' +orderbook = exchange.fetch_order_book(symbol) +pprint(orderbook) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses-by-network.md b/docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses-by-network.md new file mode 100644 index 0000000..2f96b13 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses-by-network.md @@ -0,0 +1,30 @@ +- [Kucoin Fetch All Deposit Addresses By Network](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +exchange = ccxt.kucoin({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + # 'verbose': True, # for debug output +}) + +code = 'USDT' + +try: + depositAddresses = exchange.fetch_deposit_addresses_by_network(code) + pprint(depositAddresses) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses.md b/docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses.md new file mode 100644 index 0000000..4865cf4 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kucoin-fetch-all-deposit-addresses.md @@ -0,0 +1,44 @@ +- [Kucoin Fetch All Deposit Addresses](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +exchange = ccxt.kucoin({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', +}) + +markets = exchange.load_markets() + +exchange.verbose = True # uncomment for debugging purposes if necessary + +for code in ['TLOS']: # exchange.currencies.keys(): + response = exchange.public_get_currencies_currency({'currency': code}) + currency = exchange.safe_value(response, 'data') + if currency: + # pprint(currency) + chains = exchange.safe_value(currency, 'chains') + for chain in chains: + chainName = exchange.safe_string(chain, 'chainName') + try: + response = exchange.fetch_deposit_address(code, {'chain': chainName}) + if response['address'] is not None and response['address'] != '': + print(code, 'has a', chainName, 'address', response['address'], ':' + response['tag'] if response['tag'] is not None and len(response['tag']) else '') + else: + print(code, 'has no', chainName, 'address') + except ccxt.BaseError as e: + print(code, 'has no', chainName, 'address') + else: + print(code, 'has no addresses') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kucoin-fetch-closed-orders-pagination.md b/docs/ccxt/wiki/examples/py/kucoin-fetch-closed-orders-pagination.md new file mode 100644 index 0000000..05dc01e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kucoin-fetch-closed-orders-pagination.md @@ -0,0 +1,37 @@ +- [Kucoin Fetch Closed Orders Pagination](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +exchange = ccxt.kucoin({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + "password": "YOUR_PASSWORD" +}) + +symbol = 'ETH/USDT' +now = exchange.milliseconds() +day = 24 * 3600 * 1000 +week = 7 * day +since = now - 365 * day # start one year back +limit = 20 + +while since < now: + + end = min(since + week, now) + params = {'endAt': end} + orders = exchange.fetch_closed_orders(symbol, since, limit, params) + print(exchange.iso8601(since), '-', exchange.iso8601(end), len(orders), 'orders') + if len(orders) == limit: + since = orders[-1]['timestamp'] + else: + since += week + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kucoin-rate-limit.md b/docs/ccxt/wiki/examples/py/kucoin-rate-limit.md new file mode 100644 index 0000000..b83a994 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kucoin-rate-limit.md @@ -0,0 +1,42 @@ +- [Kucoin Rate Limit](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + + +exchange = ccxt.kucoin() +markets = exchange.load_markets() +i = 0 +while True: + try: + symbol = 'BTC/USDT' + timeframe = '5m' + since = None + limit = 1000 + ohlcvs = exchange.fetch_ohlcv(symbol, timeframe, since, limit) + now = exchange.milliseconds() + datetime = exchange.iso8601(now) + print(datetime, i, 'fetched', len(ohlcvs), symbol, timeframe, 'candles', + 'from', exchange.iso8601(ohlcvs[0][0]), + 'to', exchange.iso8601(ohlcvs[len(ohlcvs)-1][0])) + except ccxt.RateLimitExceeded as e: + now = exchange.milliseconds() + datetime = exchange.iso8601(now) + print(datetime, i, type(e).__name__, str(e)) + exchange.sleep(10000) + except Exception as e: + print(type(e).__name__, str(e)) + raise e + i += 1 + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kucoin-withdraw-chain.md b/docs/ccxt/wiki/examples/py/kucoin-withdraw-chain.md new file mode 100644 index 0000000..7957b4b --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kucoin-withdraw-chain.md @@ -0,0 +1,40 @@ +- [Kucoin Withdraw Chain](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.kucoin({ +    'apiKey': 'YOUR_API_KEY', +    'secret': 'YOUR_SECRET', + 'password': 'YOUR_API_PASSWORD', +}) + +markets = exchange.load_markets() + +# exchange.verbose = True # uncomment for debugging purposes + +try: + code = 'USDT' + amount = 123 + address = '0x3010c3486f1c16cb608ba3e53e3597c9a3b01f41' + tag = None + params = { + 'chain': 'TRC20', # 'ERC20', 'TRC20', default is ERC20 + } + response = exchange.withdraw(code, amount, address, tag, params) + pprint(response) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/kucoinfutures-create-stop-order.md b/docs/ccxt/wiki/examples/py/kucoinfutures-create-stop-order.md new file mode 100644 index 0000000..ae34ac0 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/kucoinfutures-create-stop-order.md @@ -0,0 +1,49 @@ +- [Kucoinfutures Create Stop Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.kucoinfutures({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', + # 'verbose': True, # for debug output +}) + +symbol = 'BTC/USDT:USDT' +order_type = 'limit' +side = 'sell' +amount = 1 +order_price = 13500 # below the stopLossPrice and above the takeProfitPrice +stop_trigger_params = { + 'triggerPrice': '14000', + 'leverage': 2, # defaults to 1 +} +# stop_loss_params = { +# 'stopLossPrice': '15000', # the price that triggers the order_price order +# 'leverage': 1, +# } +# take_profit_params = { +# 'takeProfitPrice': '17000', # the price that triggers the order_price order +# 'leverage': 1, +# } + +try: + stop_trigger_order = exchange.create_order(symbol, order_type, side, amount, order_price, stop_trigger_params) + # stop_loss_order = exchange.create_order(symbol, order_type, side, amount, order_price, stop_loss_params) + # take_profit_order = exchange.create_order(symbol, order_type, side, amount, order_price, take_profit_params) + pprint(stop_trigger_order) + # pprint(stop_loss_order) + # pprint(take_profit_order) +except Exception as err: + print(err) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/latoken-create-order.md b/docs/ccxt/wiki/examples/py/latoken-create-order.md new file mode 100644 index 0000000..822650a --- /dev/null +++ b/docs/ccxt/wiki/examples/py/latoken-create-order.md @@ -0,0 +1,29 @@ +- [Latoken Create Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +exchange = ccxt.latoken({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +symbol = 'ETH/BTC' +type = 'limit' # only support limit +side = 'buy' # or 'sell' +amount = 0.01 +price = 0.015881 # or None + +order = exchange.create_order(symbol, type, side, amount, price) + +print(order) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/latoken-example.md b/docs/ccxt/wiki/examples/py/latoken-example.md new file mode 100644 index 0000000..9da9003 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/latoken-example.md @@ -0,0 +1,118 @@ +- [Latoken Example](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +def table(values): + first = values[0] + keys = list(first.keys()) if isinstance(first, dict) else range(0, len(first)) + widths = [max([len(str(v[k])) for v in values]) for k in keys] + string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) + return "\n".join([string.format(*[str(v[k]) for k in keys]) for v in values]) + + +symbol = 'BTC/USDT' + +exchange = ccxt.latoken ({ + # 'verbose': True, # uncomment for debugging purposes + # uncomment and change for your keys to enable private calls + # 'apiKey': 'YOUR_API_KEY', + # 'secret': 'YOUR_API_SECRET', +}) + +exchange.load_markets() + +print('-------------------------------------------------------------------') + +print(exchange.id, 'has:') +pprint(exchange.has) + +# public API + +print('-------------------------------------------------------------------') + +markets = exchange.markets.values() +print('Loaded', len(markets), exchange.id, 'markets:') +print(table([exchange.omit(x, ['info', 'limits', 'precision']) for x in markets])) + +print('-------------------------------------------------------------------') + +currencies = exchange.currencies.values() +print('Loaded', len(currencies), exchange.id, 'currencies:') +print(table([exchange.omit(x, ['info', 'limits']) for x in currencies])) + +print('-------------------------------------------------------------------') + +time = exchange.fetch_time() +print('Exchange time:', exchange.iso8601(time)) + +print('-------------------------------------------------------------------') + +ticker = exchange.fetch_ticker(symbol) +pprint(ticker) + +print('-------------------------------------------------------------------') + +tickers = exchange.fetch_tickers() +tickers = tickers.values() +print(table([exchange.omit(x, ['info', 'bid', 'ask', 'bidVolume', 'askVolume', 'timestamp']) for x in tickers])) + +print('-------------------------------------------------------------------') + +orderbook = exchange.fetch_order_book(symbol) +pprint(orderbook) + +print('-------------------------------------------------------------------') + +trades = exchange.fetch_trades(symbol) +print(table([exchange.omit(x, ['info', 'timestamp']) for x in trades])) + +print('-------------------------------------------------------------------') + +# private API + +if exchange.check_required_credentials(False): + + balance = exchange.fetch_balance() + pprint(exchange.omit(balance, ['info'])) + + print('-------------------------------------------------------------------') + + order = exchange.create_order(symbol, 'limit', 'buy', 0.001, 10000) + pprint(order) + + print('-------------------------------------------------------------------') + + open_orders = exchange.fetch_open_orders(symbol) + print(table([exchange.omit(x, ['info', 'timestamp']) for x in open_orders])) + + print('-------------------------------------------------------------------') + + canceled = exchange.cancel_order(order['id'], order['symbol']) + pprint(canceled) + + print('-------------------------------------------------------------------') + + closed_orders = exchange.fetch_closed_orders(symbol) + print(table([exchange.omit(x, ['info', 'timestamp']) for x in closed_orders])) + + print('-------------------------------------------------------------------') + + canceled_orders = exchange.fetch_canceled_orders (symbol) + print(table([exchange.omit(x, ['info', 'timestamp']) for x in canceled_orders])) + + print('-------------------------------------------------------------------') + + my_trades = exchange.fetch_my_trades (symbol) + print(table([exchange.omit(x, ['info', 'timestamp']) for x in my_trades])) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/manual-rate-limiting-long-poller.md b/docs/ccxt/wiki/examples/py/manual-rate-limiting-long-poller.md new file mode 100644 index 0000000..529c3bf --- /dev/null +++ b/docs/ccxt/wiki/examples/py/manual-rate-limiting-long-poller.md @@ -0,0 +1,28 @@ +- [Manual Rate Limiting Long Poller](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +import time + + +import ccxt # noqa: E402 + +# if you imported the ccxt library with `import ccxt` you can +# throttle your requests manually, by using the rateLimit property of an exchange +# to delay each request by waiting for some time to stay below request rate limits + +exchange = ccxt.bitfinex() + +# the rateLimit is in milliseconds → divide it by a thousand to get seconds +delay = exchange.rateLimit / 1000 + +for i in range(0, 10): + # this can be any call instead of fetch_ticker, really + print(exchange.fetch_ticker('BTC/USD')) + time.sleep(delay) # sleep a little before sending each next request + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/margin-leverage-order-kraken.md b/docs/ccxt/wiki/examples/py/margin-leverage-order-kraken.md new file mode 100644 index 0000000..3a27e23 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/margin-leverage-order-kraken.md @@ -0,0 +1,41 @@ +- [Margin Leverage Order Kraken](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +kraken = ccxt.kraken({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +kraken.load_markets() + +for symbol in kraken.symbols: + print( + symbol, + 'Available leverage levels', + 'Buy:', kraken.markets[symbol]['info']['leverage_buy'], + 'Sell:', kraken.markets[symbol]['info']['leverage_sell'] + ) + +# THIS IS A KRAKEN-SPECIFIC EXAMPLE. +# THE LEVERAGE WILL NOT WORK WITH OTHER EXCHANGES THE SAME WAY. +# USE IMPLICIT METHODS FOR MARGIN/LEVERAGED ORDERS WITH OTHER EXCHANGES: +# https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods + +# with create_order all params (including the price=None) are needed! +# the extra param should be "leverage", not "leverage_sell" nor "leverage-sell" +kraken.create_order('BTC/USD', 'market', 'sell', 0.01, None, {'leverage': 3}) + +# or use a shorthand create_market_sell_order (no "price" param) +kraken.create_market_sell_order('BTC/USD', 0.01, {'leverage': 3}) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/margin-loan-borrow-buy-sell-repay.md b/docs/ccxt/wiki/examples/py/margin-loan-borrow-buy-sell-repay.md new file mode 100644 index 0000000..654d91e --- /dev/null +++ b/docs/ccxt/wiki/examples/py/margin-loan-borrow-buy-sell-repay.md @@ -0,0 +1,97 @@ +- [Margin Loan Borrow Buy Sell Repay](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE # +# Note, this is just an example and might not yet work on other exchanges, which are being still unified. +async def example(): + # ########## user inputs ########## + exchange = getattr(ccxt, 'binance')({ + 'apiKey': 'xxx', + 'secret': 'xxx', + }) + symbol = 'BUSD/USDT' # set target symbol + margin_mode = 'isolated' # margin mode (cross or isolated) + collateral_coin = 'USDT' # which asset you want to use for margin-borrow collateral + borrow_coin = 'BUSD' # which coin to borrow + order_side = 'sell' # which side to trade + amount_to_trade = 14 # how many coins to sell + order_type = 'limit' # order type (can be market, limit or etc) + limit_price = 0.99 # price to sell at (set undefined/null/None if market-order) + margin_magnitude = 5 # target margin (aka 'leverage'). This might also be obtainable using other unified methods, but for example purposes, we set here manually + # ########## end of user-inputs ########## + # + # for example purposes, let's also check available balance at first + balance_margin = await exchange.fetch_balance({ + 'defaultType': 'margin', + 'marginMode': margin_mode, + }) # use `defaultType` because of temporary bug, otherwise, after several days, you can use `type` too. + # if we don't have enought coins, then we have to borrow at first + needed_amount_to_borrow = None # will be auto-set below + if amount_to_trade > balance_margin[symbol][borrow_coin]['free']: + needed_amount_to_borrow = amount_to_trade - balance_margin[symbol][borrow_coin]['free'] + print('hmm, I have only ', balance_margin[symbol][borrow_coin]['free'], ' ', borrow_coin, ' in margin balance, and still need additional ', needed_amount_to_borrow, ' to make an order. Lets borrow it.') + # To initate a borrow, at first, check if we have enough collateral (for this example, as we make a sell-short, we need '-1' to keep for collateral currency) + needed_collateral_amount = needed_amount_to_borrow / (margin_magnitude - 1) + # Check if we have any collateral to get permission for borrow + if balance_margin[symbol][collateral_coin]['free'] < needed_collateral_amount: + # If we don't have enough collateral, then let's try to transfer collateral-asset from spot-balance to margin-balance + print('hmm, I have only ', balance_margin[symbol][collateral_coin]['free'], ' in balance, but ', needed_collateral_amount, ' collateral is needed. I should transfer ', needed_collateral_amount, ' from spot') + # let's check if we have spot balance at all + balance_spot = await exchange.fetch_balance({ + 'type': 'spot', + }) + if exchange.parse_number(balance_spot[collateral_coin]['free']) < needed_collateral_amount: + print('hmm, I neither do have enough balance on spot - only ', balance_spot[collateral_coin]['free'], '. Script can not continue...') + return + else: + print('Transferring ', needed_collateral_amount, ' to margin account') + await exchange.transfer(collateral_coin, needed_collateral_amount, 'spot', margin_mode, { + 'symbol': symbol, + }) + # now, as we have enough margin collateral, initiate borrow + print('Initiating margin borrow of ', needed_amount_to_borrow, ' ', borrow_coin) + borrow_result = await exchange.borrow_margin(borrow_coin, needed_amount_to_borrow, symbol, { + 'marginMode': margin_mode, + }) + print('Submitting order.') + order = await exchange.create_order(symbol, order_type, order_side, amount_to_trade, limit_price, { + 'marginMode': margin_mode, + }) + print('Order was submitted !', order['id']) + # + # + # ... + # ... + # some time later, if you want to repay the loan back (like 'close the position')... + # ... + # ... + # + # + # set the "repay-back" amount (for this example snippet, this will be same amount that we borrowed above) + if needed_amount_to_borrow is not None: + amount_to_repay_back = needed_amount_to_borrow + # At first, you need to get back the borrowed coin, by making an opposide trade + print('Making purchase back of ', amount_to_repay_back, ' ', borrow_coin, ' to repay it back.') + purchase_back_price = 1.01 + order_back = await exchange.create_order(symbol, order_type, ('sell' if order_side == 'buy' else 'buy'), amount_to_repay_back, purchase_back_price, { + 'marginMode': margin_mode, + }) + print('Now, repaying the loan.') + repay_result = await exchange.repay_margin(borrow_coin, amount_to_repay_back, symbol, { + 'marginMode': margin_mode, + }) + print('finished.') + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/measure-latency.md b/docs/ccxt/wiki/examples/py/measure-latency.md new file mode 100644 index 0000000..e45f7c2 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/measure-latency.md @@ -0,0 +1,69 @@ +- [Measure Latency](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +def print_supported_exchanges(): + print('Supported exchanges:') + print(ccxt.exchanges) + + +def print_usage(): + print('Usage: python ', sys.argv[0], 'id', 'num_orders', 'symbol', 'side', 'amount', 'price') + print_supported_exchanges() + +def main(): + try: + id = sys.argv[1] # get exchange id from command line arguments + # check if the exchange is supported by ccxt + if id in ccxt.exchanges: + print('Instantiating', id) + # instantiate the exchange by id + exchange = getattr(ccxt, id)({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # you have to disable the rate limiter to measure the real latency + 'enableRateLimit': False, + }) + print('Loading', id, 'markets') + # load all markets from the exchange + markets = exchange.load_markets() + print('Loaded', id, 'markets') + num_orders = int(sys.argv[2]) + symbol = sys.argv[3] + side = sys.argv[4] + amount = float(sys.argv[5]) + price = float(sys.argv[6]) + if symbol in markets: + print('Testing', symbol) + results = [] + for i in range(0, num_orders): + timestamp = exchange.milliseconds() + order = exchange.create_order(symbol, 'limit', side, amount, price) + elapsed = exchange.milliseconds() - timestamp + canceled = exchange.cancel_order(order['id'], symbol) + results.append(elapsed) + print(elapsed, 'ms') + sum = exchange.sum(*results) + average = int(sum / len(results)) + print('Average:', average, 'ms') + else: + print('Exchange', id, ' not found') + print_usage() + except Exception as e: + print(type(e).__name__, str(e)) + print_usage() + +print('CCXT Version:', ccxt.__version__) +main() + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/minimal-2-lines.md b/docs/ccxt/wiki/examples/py/minimal-2-lines.md new file mode 100644 index 0000000..792f00f --- /dev/null +++ b/docs/ccxt/wiki/examples/py/minimal-2-lines.md @@ -0,0 +1,8 @@ +- [Minimal 2 Lines](./examples/py/) + + + ```python + import ccxt +print(ccxt.bitfinex().fetch_ticker('BTC/USDT')) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/multiple-subscriptions-watchXForSymbols.md b/docs/ccxt/wiki/examples/py/multiple-subscriptions-watchXForSymbols.md new file mode 100644 index 0000000..064ec27 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/multiple-subscriptions-watchXForSymbols.md @@ -0,0 +1,59 @@ +- [Multiple Subscriptions Watchxforsymbols](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import asyncio +import os +from random import randint +import sys +from pprint import pprint + + +import ccxt.pro as ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.binance({}) + + +async def watch_multiple_trades(symbols): + while True: + trades = await exchange.watch_trades_for_symbols(symbols) + print(f'trade: {trades[0]["symbol"], trades[0]["price"]}') + + +async def watch_multiple_orderbooks(symbols): + while True: + orderbooks = await exchange.watch_order_book_for_symbols(symbols) + print(f'orderbook bid: {orderbooks["symbol"]}{orderbooks["bids"][0]}') + + + +async def watch_multiple_ohlcv(symbols): + while True: + ohlcv = await exchange.watch_ohlcv_for_symbols(symbols) + print(f'ohlcv: {ohlcv}') + + + +async def example_1(): + + await asyncio.gather( + watch_multiple_trades(['BTC/USDT', 'ADA/USDT', 'ETH/USDT']), + watch_multiple_orderbooks(['BTC/USDT', 'ETH/USDT']), + watch_multiple_ohlcv([['BTC/USDT', '1m'], ['LTC/USDT', '1m']]), + ) +async def main(): + try: + await example_1() + except Exception as e: + print(e) + await exchange.close() + + +asyncio.run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/normalize-sparse-candle-timestamps.md b/docs/ccxt/wiki/examples/py/normalize-sparse-candle-timestamps.md new file mode 100644 index 0000000..2580026 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/normalize-sparse-candle-timestamps.md @@ -0,0 +1,36 @@ +- [Normalize Sparse Candle Timestamps](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + +exchange = ccxt.binance() + +symbol = 'ETH/BTC' +timeframe = '1h' + +candles = exchange.fetch_ohlcv(symbol, timeframe) + +# timeframe duration in seconds +duration = exchange.parse_timeframe(timeframe) + +# timeframe duration in milliseconds +duration *= 1000 + +pprint([[ + exchange.iso8601(int(round(candle[0] / duration)) * duration), + candle[1], # o + candle[2], # h + candle[3], # l + candle[4], # c + candle[5] # v +] for candle in candles]) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/okx-fetch-all-my-trades.md b/docs/ccxt/wiki/examples/py/okx-fetch-all-my-trades.md new file mode 100644 index 0000000..1bfd074 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/okx-fetch-all-my-trades.md @@ -0,0 +1,67 @@ +- [Okx Fetch All My Trades](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + + +# make sure your version is the latest +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', +}) + + +markets = exchange.load_markets () + +exchange.verbose = True # uncomment for debugging + +all_trades = {} +symbol = None +since = None +limit = 200 +after = None + +while True: + print('------------------------------------------------------------------') + params = {} + if after: + params['after'] = after + trades = exchange.fetch_my_trades(symbol, since, limit, params) + if len(trades): + first_trade = trades[0] + last_trade = trades[len(trades) - 1] + after = first_trade['info']['billId'] + print('Fetched', len(trades), 'trades from', first_trade['datetime'], 'till', last_trade['datetime']) + fetched_new_trades = False + for trade in trades: + trade_id = trade['id'] + if trade_id not in all_trades: + fetched_new_trades = True + all_trades[trade_id] = trade + if not fetched_new_trades: + print('Done') + break + else: + print('Done') + break + + +all_trades = list(all_trades.values()) +all_trades = exchange.sort_by(all_trades, 'timestamp') + +print('Fetched', len(all_trades), 'trades') +for i in range(0, len(all_trades)): + trade = all_trades[i] + print(i, trade['id'], trade['datetime'], trade['amount']) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/okx-fetch-closed-orders-pagenumber-pagination.md b/docs/ccxt/wiki/examples/py/okx-fetch-closed-orders-pagenumber-pagination.md new file mode 100644 index 0000000..1855d68 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/okx-fetch-closed-orders-pagenumber-pagination.md @@ -0,0 +1,64 @@ +- [Okx Fetch Closed Orders Pagenumber Pagination](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +''' +This is an example of pagenumber-based pagination as described here: +https://github.com/ccxt/ccxt/wiki/Manual#pagenumber-based-cursor-pagination +''' + +symbol = 'ETH/BTC' + +exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', # put your values here + 'secret': 'YOUR_SECRET', +}) + + +def get_all_closed_orders_since_to(exchange, symbol, since, to): + result = [] + page = 1 + min_timestamp = to + print('Fetching all orders since', exchange.iso8601(since), since) + while min_timestamp > since: + try: + print('Fetching page', page) + params = {'current_page': page} + orders = exchange.fetch_closed_orders(symbol, since, None, params) + if len(orders): + min_timestamp = orders[0]['timestamp'] + print('Fetched', len(orders), 'orders, the oldest order as of', exchange.iso8601(min_timestamp), min_timestamp) + result += orders + page += 1 + else: + min_timestamp = since + except ccxt.ExchangeNotAvailable as e: + pass # retry + return result + + +one_day = 24 * 60 * 60 * 1000 # in milliseconds +since = exchange.parse8601('2018-11-25T00:00:00') # 0:00 AM UTC in milliseconds +# or +since = exchange.milliseconds() - one_day # last 24 hours in milliseconds + +to = since + one_day + +all_orders = get_all_closed_orders_since_to(exchange, symbol, since, to) + +all_orders = exchange.sort_by(all_orders, 'timestamp') + +print('Fetched all', len(all_orders), 'orders') +print('The oldest order as of', exchange.iso8601(all_orders[0]['timestamp'])) +print('The youngest order as of', exchange.iso8601(all_orders[-1]['timestamp'])) +print('Done.') + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/okx-position-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/py/okx-position-takeprofit-stoploss.md new file mode 100644 index 0000000..50ed831 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/okx-position-takeprofit-stoploss.md @@ -0,0 +1,112 @@ +- [Okx Position Takeprofit Stoploss](./examples/py/) + + + ```python + import os +import re +import sys +from pprint import pprint +import ccxt +print('CCXT Version:', ccxt.__version__) +exchange = ccxt.okx({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + "password": "YOUR_API_PASSWORD", +}) + +markets = exchange.load_markets() + +symbol = 'ETH/USDT:USDT' + +market = exchange.market(symbol) + +print('-----------------------------------------------------------------------') + +balance = exchange.fetch_free_balance() +print('Available balance:') +pprint(balance) + +print('-----------------------------------------------------------------------') + +ticker = exchange.fetch_ticker(symbol) +print(symbol, 'ticker:') +pprint(ticker) + +print('-----------------------------------------------------------------------') + +side = 'buy' # set it to 'buy' for a long position, 'sell' for a short position +order_type = 'limit' # set it to 'market' or 'limit' +amount = 1 # how many contracts + +last_price = ticker['last'] +ask_price = ticker['ask'] +bid_price = ticker['bid'] + +# None for market orders or a limit price for a limit order +price = None if order_type == 'market' else ((ask_price * 1.001) if side == 'sell' else (bid_price * 0.999)) + +# the following line is not necessary, it's here just for print readability below +price = float(exchange.price_to_precision(symbol, price)) + +# set stop-loss trigger price to last_price - 1% for a long position +# set stop-loss trigger price to last_price + 1% for a short position +stop_loss_trigger_price = (last_price if order_type == 'market' else price) * (0.999 if side == 'buy' else 1.001) + +# stop-loss limit price at i.e. -1% from trigger price for a long position +# stop-loss limit price at i.e. +1% from trigger price for a short position +stop_loss_limit_price = stop_loss_trigger_price * (1.001 if side == 'buy' else 0.999) + +# set take-profit trigger price to last_price + 1% for a long position +# set take-profit trigger price to last_price - 1% for a short position +take_profit_trigger_price = (last_price if order_type == 'market' else price) * (1.001 if side == 'buy' else 0.999) + +# take-profit limit price at i.e. -1% from trigger price for a long position +# take-profit limit price at i.e. +1% from trigger price for a short position +take_profit_limit_price = take_profit_trigger_price * (1.001 if side == 'buy' else 0.999) + +# the following four lines are not necessary, they're here just for pprint() readability +take_profit_trigger_price = float(exchange.price_to_precision(symbol, take_profit_trigger_price)) +take_profit_limit_price = float(exchange.price_to_precision(symbol, take_profit_limit_price)) +stop_loss_trigger_price = float(exchange.price_to_precision(symbol, stop_loss_trigger_price)) +stop_loss_limit_price = float(exchange.price_to_precision(symbol, stop_loss_limit_price)) + +params = { + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + # set a price for a stop loss limit order + # or leave commented for a stop loss market order + # 'price': stop_loss_limit_price, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + # set a price for a take profit limit order + # or leave commented for a take profit market order + # 'price': take_profit_limit_price, + } +} + +position_value = market['contractSize'] * amount + +print('Going to open a', 'long' if side == 'buy' else 'short', 'position', + 'for', amount, 'contracts worth', position_value, market['base'], '~', position_value * last_price, market['settle']) +if order_type == 'market': + print('with a market', side, 'order at market price using the following params:') +else: + print('with a limit', side, 'order at price', price, 'using the following params:') +pprint(params) + +print('-----------------------------------------------------------------------') + +# exchange.verbose = True # uncomment for debugging purposes if necessary + +try: + created_order = exchange.create_order(symbol, order_type, side, amount, price, params) + pprint(created_order) + # uncomment the following lines to cancel a limit order + # if order_type == 'limit': + # canceled_order = exchange.cancel_order(created_order['id'], symbol) + # pprint(canceled_order) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/okx-transfer.md b/docs/ccxt/wiki/examples/py/okx-transfer.md new file mode 100644 index 0000000..86ca68f --- /dev/null +++ b/docs/ccxt/wiki/examples/py/okx-transfer.md @@ -0,0 +1,44 @@ +- [Okx Transfer](./examples/py/) + + + ```python + import ccxt +from pprint import pprint + + +# make sure your version is the latest +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.okx({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + 'password': 'YOUR_API_PASSWORD', +}) + +exchange.load_markets() + +# https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods +# https://github.com/ccxt/ccxt/wiki/Manual#passing-parameters-to-api-methods +# uncomment to see all available methods +# pprint(dir(exchange)) + +code = 'BTC' +currency = exchange.currency(code) + + +try: + response = exchange.account_post_transfer({ + 'currency': currency['id'], + 'amount': '0.1', + # 'type': '0', # 0 transfer between accounts, 1 main to sub_account, 2 sub_account to main + 'from': '6', # 1 spot, 3 futures, 5 margin, 6 funding account, 9 swap, 12 option + 'to': '1', # 1 spot, 3 futures, 5 margin, 6 funding account, 9 swap, 12 option + # 'sub_account': 'name_of_sub_account', # when type is 1 or 2 sub_account is required + # 'instrument_id': 'String', # margin trading pair of token or underlying of USDT-margined futures transferred out, such as: btc-usdt. Limited to trading pairs available for margin trading or underlying of enabled futures trading. + # 'to_instrument_id': 'String' # margin trading pair of token or underlying of USDT-margined futures transferred in, such as: btc-usdt. Limited to trading pairs available for margin trading or underlying of enabled futures trading. + }) + pprint(response) +except Exception as e: + print(type(e).__name__, str(e)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/order-book-extra-level-depth-param.md b/docs/ccxt/wiki/examples/py/order-book-extra-level-depth-param.md new file mode 100644 index 0000000..801650c --- /dev/null +++ b/docs/ccxt/wiki/examples/py/order-book-extra-level-depth-param.md @@ -0,0 +1,17 @@ +- [Order Book Extra Level Depth Param](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +# return up to ten bidasks on each side of the order book stack +limit = 10 +print(ccxt.cex().fetch_order_book('BTC/USD', limit)) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/phemex-create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/py/phemex-create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..71ab1c5 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/phemex-create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,56 @@ +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/py/) + + + ```python + import os +import sys + +# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: +# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code + +# AUTO-TRANSPILE #async def example(): + exchange = ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }) + symbol = 'XRP/USDT:USDT' + side = 'buy' # set it to 'buy' for a long position, 'sell' for a short position + order_type = 'limit' # set it to 'market' or 'limit' + amount = 1 # how many contracts + price = 0.5 # set a price at your desired level + # take profit and stop loss prices and types + take_profit_trigger_price = 0.6 + stop_loss_trigger_price = 0.4 + take_profit_limit_price = 0.7 + stop_loss_limit_price = 0.3 + await exchange.load_markets() + # when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + params = { + 'posSide': 'Long', + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + 'type': 'limit', + 'price': stop_loss_limit_price, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + 'type': 'limit', + 'price': take_profit_limit_price, + }, + } + print('-----------------------------------------------------------------------') + try: + created_order = await exchange.create_order(symbol, order_type, side, amount, price, params) + print('Created an order', created_order) + # Fetch all your open orders for this symbol + all_open_orders = await exchange.fetch_open_orders(symbol) + print('Fetched all your orders for this symbol', all_open_orders) + except Exception as e: + print(str(e)) + + await exchange.close() + + +asyncio.run(example()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/phemex-create-stop-order.md b/docs/ccxt/wiki/examples/py/phemex-create-stop-order.md new file mode 100644 index 0000000..1c54cf8 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/phemex-create-stop-order.md @@ -0,0 +1,46 @@ +- [Phemex Create Stop Order](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys + + +import ccxt # noqa: E402 + +exchange = ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', +}) + +# exchange.set_sandbox_mode(True) + +# Example 1: Creating stop-market order +symbol = 'LTC/USDT' +type = 'market' +side = 'buy' +amount = 0.5 + +params = { + 'stopPrice': 50, +} + +stop_market = exchange.create_order(symbol, type, side, amount, None, params) +print(stop_market) + +# Example 2: Create stop-limit order +symbol = 'LTC/USDT' +type = 'limit' +side = 'buy' +amount = 0.5 +price = 70 + +params = { + 'stopPrice': 50, +} + +stop_limit = exchange.create_order(symbol, type, side, amount, price, params) +print(stop_limit) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/phemex-leverage-orders.md b/docs/ccxt/wiki/examples/py/phemex-leverage-orders.md new file mode 100644 index 0000000..2cfdb63 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/phemex-leverage-orders.md @@ -0,0 +1,46 @@ +- [Phemex Leverage Orders](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', # testnet keys if using the testnet sandbox + 'secret': 'YOUR_SECRET', # testnet keys if using the testnet sandbox + 'options': { + 'defaultType': 'swap', + }, +}) + +# exchange.set_sandbox_mode(True) # uncomment to use the testnet sandbox + +markets = exchange.load_markets() + +amount = 5 +symbol = 'BTC/USD:USD' + +# Change leverage to the desired value +leverageResponse = exchange.set_leverage(5, symbol) + +# Opening a pending contract (limit) order +order = exchange.create_order(symbol, 'market', 'buy', amount) +print(order) + +# Canceling pending contract +closingOrder = exchange.create_order(symbol, 'market', 'sell', amount) +pprint(closingOrder) + +# Reset leverage to 1 +leverageResponse = exchange.set_leverage(1, symbol) +print(leverageResponse) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/phemex-open-cancel-close-positions.md b/docs/ccxt/wiki/examples/py/phemex-open-cancel-close-positions.md new file mode 100644 index 0000000..0ec59fe --- /dev/null +++ b/docs/ccxt/wiki/examples/py/phemex-open-cancel-close-positions.md @@ -0,0 +1,68 @@ +- [Phemex Open Cancel Close Positions](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', # testnet keys if using the testnet sandbox + 'secret': 'YOUR_SECRET', # testnet keys if using the testnet sandbox + 'options': { + 'defaultType': 'swap', + }, +}) + +# exchange.set_sandbox_mode(True) # uncomment to use the testnet sandbox + +markets = exchange.load_markets() + +amount = 20 +symbol = 'BTC/USD:USD' + +# Opening and Canceling a pending contract (limit) order +order = exchange.create_order(symbol, 'limit', 'buy', amount, '20000') +response = exchange.cancel_order(order['id'], symbol) +pprint(response) + +# Opening and Canceling a pending contract (stop-market) order +stopMarketOrder = exchange.create_order(symbol, 'Stop', 'buy', amount, None, {'stopPx': 70000}) # default triggerType is ByMarkPrice +stopMarketResponse = exchange.cancel_order(stopMarketOrder['id'], symbol) +pprint(stopMarketResponse) + +# Opening and Canceling a pending contract (stop-limit) order +stopLimitOrder = exchange.create_order(symbol, 'StopLimit', 'buy', amount, 20000, {'stopPx': 70000, "triggerType": "ByLastPrice"}) +stopLimitResponse = exchange.cancel_order(stopLimitOrder['id'], symbol) +pprint(stopLimitResponse) + +# Opening and exiting a filled contract position by issuing the exact same order but in the opposite direction +order = exchange.create_order(symbol, 'market', 'buy', amount) +# closing the previous position by issuing the exact same order but in the opposite direction +# with reduceOnly option to prevent an unwanted exposure increase +orderClose = exchange.create_order(symbol, 'market', 'sell', amount, None, {'reduceOnly': True}) + +# Opening a contract position (market order) with TakeProfit and StopLoss prices defined +order = exchange.create_order(symbol, 'market', 'buy', amount, None, {'stopLossPrice': 5000, 'takeProfitPrice': 100000}) + +# Opening a contract trailing (stop-limit) order +ethSymbol = 'ETH/USD:USD' +ethPrice = 1000 +stopPrice = 5000 +trailingOrder = exchange.create_order(symbol = ethSymbol, type = 'StopLimit', side = 'buy', amount = 1, price = ethPrice, params = { + 'stopPrice': stopPrice, + 'ordType': 'StopLimit', + 'pegPriceType': 'TrailingStopPeg', + 'pegOffsetValueEp': 10000, # needs to be scaled + } # default triggerType is ByMarkPrice +) +pprint(trailingOrder) +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/phemex-perpetual-balance.md b/docs/ccxt/wiki/examples/py/phemex-perpetual-balance.md new file mode 100644 index 0000000..e57edd5 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/phemex-perpetual-balance.md @@ -0,0 +1,34 @@ +- [Phemex Perpetual Balance](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +from asyncio import run +import os +import sys +from pprint import pprint + + +import ccxt.async_support as ccxt # noqa: E402 + +print('CCXT Version:', ccxt.__version__) + +async def main(): + exchange = ccxt.phemex({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_SECRET", + 'options': { 'defaultType': 'swap' } + }) + markets = await exchange.load_markets() + # exchange.verbose = True # uncomment for debugging purposes if necessary + usd_balance = await exchange.fetch_balance({'code': 'USD'}) + btc_balance = await exchange.fetch_balance({'code': 'BTC'}) + balance = exchange.deep_extend(usd_balance, btc_balance) + pprint(balance) + await exchange.close() + + +run(main()) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/phemex-positions.md b/docs/ccxt/wiki/examples/py/phemex-positions.md new file mode 100644 index 0000000..63ad62f --- /dev/null +++ b/docs/ccxt/wiki/examples/py/phemex-positions.md @@ -0,0 +1,58 @@ +- [Phemex Positions](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 + + +print('CCXT Version:', ccxt.__version__) + +exchange = ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', # testnet keys if using the testnet sandbox + 'secret': 'YOUR_SECRET', # testnet keys if using the testnet sandbox + 'options': { + 'defaultType': 'swap', + }, +}) + +# exchange.set_sandbox_mode(True) # uncomment to use the testnet sandbox + +markets = exchange.load_markets() + +# example 1 +positions = exchange.fetch_positions(None, {'code':'BTC'}) +pprint(positions) + +print('------------------------------------------------------------') + +# example 2 +positions = exchange.fetch_positions(None, {'currency':'BTC'}) +pprint(positions) + +print('------------------------------------------------------------') + +# example 3 +balance = exchange.fetch_balance({'code':'BTC'}) +pprint(balance['info']['data']['positions']) + +print('------------------------------------------------------------') + +# example 4 +balance = exchange.fetch_balance({'currency':'BTC'}) +pprint(balance['info']['data']['positions']) + +print('------------------------------------------------------------') + +# example 5 +# https://github.com/ccxt/ccxt/wiki/Manual#implicit-api-methods +response = exchange.private_get_accounts_accountpositions({'currency': 'BTC'}) +pprint(response['data']['positions']) + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/phemex-transfer.md b/docs/ccxt/wiki/examples/py/phemex-transfer.md new file mode 100644 index 0000000..a23481d --- /dev/null +++ b/docs/ccxt/wiki/examples/py/phemex-transfer.md @@ -0,0 +1,106 @@ +- [Phemex Transfer](./examples/py/) + + + ```python + # -*- coding: utf-8 -*- + +import os +import sys +from pprint import pprint + + +import ccxt # noqa: E402 +print('CCXT Version:', ccxt.__version__) + +# Example 1: Transfer between the spot main-account and swap main-account +def main_account_transfer(): + exchange = ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + code = 'USDT' + amount = 10 + fromAccount = 'spot' + toAccount = 'swap' + params = {} + + try: + transfer = exchange.transfer(code, amount, fromAccount, toAccount, params=params) + pprint(transfer) + except Exception as err: + print(err) + + +# Example 2: Transfer between main-account and sub-account (Requires the main and sub-account UID's found on the account/sub-accounts page on Phemex) +def transfer_between_main_and_sub_accounts(): + exchange = ccxt.phemex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + # 'verbose': True, # for debug output + }) + code = 'USDT' + amount = 10 + fromAccount = '4148428' + toAccount = '4663243' + # set the bizType to 'SPOT' or 'PERPETUAL', default is 'SPOT' + bizType = 'PERPETUAL' + params = { + 'bizType': bizType + } + + try: + transfer = exchange.transfer(code, amount, fromAccount, toAccount, params=params) + pprint(transfer) + except Exception as err: + print(err) + + +# Example 3: Transfer between the spot sub-account and swap sub-account (Requires a sub-account API key and secret) +def sub_account_transfer(): + exchange = ccxt.phemex({ + 'apiKey': 'YOUR_SUB_ACCOUNT_API_KEY', + 'secret': 'YOUR_SUB_ACCOUNT_SECRET', + # 'verbose': True, # for debug output + }) + code = 'USDT' + amount = 10 + fromAccount = 'spot' + toAccount = 'swap' + params = {} + + try: + transfer = exchange.transfer(code, amount, fromAccount, toAccount, params=params) + pprint(transfer) + except Exception as err: + print(err) + + +# Example 4: Use the Implicit API to transfer from swap sub-account to swap main-account +def sub_swap_to_main_swap(): + exchange = ccxt.phemex({ + 'apiKey': 'YOUR_SUB_ACCOUNT_API_KEY', + 'secret': 'YOUR_SUB_ACCOUNT_SECRET', + # 'verbose': True, # for debug output + }) + code = 'USDT' + amount = 10 + convertedAmount = exchange.toEv(amount) + + try: + response = exchange.privatePostAssetsFuturesSubAccountsTransfer({ + 'amountEv': convertedAmount, + 'currency': code, + }) + pprint(response) + except Exception as e: + print('privatePostAssetsFuturesSubAccountsTransfer() failed') + print(e) + + +main_account_transfer() +# transfer_between_main_and_sub_accounts() +# sub_account_transfer() +# sub_swap_to_main_swap() + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/py/playing_with_ccxt_example.md b/docs/ccxt/wiki/examples/py/playing_with_ccxt_example.md new file mode 100644 index 0000000..5038301 --- /dev/null +++ b/docs/ccxt/wiki/examples/py/playing_with_ccxt_example.md @@ -0,0 +1,227 @@ +- [Playing_with_ccxt_example](./examples/py/) + + + ```python + { + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "metadata": { + "id": "hTaqBmW-0RKi" + }, + "cell_type": "markdown", + "source": [ + "# Install CCXT" + ] + }, + { + "metadata": { + "id": "Ae8XNG1oSAI0", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4612bd2c-611d-4e81-f57e-e3c50a384a17" + }, + "cell_type": "code", + "source": [ + "!pip install ccxt" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "Requirement already satisfied: ccxt in /usr/local/lib/python3.10/dist-packages (4.1.51)\n", + "Requirement already satisfied: setuptools>=60.9.0 in /usr/local/lib/python3.10/dist-packages (from ccxt) (67.7.2)\n", + "Requirement already satisfied: certifi>=2018.1.18 in /usr/local/lib/python3.10/dist-packages (from ccxt) (2023.7.22)\n", + "Requirement already satisfied: requests>=2.18.4 in /usr/local/lib/python3.10/dist-packages (from ccxt) (2.31.0)\n", + "Requirement already satisfied: cryptography>=2.6.1 in /usr/local/lib/python3.10/dist-packages (from ccxt) (41.0.5)\n", + "Requirement already satisfied: aiohttp>=3.8 in /usr/local/lib/python3.10/dist-packages (from ccxt) (3.8.6)\n", + "Requirement already satisfied: aiodns>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from ccxt) (3.1.1)\n", + "Requirement already satisfied: yarl>=1.7.2 in /usr/local/lib/python3.10/dist-packages (from ccxt) (1.9.2)\n", + "Requirement already satisfied: pycares>=4.0.0 in /usr/local/lib/python3.10/dist-packages (from aiodns>=1.1.1->ccxt) (4.4.0)\n", + "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp>=3.8->ccxt) (23.1.0)\n", + "Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp>=3.8->ccxt) (3.3.2)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp>=3.8->ccxt) (6.0.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/local/lib/python3.10/dist-packages (from aiohttp>=3.8->ccxt) (4.0.3)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp>=3.8->ccxt) (1.4.0)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp>=3.8->ccxt) (1.3.1)\n", + "Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.10/dist-packages (from cryptography>=2.6.1->ccxt) (1.16.0)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.18.4->ccxt) (3.4)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.18.4->ccxt) (2.0.7)\n", + "Requirement already satisfied: pycparser in /usr/local/lib/python3.10/dist-packages (from cffi>=1.12->cryptography>=2.6.1->ccxt) (2.21)\n" + ] + } + ] + }, + { + "metadata": { + "id": "TLmyBCzc0WQ7" + }, + "cell_type": "markdown", + "source": [ + "# Load exchange" + ] + }, + { + "metadata": { + "id": "5QdxmAKzx5Pz", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "704611f3-e48b-4f37-cf9b-58e66373fc8c" + }, + "cell_type": "code", + "source": [ + "import ccxt\n", + "\n", + "# Load Exchange\n", + "exchange = ccxt.gate ()\n", + "exchange.load_markets ()\n", + "\n", + "print ('exchange: %d markets loaded!' % len (exchange.markets))" + ], + "execution_count": 5, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "exchange: 4409 markets loaded!\n" + ] + } + ] + }, + { + "metadata": { + "id": "NQgGUlxY45-o" + }, + "cell_type": "markdown", + "source": [ + "# Set Up The Chart Drawing" + ] + }, + { + "metadata": { + "id": "WJocH02-44V2", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "c0a2365b-af59-4ac2-b11e-c482df5ae351" + }, + "cell_type": "code", + "source": [ + "# Enables 2x resolution for Retina displays\n", + "%config InlineBackend.figure_format = 'retina'\n", + "\n", + "# This is the library we will use for chart drawing\n", + "import matplotlib.pyplot as plt\n", + "\n", + "# Configure the look\n", + "plt.style.use ('seaborn-white')\n", + "plt.rcParams[\"figure.figsize\"] = [15,6]" + ], + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "name": "stderr", + "text": [ + ":8: MatplotlibDeprecationWarning: The seaborn styles shipped by Matplotlib are deprecated since 3.6, as they no longer correspond to the styles shipped by seaborn. However, they will remain available as 'seaborn-v0_8- + +# [<-](Examples?id=typescript) + +- [Benchmark](./examples/ts/benchmark.md) + +- [Build Ohlcv Bars](./examples/ts/build-ohlcv-bars.md) + +- [Compare Two Exchanges Capabilities](./examples/ts/compare-two-exchanges-capabilities.md) + +- [Create Order Position With Takeprofit Stoploss](./examples/ts/create-order-position-with-takeprofit-stoploss.md) + +- [Create Order Ws Example](./examples/ts/create-order-ws-example.md) + +- [Create Orders Example](./examples/ts/create-orders-example.md) + +- [Create Trailing Amount Order](./examples/ts/create-trailing-amount-order.md) + +- [Create Trailing Percent Order](./examples/ts/create-trailing-percent-order.md) + +- [Custom Proxy Agent For Js](./examples/ts/custom-proxy-agent-for-js.md) + +- [Fetch First Ohlcv Timestamp](./examples/ts/fetch-first-ohlcv-timestamp.md) + +- [📂 Fetch Futures](https://github.com/ccxt/ccxt/tree/master/./examples/ts/fetch-futures) + +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/ts/fetch-ohlcv-many-exchanges-continuosly.md) + +- [Fetch Ohlcv](./examples/ts/fetch-ohlcv.md) + +- [📂 Fetch Tickers](https://github.com/ccxt/ccxt/tree/master/./examples/ts/fetch-tickers) + +- [Hibachi Example](./examples/ts/hibachi-example.md) + +- [How To Import One Exchange Esm](./examples/ts/how-to-import-one-exchange-esm.md) + +- [Kraken Create And Close Position](./examples/ts/kraken-create-and-close-position.md) + +- [Margin Loan Borrow Buy Sell Repay](./examples/ts/margin-loan-borrow-buy-sell-repay.md) + +- [📂 Nextjs Page Router](https://github.com/ccxt/ccxt/tree/master/./examples/ts/nextjs-page-router) + +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/ts/phemex-create-order-position-with-takeprofit-stoploss.md) + +- [Proxy Usage](./examples/ts/proxy-usage.md) + +- [Sample Local Proxy Server With Cors](./examples/ts/sample-local-proxy-server-with-cors.md) + +- [Watch Ohlcv For Symbols](./examples/ts/watch-OHLCV-For-Symbols.md) + +- [Watch Ohlcv](./examples/ts/watch-OHLCV.md) + +- [Watch Orderbook For Symbols](./examples/ts/watch-OrderBook-For-Symbols.md) + +- [Watch Trades For Symbols](./examples/ts/watch-Trades-For-Symbols.md) + +- [Watch Tickers](./examples/ts/watch-tickers.md) + +- [Watchpositions Many Exchanges Continuosly](./examples/ts/watchPositions-many-exchanges-continuosly.md) + +- [Watchpositions](./examples/ts/watchPositions.md) + +- [Watchpositionsforsymbols](./examples/ts/watchPositionsForSymbols.md) + diff --git a/docs/ccxt/wiki/examples/ts/benchmark.md b/docs/ccxt/wiki/examples/ts/benchmark.md new file mode 100644 index 0000000..fc89622 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/benchmark.md @@ -0,0 +1,140 @@ +- [Benchmark](./examples/ts/) + + + ```javascript + import { spawn } from 'child_process'; +import asTable from 'as-table'; +import ccxt, { version } from '../../js/ccxt.js'; + +interface Stats { + min: number; + average: number; + max: number; + median: number; + iterations: number; +} + +interface Test { + language: string; + method: string; + command: string; +} + +interface Benchmark extends Omit, Stats { } + +const stats = (times: number[]): Stats => { + // calculate statistics + const sum = times.reduce ((a, b) => a + b, 0); + const avg = Math.round (sum / times.length); + const min = Math.min (...times); + const max = Math.max (...times); + times.sort ((a, b) => a - b); + const median = times.length % 2 === 0 ? (times[times.length / 2 - 1] + times[times.length / 2]) / 2 : times[Math.floor (times.length / 2)]; + return { min, 'average': avg, max, median, 'iterations': times.length }; +}; + +async function benchmark (exchangeId, method, args, verbose = false, minIterations = 10, argsv = '') { + const exchange = new ccxt.pro[exchangeId] ({}); + const languages = [ 'js', 'py', 'php', 'cs' ]; + const commands: Test[] = languages.map ((language) => ({ + 'language': language, + 'method': method, + 'command': `npm run cli.${language} ${exchangeId} ${method} ${args.join (' ')} -- ${argsv} --poll`, + })); + const wsMethod = method + 'Ws'; + if (exchange.has[wsMethod]) { + const wsCommands: Test[] = languages.map ((language) => ({ + 'language': language, + 'method': wsMethod, + 'command': `npm run cli.${language} ${exchangeId} ${wsMethod} ${args.join (' ')} -- ${argsv} --poll`, + })); + commands.push (...wsCommands); + } + const regex = /iteration (\d+) passed in (\d+) ms/g; + + async function runCommand (command: string) { + if (verbose) { + console.log (exchange.iso8601 (new Date ().getTime ()), ' running command:', command); + } + return new Promise<{ times: number[] }> ((resolve, reject) => { + const [ cmd, ...args ] = command.split (' '); + + const child = spawn (cmd, args); + const matches = []; + const language = command.slice (8, 15); + child.stdout.on ('data', (data: Buffer) => { + const message = data.toString (); + matches.push (...Array.from (message.matchAll (regex))); + const match = matches[matches.length - 1]; + + if (match && match[1] && match[2]) { + const iteration = parseInt (match[1]); + const time = parseInt (match[2]); + + if (iteration <= minIterations) { + if (verbose) { + console.log (exchange.iso8601 (new Date ().getTime ()), `${language} iteration ${iteration} passed in ${time} ms`); + } + } else { + const times = matches.map ((m) => parseInt (m[2])); + child.kill (); + if (verbose) { + console.log (exchange.iso8601 (new Date ().getTime ()), `killed process - ${language} iteration ${iteration} passed in ${time} ms`); + } + resolve ({ times }); + } + } + }); + + child.stderr.on ('data', (data: Buffer) => { + const message = data.toString (); + console.error (exchange.iso8601 (new Date ().getTime ()), `command ${command} failed. stderr: ${message}`); + const times = matches.map ((m) => parseInt (m[2])); + resolve ({ times }); + }); + + child.on ('close', (code: number) => { + const times = matches.map ((m) => parseInt (m[2])); + resolve ({ times }); + console.log (exchange.iso8601 (new Date ().getTime ()), `${language} child process exited with code ${code}`); + }); + + child.on ('error', (err) => { + console.error (exchange.iso8601 (new Date ().getTime ()), `command ${command} failed. error: ${err}`); + reject (err); + }); + }); + } + + const benchmarks: Benchmark[] = []; + const results = await Promise.all (commands.map ((c) => runCommand (c.command))); + for (let i = 0; i < results.length; i++) { + const result = results[i]; + benchmarks.push ({ 'language': commands[i].language, 'method': commands[i].method, ...stats (result.times) }); + } + if (verbose) { + const rawResults = results.map ((r, i) => ({ 'language': commands[i].language, 'method': commands[i].method, ...stats (r.times), 'times': r.times })); + console.log (rawResults); + } + console.log (asTable (benchmarks)); +} + +const [ _, , exchangeId, methodName, ...params ] = process.argv.filter ((x) => !x.startsWith ('--')); +const verbose = process.argv.includes ('--verbose'); +const minIterationsString = process.argv.find ((x) => x.startsWith ('--min-iterations='))?.slice (18); +const minIterations = minIterationsString ? parseInt (minIterationsString) : 10; +const argsv = process.argv.filter ((x) => x.startsWith ('--') && !x.startsWith ('--min-iterations')).join (' '); + + +console.log ((new Date ()).toISOString ()); +console.log ('Node.js:', process.version); +console.log ('CCXT v' + version); + +const start = new Date ().getTime (); +await benchmark (exchangeId, methodName, params, verbose, minIterations, argsv); +const end = new Date ().getTime (); + +console.log ((new Date ().toISOString ()), 'Total time:', end - start, 'ms'); +process.exit (0); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/build-ohlcv-bars.md b/docs/ccxt/wiki/examples/ts/build-ohlcv-bars.md new file mode 100644 index 0000000..09cd715 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/build-ohlcv-bars.md @@ -0,0 +1,59 @@ +- [Build Ohlcv Bars](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// Bulding OHLCV array from trades (executions) data is a bit tricky. For example, if you want to build 100 ohlcv bars of 1-minute timeframe, then you have to fetch the 100 minutes of trading data. So, higher timeframe bars require more trading data (i.e. building 100 bars of 1-day timeframe OHLCV would require massive amount of trading data, which might not be desirable for user, because of data-usage rate limits) + +async function example_with_fetch_trades () { + const exch = new ccxt.binance ({}); + const timeframe = '1m'; + const symbol = 'OGN/USDT'; + const since = exch.milliseconds () - 1000 * 60 * 30; // last 30 mins + const limit = 1000; + const trades = await exch.fetchTrades (symbol, since, limit); + const generatedBars = exch.buildOHLCVC (trades, timeframe, since, limit); + // you can ignore 6th index ("count" field) from ohlcv entries, which is not part of OHLCV standard structure and is just added internally by `buildOHLCVC` method + console.log ('[REST] Constructed', generatedBars.length, 'bars from trades: ', generatedBars); +} + +async function example_with_watch_trades () { + const exch = new ccxt.pro.binance ({}); + const timeframe = '1m'; + const symbol = 'DOGE/USDT'; + const limit = 1000; + const since = exch.milliseconds () - 10 * 60 * 1000 * 1000; // last 10 hrs + let collectedTrades = []; + const collectedBars = []; + while (true) { + const wsTrades = await exch.watchTrades (symbol, since, limit, {}); + collectedTrades = collectedTrades.concat (wsTrades); + const generatedBars = exch.buildOHLCVC (collectedTrades, timeframe, since, limit); + // Note: first bar would be partially constructed bar and its 'open' & 'high' & 'low' prices (except 'close' price) would probably have different values compared to real bar on chart, because the first obtained trade timestamp might be somewhere in the middle of timeframe period, so the pre-period would be missing because we would not have trades data. To fix that, you can get older data with `fetchTrades` to fill up bars till start bar. + for (let i = 0; i < generatedBars.length; i++) { + const bar = generatedBars[i]; + const barTimestamp = bar[0]; + const collectedBarsLength = collectedBars.length; + const lastCollectedBarTimestamp = collectedBarsLength > 0 ? collectedBars[collectedBarsLength - 1][0] : 0; + if (barTimestamp === lastCollectedBarTimestamp) { + // if timestamps are same, just updarte the last bar + collectedBars[collectedBarsLength - 1] = bar; + } else if (barTimestamp > lastCollectedBarTimestamp) { + collectedBars.push (bar); + // remove the trades from saved array, which were till last collected bar's open timestamp + collectedTrades = exch.filterBySinceLimit (collectedTrades, barTimestamp); + } + } + // Note: first bar would carry incomplete values, please read comment in "buildOHLCVCFromWatchTrades" method definition for further explanation + console.log ('[WS] Constructed', collectedBars.length, 'bars from', symbol, 'trades: ', collectedBars); + } +} + + +await example_with_fetch_trades (); +await example_with_watch_trades (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/compare-two-exchanges-capabilities.md b/docs/ccxt/wiki/examples/ts/compare-two-exchanges-capabilities.md new file mode 100644 index 0000000..c9726ba --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/compare-two-exchanges-capabilities.md @@ -0,0 +1,42 @@ +- [Compare Two Exchanges Capabilities](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const prefix = '-'; + const exchange_1 = new ccxt.okx (); + const exchange_2 = new ccxt.htx (); + const keys_1 = Object.keys (exchange_1.has); + const keys_2 = Object.keys (exchange_2.has); + // check missing from exchange-1 + console.log ('### checking missing functionalities from exchange-1:', exchange_1.id); + for (let i = 0; i < keys_2.length; i++) { + const key = keys_2[i]; + if (exchange_2.has[key]) { + if (!keys_1.includes (key)) { + console.log (prefix, key, 'does not exist in', exchange_1.id, 'as opposed to', exchange_2.id); + } else if (exchange_2.has[key] !== exchange_1.has[key]) { + console.log (prefix, key, '> ', exchange_1.id, ':', exchange_1.has[key], ',', exchange_2.id, ':', exchange_2.has[key]); + } + } + } + // check missing from exchange-2 + console.log ('### checking missing functionalities from exchange-2:', exchange_2.id); + for (let i = 0; i < keys_1.length; i++) { + const key = keys_1[i]; + if (exchange_1.has[key]) { + if (!keys_2.includes (key)) { + console.log (prefix, key, 'does not exist in', exchange_2.id, 'as opposed to', exchange_1.id); + } else if (exchange_1.has[key] !== exchange_2.has[key]) { + console.log (prefix, key, '> ', exchange_2.id, ':', exchange_2.has[key], ',', exchange_1.id, ':', exchange_1.has[key]); + } + } + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/ts/create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..d0a760d --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,95 @@ +- [Create Order Position With Takeprofit Stoploss](./examples/ts/) + + + ```javascript + // @ts-nocheck +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +console.log ('CCXT Version:', ccxt.version); + +// ------------------------------------------------------------------------------ + +async function example () { + // at this moment, only OKX support embedded stop-loss & take-profit orders in unified manner. other exchanges are being added actively and will be available soon. + const exchange = new ccxt.okx ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + "password": "YOUR_API_PASSWORD", // if exchange does not require password, comment out this line + }); + + const symbol = 'DOGE/USDT:USDT'; + const side = 'buy'; // 'buy' | 'sell' + const order_type = 'limit'; // 'market' | 'limit' + const amount = 1; // how many contracts (see `market(symbol).contractSize` to find out coin portion per one contract) + + await exchange.loadMarkets (); + const market = exchange.market (symbol); + + const ticker = await exchange.fetchTicker (symbol); + + const last_price = ticker['last']; + const ask_price = ticker['ask']; + const bid_price = ticker['bid']; + + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + if (order_type === 'limit') { + price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + } + + // set trigger price for stop-loss/take-profit to 2% from current price + // (note, across different exchanges "trigger" price can be also mentioned with different synonyms, like "activation price", "stop price", "conditional price", etc. ) + const stop_loss_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 0.98 : 1.02); + const take_profit_trigger_price = (order_type === 'market' ? last_price : price) * (side === 'buy' ? 1.02 : 0.98); + + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': stop_loss_trigger_price * 0.98, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + // set a 'price' to act as limit order, otherwise remove it for a market order + 'price': take_profit_trigger_price * 0.98, + }, + // note that some exchanges might require some exchange specific parameter when opening a position, i.e.: + // 'posSide': 'long', // for phemex hedge-mode api + }; + + const position_amount = market['contractSize'] * amount; + const position_value = position_amount * last_price; + // log + console.log ('Going to open a position', 'for', amount, 'contracts worth', position_amount, market['base'], '~', position_value, market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision (symbol, price) : ''), '), using the following params:'); + console.log (params); + console.log ('-----------------------------------------------------------------------'); + + // exchange.verbose = True // uncomment for debugging purposes if necessary + + try { + const created_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + console.log ("Created an order", created_order); + + // Fetch all your open orders for this symbol + // - use 'fetchOpenOrders' or 'fetchOrders' and filter with 'open' status + // - note, that some exchanges might return one order object with embedded stoploss/takeprofit fields, while other exchanges might have separate stoploss/takeprofit order objects + const all_open_orders = await exchange.fetchOpenOrders (symbol); + console.log ("Fetched all your orders for this symbol", all_open_orders); + + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } catch (e) { + console.log (e.toString ()); + } +} + + +await example (); + +// NOTES: +// - Sometimes you might experience, when their stop-loss/take-profit order might not become activated, even though on chart the price had crossed that "trigger-price" order was not executed . That happens because some exchange might be using mark-price (instead of last-price) as a reference-price, so that mark-price might reach your trigger-price and it would activate your SL/TP order (even though on your symbol's chart you are viewing the "last-price" by default, which could have different movements than the mark-price). + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/create-order-ws-example.md b/docs/ccxt/wiki/examples/ts/create-order-ws-example.md new file mode 100644 index 0000000..ba8dba3 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/create-order-ws-example.md @@ -0,0 +1,39 @@ +- [Create Order Ws Example](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.pro.binance ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode (true); + exchange.verbose = true; // uncomment for debugging purposes if necessary + // load markets + await exchange.loadMarkets (); + const symbol = 'ETH/USDT'; + const type = 'limit'; + const side = 'buy'; + const amount = 0.01; + let price = 1000; + let orders = []; + for (let i=1; i<5; i++) { + const response = await exchange.createOrderWs ( + symbol, + type, + side, + amount, + price + ); + price += i; + orders.push (response); + } + console.log (orders); +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/create-orders-example.md b/docs/ccxt/wiki/examples/ts/create-orders-example.md new file mode 100644 index 0000000..e565e2f --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/create-orders-example.md @@ -0,0 +1,27 @@ +- [Create Orders Example](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.binance ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + exchange.setSandboxMode (true); + await exchange.loadMarkets (); + exchange.verbose = true; // uncomment for debugging purposes if necessary + const orders = await exchange.createOrders ( + [ + { 'symbol': 'LTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 10, 'price': 55 }, + { 'symbol': 'ETH/USDT:USDT', 'type': 'market', 'side': 'buy', 'amount': 0.5 }, + ] + ); + console.log (orders); +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/create-trailing-amount-order.md b/docs/ccxt/wiki/examples/ts/create-trailing-amount-order.md new file mode 100644 index 0000000..66418b4 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/create-trailing-amount-order.md @@ -0,0 +1,43 @@ +- [Create Trailing Amount Order](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.bingx ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets (); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingAmount = 100; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingAmount': trailingAmount, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingAmountOrder (symbol, order_type, side, amount, price, trailingAmount, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log (create_order); + } catch (e) { + console.log (e.toString ()); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/create-trailing-percent-order.md b/docs/ccxt/wiki/examples/ts/create-trailing-percent-order.md new file mode 100644 index 0000000..690e1f5 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/create-trailing-percent-order.md @@ -0,0 +1,43 @@ +- [Create Trailing Percent Order](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.bingx ({ + 'apiKey': 'MY_API_KEY', + 'secret': 'MY_SECRET', + }); + // exchange.setSandboxMode (true); + // exchange.verbose = true; // uncomment for debugging purposes if necessary + await exchange.loadMarkets (); + const symbol = 'BTC/USDT:USDT'; + const order_type = 'market'; + const side = 'sell'; + const amount = 0.0001; + const price = undefined; + const reduceOnly = true; + const trailingPercent = 10; + // const trailingTriggerPrice = undefined; // not supported on all exchanges + const params = { + 'reduceOnly': reduceOnly, + 'trailingPercent': trailingPercent, + // 'trailingTriggerPrice': trailingTriggerPrice, + }; + try { + const create_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + // Alternatively use the createTrailingAmountOrder method: + // const create_order = await exchange.createTrailingPercentOrder (symbol, order_type, side, amount, price, trailingPercent, trailingTriggerPrice, { + // 'reduceOnly': reduceOnly, + // }); + console.log (create_order); + } catch (e) { + console.log (e.toString ()); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/custom-proxy-agent-for-js.md b/docs/ccxt/wiki/examples/ts/custom-proxy-agent-for-js.md new file mode 100644 index 0000000..fead9c2 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/custom-proxy-agent-for-js.md @@ -0,0 +1,18 @@ +- [Custom Proxy Agent For Js](./examples/ts/) + + + ```javascript + // @ts-nocheck +// to set custom "proxy-agent" for ccxt +import ccxt from 'ccxt'; +import HttpProxyAgent from 'http-proxy-agent'; +import HttpsProxyAgent from 'https-proxy-agent'; +const proxy = 'http://1.2.3.4:5678'; +const httpAgent = new HttpProxyAgent (proxy); +const httpsAgent = new HttpsProxyAgent (proxy); +// then pass it through constructor +const kraken = new ccxt.kraken ({ agent: httpAgent /* or httpsAgent */ }); +// or set it later +kraken.agent = agent; + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/fetch-first-ohlcv-timestamp.md b/docs/ccxt/wiki/examples/ts/fetch-first-ohlcv-timestamp.md new file mode 100644 index 0000000..436f6f6 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/fetch-first-ohlcv-timestamp.md @@ -0,0 +1,94 @@ +- [Fetch First Ohlcv Timestamp](./examples/ts/) + + + ```javascript + // eslint-disable-next-line no-unused-vars +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + + +// ###### Description ###### +// +// This function tries to fetch the "listing time" of a symbol by fetching the earliest available bar in daily resolution. +// Top-tier exchanges also support fetching smaller timeframes (eg. 1 minute) even several years back, so for those exchanges you can also use `useMinuteTimeframe = true` argument to get the timestamp rounded to the earliest minute bar (instead of daily bar timestamp). +// See usage in the end of this file + + +async function fetchFirstBarTimestamp (exchange:any, symbol: string, useMinuteTimeframe = false) { + // set some constants + const millisecondsPerDay = 86400000; + const minutesPerDay = 1440; + const minimumTimestamp = 1230768000000; // 2009-01-01 (bitcoin created year) + // get market features + const market = exchange.market (symbol); + const marketType = exchange.safeString (market, 'type'); + let features = exchange.safeDict (exchange.features, marketType, {}); + if (market['subType'] !== undefined) { + features = exchange.safeDict (features, market['subType'], {}); + } + const ohlcv = exchange.safeDict (features, 'fetchOHLCV'); + if (ohlcv === undefined) { + return undefined; + } + const limit = exchange.safeInteger (ohlcv, 'limit'); + const fetchParams = { 'maxRetriesOnFailure': 3 }; + // start loop + let currentSince = exchange.milliseconds () - millisecondsPerDay * (limit - 1); + let foundStartTime = 0; + // eslint-disable-next-line + while (true) { + currentSince = Math.max (currentSince, minimumTimestamp); + const dailyBars = await exchange.fetchOHLCV (symbol, '1d', currentSince, limit, fetchParams); + if (dailyBars.length <= 0) { + break; // if no days returned, then probably start date was passed + } + const firstTs = dailyBars[0][0]; + if (firstTs === foundStartTime) { + // if the first timestamp is equal to the last-fetched timestamp, then break here, because some exchanges still return initial bar even if since is much ahead to listing time + break; + } + foundStartTime = firstTs; + currentSince = foundStartTime - millisecondsPerDay * (limit - 1); // shift 'since' one step back + if (dailyBars.length === 1) { + // in some cases, some exchanges might still return first bar of chart when endtime overlaps previous day + break; + } + } + // if minute resolution needed + if (useMinuteTimeframe) { + const maxIteration = Math.ceil (minutesPerDay / limit) * 2; + const allPromises: any[] = []; + for (let i = 0; i < maxIteration; i++) { + currentSince = foundStartTime - millisecondsPerDay + i * limit * 60 * 1000; // shift one-duration back for more accuracy for different kind of exchanges, like OKX, where first daily bar is offset by one day, but minute bars present + allPromises.push (exchange.fetchOHLCV (symbol, '1m', currentSince, limit, fetchParams)); + } + const allResponses = await Promise.all (allPromises); + // find earliest bar + for (let i = 0; i < allResponses.length; i++) { + const response = allResponses[i]; + if (response.length > 0) { + foundStartTime = response[0][0]; + break; + } + } + } + return foundStartTime; +} + +// ###### Usage ###### + +const runExample = false; // set to true to run example +if (runExample) { + const myEx = new ccxt.binance (); + await myEx.loadMarkets (); + const symbol = 'TRUMP/USDT'; + const earliest_timestamp = await fetchFirstBarTimestamp (myEx, symbol, true); + console.log ('- Earliest bar timestamp:', earliest_timestamp, ', readable: ', myEx.iso8601 (earliest_timestamp)); + console.log ('- market.created value:', myEx.market (symbol)['created']); +} + + +export default fetchFirstBarTimestamp; + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/fetch-ohlcv-many-exchanges-continuosly.md b/docs/ccxt/wiki/examples/ts/fetch-ohlcv-many-exchanges-continuosly.md new file mode 100644 index 0000000..1a3494a --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/fetch-ohlcv-many-exchanges-continuosly.md @@ -0,0 +1,50 @@ +- [Fetch Ohlcv Many Exchanges Continuosly](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// fetch and handle constinuosly +async function fetchOHLCVContinuously (exchange, symbol) { + while (true) { + try { + const ohlcv = await exchange.fetchOHLCV (symbol); + const ohlcvLength = ohlcv.length; + console.log ('Fetched ', exchange.id, ' - ', symbol, ' candles. last candle: ', ohlcv[ohlcvLength - 1]); + } catch (e) { + console.log (e); + break; + } + } +} + +// start exchanges and fetch OHLCV loop +async function startExchange (exchangeName, symbols) { + const ex = new ccxt[exchangeName] ({}); + const promises = []; + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i]; + promises.push (fetchOHLCVContinuously (ex, symbol)); + } + await Promise.all (promises); + await ex.close (); +} + +// main function +async function example () { + const exchanges = [ 'binance', 'okx', 'kraken' ]; + const symbols = [ 'BTC/USDT', 'ETH/USDT' ]; + const promises = []; + for (let i = 0; i < exchanges.length; i++) { + const exchangeName = exchanges[i]; + promises.push (startExchange (exchangeName, symbols)); + } + await Promise.all (promises); +} + + +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/fetch-ohlcv.md b/docs/ccxt/wiki/examples/ts/fetch-ohlcv.md new file mode 100644 index 0000000..517cdb6 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/fetch-ohlcv.md @@ -0,0 +1,23 @@ +- [Fetch Ohlcv](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const myex = new ccxt.okx ({}); + const fromTimestamp = myex.milliseconds () - 86400 * 1000;// last 24 hrs + const ohlcv = await myex.fetchOHLCV ('BTC/USDT', '1m', fromTimestamp, 3, { 'whatever': 123 }); + const length = ohlcv.length; + if (length > 0) { + const lastPrice = ohlcv[length - 1][4]; + console.log ('Fetched ', length, ' candles for ', myex.id, ': last close ', lastPrice); + } else { + console.log ('No candles have been fetched'); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/hibachi-example.md b/docs/ccxt/wiki/examples/ts/hibachi-example.md new file mode 100644 index 0000000..fb421bb --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/hibachi-example.md @@ -0,0 +1,143 @@ +- [Hibachi Example](./examples/ts/) + + + ```javascript + import { hibachi } from '../../js/ccxt.js'; +import fs from 'fs'; + +/* + In order to run the examples, you need to setup keys.local.json file like this: + ``` + { + "hibachi": { + "accountId": 111, + "apiKey": "1111111111111111111111111111111111111111111=", + "privateKey": "0x1111111111111111111111111111111111111111111111111111111111111111", + "publicKey": "0x11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", + "withdrawAddress": "0x1111111111111111111111111111111111111111" + } + } + ``` + You can get the accountId, apiKey and privateKey from Hibachi App by creating an API key + After that you can view the API key, it will show the publicKey (only for trustless account, you can ignore it for exchange managed account) + Note: if you are using exchange managed account, the privateKey's length will be 44 instead + The withdrawAddress can be any ethereum wallet address, that is used to receive funds for withdraw tests +*/ +async function example () { + const keys = JSON.parse(fs.readFileSync('keys.local.json', 'utf-8')); + const exchange = new hibachi (keys.hibachi); + exchange.verbose = true; + + const markets = await exchange.fetchMarkets(); + console.log ('fetchMarkets', markets.length, markets[0]); + + const currencies = await exchange.fetchCurrencies(); + console.dir (currencies, { depth: null, colors: true }); + + const trades = await exchange.fetchTrades("BTC/USDT:USDT"); + console.log('fetchTrades', trades.length, trades[0]); + + const tenMinutes = 10 * 60 * 1000; + const until = Date.now(); + const since = until - tenMinutes; + const ohlcv = await exchange.fetchOHLCV('BTC/USDT:USDT', '5min', since, 100, {until}); + console.log ('fetchOHLCV', ohlcv.length, ohlcv[0]); + + const balance = await exchange.fetchBalance(); + console.dir (balance, { depth: null, colors: true }); + + const ticker = await exchange.fetchTicker('BTC/USDT:USDT'); + console.log ('fetchTicker', ticker); + + // createOrder, editOrder and cancelOrder + const order1 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const order2 = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002); + console.log('create market order', order1.id, order2.id); + const order3 = await exchange.createOrder('ETH/USDT:USDT', 'limit', 'buy', 1.234, 1.234); + const order4 = await exchange.editOrder(order3.id, 'ETH/USDT:USDT', 'limit', 'buy', 0.987, 1.123); + const order5 = await exchange.cancelOrder(order3.id); + console.log('create, edit and cancel limit order', order3.id, order4.id, order5.id); + + // advanced order parameters + const postOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, {'timeInForce': 'PO'}); + await exchange.cancelOrder(postOnlyOrder.id); + const iocOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'buy', 2.0, 2.0, {'timeInForce': 'IOC'}); + await exchange.createOrder('BTC/USDT:USDT', 'market', 'buy', 0.00002); + const reduceOnlyOrder = await exchange.createOrder('BTC/USDT:USDT', 'market', 'sell', 0.00002, undefined, {'reduceOnly': true}); + const triggerOrder = await exchange.createOrder('BTC/USDT:USDT', 'limit', 'sell', 2.0, 2.0, {'triggerPrice': '2.0'}); + await exchange.cancelOrder(triggerOrder.id); + console.log('postOnly, IOC, reduceOnly, trigger order', postOnlyOrder.id, iocOrder.id, reduceOnlyOrder.id, triggerOrder.id); + + const order1_info = await exchange.fetchOrder (order1.id, 'BTC/USDT:USDT'); + console.log ('fetchOrder', order1_info); + + const orderbook = await exchange.fetchOrderBook ('BTC/USDT:USDT'); + console.log ('fetchOrderBook', orderbook); + const withdrawResponse = await exchange.withdraw('USDT', 0.02, keys.hibachi.withdrawAddress); + console.log(withdrawResponse); + + const myTrades = await exchange.fetchMyTrades('BTC/USDT:USDT', undefined, 1); + console.log('fetchMyTrades', myTrades); + + const tradingFees = await exchange.fetchTradingFees (); + console.log ('fetchTradingFees', tradingFees); + + const openOrders = await exchange.fetchOpenOrders (); + console.log ('fetchOpenOrders', openOrders); + const openOrdersWithLimit = await exchange.fetchOpenOrders (undefined, undefined, 1); + console.log ('fetchOpenOrdersWithLimit', openOrdersWithLimit); + const openOrdersBTC = await exchange.fetchOpenOrders ('BTC/USDT:USDT'); + console.log ('fetchOpenOrdersBTC', openOrdersBTC); + const openOrdersSince = await exchange.fetchOpenOrders (undefined, 1752552000000); // 7/15/2025 00:00 UTC + console.log ('fetchOpenOrdersSince', openOrdersSince); + + if (keys.hibachi.publicKey !== undefined) { + const depositAddress = await exchange.fetchDepositAddress ('USDT', {'publicKey': keys.hibachi.publicKey}); + console.log ('fetchDepositAddress', depositAddress); + } + + const ledger = await exchange.fetchLedger('USDT', undefined, 2); + console.log('fetchLedger', ledger); + + const deposits = await exchange.fetchDeposits (); + console.log ('fetchDeposits', deposits); + + const withdrawals = await exchange.fetchWithdrawals (); + console.log ('fetchWithdrawals', withdrawals); + + const timestamp = await exchange.fetchTime(); + console.log('fetchTime', timestamp) + + const openInterest = await exchange.fetchOpenInterest('BTC/USDT:USDT'); + console.log('fetchOpenInterest', openInterest); + + const fundingRate = await exchange.fetchFundingRate('BTC/USDT:USDT'); + console.log('fetchFundingRate', fundingRate); + + const fundingRateHistory = await exchange.fetchFundingRateHistory('BTC/USDT:USDT', undefined, 2); + console.log('fetchFundingRateHistory', fundingRateHistory); + + // Batch orders + const createOrders = await exchange.createOrders([ + {'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.234, 'price': 1.234}, + {'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.001, 'price': 1.001}, + {'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.002, 'price': 1.002}, + {'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.003, 'price': 1.003}, + ]); + console.log('createOrders', createOrders); + const editOrders = await exchange.editOrders([ + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + {'id': createOrders[0].id, 'symbol': 'ETH/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.111, 'price': 0.999}, + // @ts-expect-error OrderRequest lacks `id` but we expects it for editing + {'id': createOrders[1].id, 'symbol': 'BTC/USDT:USDT', 'type': 'limit', 'side': 'buy', 'amount': 1.112, 'price': 0.998}, + ]); + console.log('editOrders', editOrders); + const cancelOrders = await exchange.cancelOrders([createOrders[0].id, createOrders[1].id]); + console.log('cancelOrders', cancelOrders); + const cancelAll = await exchange.cancelAllOrders('ETH/USDT:USDT'); + console.log(cancelAll); + +} +example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/how-to-import-one-exchange-esm.md b/docs/ccxt/wiki/examples/ts/how-to-import-one-exchange-esm.md new file mode 100644 index 0000000..b81d984 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/how-to-import-one-exchange-esm.md @@ -0,0 +1,17 @@ +- [How To Import One Exchange Esm](./examples/ts/) + + + ```javascript + import { binance } from '../../js/ccxt.js'; + +async function example () { + const exchange = new binance ({}); + const ob = await exchange.fetchOrderBook ('BTC/USDT', 3); + const asks = ob['asks']; + const bids = ob['bids']; + console.log (asks); + console.log (bids); +} +example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/kraken-create-and-close-position.md b/docs/ccxt/wiki/examples/ts/kraken-create-and-close-position.md new file mode 100644 index 0000000..41ea5cc --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/kraken-create-and-close-position.md @@ -0,0 +1,75 @@ +- [Kraken Create And Close Position](./examples/ts/) + + + ```javascript + // @ts-nocheck +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +console.log ('CCXT Version:', ccxt.version); + +// ------------------------------------------------------------------------------ + +async function example () { + const exchange = new ccxt.kraken ({ + "apiKey": "YOUR_API_KEY", + "secret": "YOUR_API_SECRET", + }); + + const symbol = 'UNI/USD'; + let side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'market'; // set it to 'market' or 'limit' + const amount = 1; + const leverage = 2; + + await exchange.loadMarkets (); + const market = exchange.market (symbol); + + // if order_type is 'market', then price is not needed + let price = undefined; + // if order_type is 'limit', then set a price at your desired level + // you can fetch the ticker and update price + // const ticker = await exchange.fetchTicker (symbol); + // const last_price = ticker['last']; + // const ask_price = ticker['ask']; + // const bid_price = ticker['bid']; + // if (order_type === 'limit') { + // price = (side === 'buy') ? bid_price * 0.95 : ask_price * 1.05; // i.e. 5% from current price + // } + + const params = { + 'leverage': leverage, + }; + + // log + console.log ('Going to open a position', 'for', amount, 'worth', amount, market['base'], '~', market['settle'], 'using', side, order_type, 'order (', (order_type === 'limit' ? exchange.priceToPrecision (symbol, price) : ''), '), using the following params:'); + console.log (params); + console.log ('-----------------------------------------------------------------------'); + + // exchange.verbose = True // uncomment for debugging purposes if necessary + + try { + const created_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + console.log ("Created an order", created_order); + + // Fetch all your closed orders for this symbol (because we used market order) + // - use 'fetchClosedOrders' or 'fetchOrders' and filter with 'closed' status + const all_closed_orders = await exchange.fetchClosedOrders (symbol); + console.log ("Fetched all your closed orders for this symbol", all_closed_orders); + + const all_open_positions = await exchange.fetchPositions (symbol); + console.log ("Fetched all your positions for this symbol", all_open_positions); + + // To close a position: + // - long position (buy), you can create a sell order: exchange.createOrder (symbol, order_type, 'sell', amount, price, params); + // - short position (sell), you can create a buy order: exchange.createOrder (symbol, order_type, 'buy', amount, price, params); + } catch (e) { + console.log (e.toString ()); + } +} + + +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/margin-loan-borrow-buy-sell-repay.md b/docs/ccxt/wiki/examples/ts/margin-loan-borrow-buy-sell-repay.md new file mode 100644 index 0000000..0412a0b --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/margin-loan-borrow-buy-sell-repay.md @@ -0,0 +1,78 @@ +- [Margin Loan Borrow Buy Sell Repay](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// Note, this is just an example and might not yet work on other exchanges, which are being still unified. + +async function example () { + // ########## user inputs ########## + const exchange = new ccxt['binance'] ({ 'apiKey': 'xxx', 'secret': 'xxx' }); + const symbol = 'BUSD/USDT'; // set target symbol + const marginMode = 'isolated'; // margin mode (cross or isolated) + const collateral_coin = 'USDT'; // which asset you want to use for margin-borrow collateral + const borrow_coin = 'BUSD'; // which coin to borrow + const order_side: any = 'sell'; // which side to trade + const amount_to_trade = 14; // how many coins to sell + const order_type = 'limit'; // order type (can be market, limit or etc) + const limit_price: any = 0.99; // price to sell at (set undefined/null/None if market-order) + const margin_magnitude = 5; // target margin (aka 'leverage'). This might also be obtainable using other unified methods, but for example purposes, we set here manually + // ########## end of user-inputs ########## + // + // for example purposes, let's also check available balance at first + const balance_margin = await exchange.fetchBalance ({ 'defaultType': 'margin', 'marginMode': marginMode }); // use `defaultType` because of temporary bug, otherwise, after several days, you can use `type` too. + // if we don't have enought coins, then we have to borrow at first + let needed_amount_to_borrow: any = undefined; // will be auto-set below + if (amount_to_trade > balance_margin[symbol][borrow_coin]['free']) { + needed_amount_to_borrow = amount_to_trade - balance_margin[symbol][borrow_coin]['free']; + console.log ('hmm, I have only ', balance_margin[symbol][borrow_coin]['free'], ' ', borrow_coin, ' in margin balance, and still need additional ', needed_amount_to_borrow, ' to make an order. Lets borrow it.'); + // To initate a borrow, at first, check if we have enough collateral (for this example, as we make a sell-short, we need '-1' to keep for collateral currency) + const needed_collateral_amount = needed_amount_to_borrow / (margin_magnitude - 1); + // Check if we have any collateral to get permission for borrow + if (balance_margin[symbol][collateral_coin]['free'] < needed_collateral_amount) { + // If we don't have enough collateral, then let's try to transfer collateral-asset from spot-balance to margin-balance + console.log ('hmm, I have only ', balance_margin[symbol][collateral_coin]['free'], ' in balance, but ', needed_collateral_amount, ' collateral is needed. I should transfer ', needed_collateral_amount, ' from spot'); + // let's check if we have spot balance at all + const balance_spot = await exchange.fetchBalance ({ 'type': 'spot' }); + if (exchange.parseNumber (balance_spot[collateral_coin]['free']) < needed_collateral_amount) { + console.log ('hmm, I neither do have enough balance on spot - only ', balance_spot[collateral_coin]['free'], '. Script can not continue...'); + return; + } else { + console.log ('Transferring ', needed_collateral_amount, ' to margin account'); + await exchange.transfer (collateral_coin, needed_collateral_amount, 'spot', marginMode, { 'symbol': symbol }); + } + } + // now, as we have enough margin collateral, initiate borrow + console.log ('Initiating margin borrow of ', needed_amount_to_borrow, ' ', borrow_coin); + const borrowResult = await exchange.borrowMargin (borrow_coin, needed_amount_to_borrow, symbol, { 'marginMode': marginMode }); + } + console.log ('Submitting order.'); + const order = await exchange.createOrder (symbol, order_type, order_side, amount_to_trade, limit_price, { 'marginMode': marginMode }); + console.log ('Order was submitted !', order['id']); + // + // + // ... + // ... + // some time later, if you want to repay the loan back (like 'close the position')... + // ... + // ... + // + // + // set the "repay-back" amount (for this example snippet, this will be same amount that we borrowed above) + if (needed_amount_to_borrow !== undefined) { + const amount_to_repay_back = needed_amount_to_borrow; + // At first, you need to get back the borrowed coin, by making an opposide trade + console.log ('Making purchase back of ', amount_to_repay_back, ' ', borrow_coin, ' to repay it back.'); + const purchase_back_price: any = 1.01; + const order_back = await exchange.createOrder (symbol, order_type, (order_side === 'buy' ? 'sell' : 'buy'), amount_to_repay_back, purchase_back_price, { 'marginMode': marginMode }); + console.log ('Now, repaying the loan.'); + const repayResult = await exchange.repayMargin (borrow_coin, amount_to_repay_back, symbol, { 'marginMode': marginMode }); + console.log ('finished.'); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.md b/docs/ccxt/wiki/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.md new file mode 100644 index 0000000..2119ff0 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.md @@ -0,0 +1,68 @@ +- [Phemex Create Order Position With Takeprofit Stoploss](./examples/ts/) + + + ```javascript + // @ts-nocheck +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// ------------------------------------------------------------------------------ + +async function example () { + const exchange = new ccxt.phemex ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }); + + const symbol = 'XRP/USDT:USDT'; + const side = 'buy'; // set it to 'buy' for a long position, 'sell' for a short position + const order_type = 'limit'; // set it to 'market' or 'limit' + const amount = 1; // how many contracts + const price = 0.5; // set a price at your desired level + + // take profit and stop loss prices and types + const take_profit_trigger_price = 0.6; + const stop_loss_trigger_price = 0.4; + const take_profit_limit_price = 0.7; + const stop_loss_limit_price = 0.3; + + await exchange.loadMarkets (); + + // when symbol's price reaches your predefined "trigger price", stop-loss order would be activated as a "market order". but if you want it to be activated as a "limit order", then set a 'price' parameter for it + const params = { + 'posSide': 'Long', // "Long" / "Short" for hedge mode + 'stopLoss': { + 'triggerPrice': stop_loss_trigger_price, + 'type': 'limit', + 'price': stop_loss_limit_price, + }, + 'takeProfit': { + 'triggerPrice': take_profit_trigger_price, + 'type': 'limit', + 'price': take_profit_limit_price, + }, + }; + + console.log ('-----------------------------------------------------------------------'); + + // exchange.verbose = True // uncomment for debugging purposes if necessary + + try { + const created_order = await exchange.createOrder (symbol, order_type, side, amount, price, params); + console.log ('Created an order', created_order); + + // Fetch all your open orders for this symbol + const all_open_orders = await exchange.fetchOpenOrders (symbol); + console.log ('Fetched all your orders for this symbol', all_open_orders); + + // To cancel a limit order, use "exchange.cancel_order(created_order['id'], symbol)"" + } catch (e) { + console.log (e.toString ()); + } +} + +await example (); + + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/proxy-usage.md b/docs/ccxt/wiki/examples/ts/proxy-usage.md new file mode 100644 index 0000000..7ea81b9 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/proxy-usage.md @@ -0,0 +1,55 @@ +- [Proxy Usage](./examples/ts/) + + + ```javascript + +import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// 1) ABOUT CCXT PROXIES, READ MORE AT: https://docs.ccxt.com/#/README?id=proxy +// 2) in python, uncomment the below: +// if sys.platform == 'win32': +// asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + +async function example_proxyUrl () { + const myEx = new ccxt.kucoin (); + myEx.proxyUrl = 'http://188.245.226.105:8090/proxy_url.php?caller=https://ccxt.com&url='; + console.log (await myEx.fetch ('https://api.ipify.org/')); +} + +async function example_httpProxy () { + const myEx = new ccxt.kucoin (); + myEx.httpProxy = 'http://188.245.226.105:8911'; // "httpProxy" or "httpsProxy" (depending on your proxy protocol) + console.log (await myEx.fetch ('https://api.ipify.org/')); +} + +async function example_socksProxy () { + const myEx = new ccxt.kucoin (); + myEx.socksProxy = 'socks5://127.0.0.1:1080'; // from protocols: socks, socks5, socks5h + console.log (await myEx.fetch ('https://api.ipify.org/')); +} + +async function example_webSockets () { + const myEx = new ccxt.pro.kucoin (); + myEx.httpProxy = 'http://188.245.226.105:8911'; // even though you are using WebSockets, you might also need to set up proxy for the exchange's REST requests + myEx.wsProxy = 'http://188.245.226.105:8911'; // "wsProxy" or "wssProxy" or "wsSocksProxy" (depending on your proxy protocol) + await myEx.loadMarkets (); + // + // To ensure your WS proxy works, uncomment below code and watch the log + // + // myEx.verbose = true; + // await myEx.loadHttpProxyAgent (); + // await myEx.watch ('ws://188.245.226.105:9876/', 'myip'); // in the incoming logs, confirm that you see the proxy IP in "hello" message + // + console.log (await myEx.watchTicker ('BTC/USDT')); + await myEx.close (); +} + + +// await example_proxyUrl (); +await example_httpProxy (); +// await example_socksProxy (); +// await example_webSockets (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/sample-local-proxy-server-with-cors.md b/docs/ccxt/wiki/examples/ts/sample-local-proxy-server-with-cors.md new file mode 100644 index 0000000..b226cfc --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/sample-local-proxy-server-with-cors.md @@ -0,0 +1,21 @@ +- [Sample Local Proxy Server With Cors](./examples/ts/) + + + ```javascript + // @ts-nocheck +// JavaScript sample Proxy with CORS support + +// Save this in a file like cors.js and run with: +// node cors [port] +// It will listen for your requests on the port you pass in command line (or port 8080 by default) + +import cors from 'cors-anywhere'; // npm install cors-anywhere + +const port = (process.argv.length > 2) ? parseInt (process.argv[2]) : 8080; // if not provided from cli, default to 8080 +cors.createServer ({ + // you can set origin, if needed by exchange + // setHeaders: { 'origin': 'https://www.bitmex.com' } +}).listen (port, 'localhost'); +console.log ('Running CORS Anywhere on localhost:' + port); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watch-OHLCV-For-Symbols.md b/docs/ccxt/wiki/examples/ts/watch-OHLCV-For-Symbols.md new file mode 100644 index 0000000..75b2132 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watch-OHLCV-For-Symbols.md @@ -0,0 +1,23 @@ +- [Watch Ohlcv For Symbols](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const subscriptions = [ + [ 'BTC/USDT', '5m' ], + [ 'ETH/USDT', '5m' ], + [ 'BTC/USDT', '1h' ], + ]; + while (true) { + const ohlcv = await binance.watchOHLCVForSymbols (subscriptions); + console.log (ohlcv); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watch-OHLCV.md b/docs/ccxt/wiki/examples/ts/watch-OHLCV.md new file mode 100644 index 0000000..097f71a --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watch-OHLCV.md @@ -0,0 +1,20 @@ +- [Watch Ohlcv](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbol = 'BTC/USDT'; + const timeframe = '1m'; + while (true) { + const ohlcv = await binance.watchOHLCV (symbol, timeframe); + console.log (ohlcv); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watch-OrderBook-For-Symbols.md b/docs/ccxt/wiki/examples/ts/watch-OrderBook-For-Symbols.md new file mode 100644 index 0000000..a7b3345 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watch-OrderBook-For-Symbols.md @@ -0,0 +1,19 @@ +- [Watch Orderbook For Symbols](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbols = [ 'BTC/USDT', 'ETH/USDT', 'DOGE/USDT' ]; + while (true) { + const orderbook = await binance.watchOrderBookForSymbols (symbols); + console.log (orderbook['symbol'], orderbook['asks'][0], orderbook['bids'][0]); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watch-Trades-For-Symbols.md b/docs/ccxt/wiki/examples/ts/watch-Trades-For-Symbols.md new file mode 100644 index 0000000..ee48795 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watch-Trades-For-Symbols.md @@ -0,0 +1,19 @@ +- [Watch Trades For Symbols](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbols = [ 'BTC/USDT', 'ETH/USDT', 'DOGE/USDT' ]; + while (true) { + const trades = await binance.watchTradesForSymbols (symbols); + console.log (trades); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watch-tickers.md b/docs/ccxt/wiki/examples/ts/watch-tickers.md new file mode 100644 index 0000000..8969f2a --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watch-tickers.md @@ -0,0 +1,19 @@ +- [Watch Tickers](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const binance = new ccxt.pro.binance ({}); + const symbols = [ 'BTC/USDT', 'ETH/USDT', 'DOGE/USDT' ]; + while (true) { + const tickers = await binance.watchTickers (symbols); + console.log (tickers['BTC/USDT'], tickers['ETH/USDT'], tickers['DOGE/USDT']); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watchPositions-many-exchanges-continuosly.md b/docs/ccxt/wiki/examples/ts/watchPositions-many-exchanges-continuosly.md new file mode 100644 index 0000000..1f00851 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watchPositions-many-exchanges-continuosly.md @@ -0,0 +1,59 @@ +- [Watchpositions Many Exchanges Continuosly](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +// watch and handle constinuosly +async function watchPositionsContinuously (exchange) { + while (true) { + try { + const positions = await exchange.watchPositions (); + console.log ('Fetched ', exchange.id, ' - Positions: ', positions); + } catch (e) { + console.log (e); + break; + } + } +} + +// start exchanges and fetch OHLCV loop +async function startExchange (exchangeName, config) { + const ex = new ccxt[exchangeName] (config); + const promises = []; + promises.push (watchPositionsContinuously (ex)); + await Promise.all (promises); + await ex.close (); +} + +// main function +async function example () { + const exchanges = { + 'binanceusdm': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'okx': { + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + 'huobi':{ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET', + }, + }; + const promises = []; + const exchangeIds = Object.keys (exchanges); + for (let i = 0; i < exchangeIds.length; i++) { + const exchangeName = exchangeIds[i]; + const config = exchanges[exchangeName]; + promises.push (startExchange (exchangeName, config)); + } + await Promise.all (promises); +} + +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watchPositions.md b/docs/ccxt/wiki/examples/ts/watchPositions.md new file mode 100644 index 0000000..4d3ac61 --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watchPositions.md @@ -0,0 +1,21 @@ +- [Watchpositions](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.pro.binanceusdm ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_API_SECRET' + }); + while (true) { + const trades = await exchange.watchPositions (); + console.log (trades); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/examples/ts/watchPositionsForSymbols.md b/docs/ccxt/wiki/examples/ts/watchPositionsForSymbols.md new file mode 100644 index 0000000..24eb2de --- /dev/null +++ b/docs/ccxt/wiki/examples/ts/watchPositionsForSymbols.md @@ -0,0 +1,22 @@ +- [Watchpositionsforsymbols](./examples/ts/) + + + ```javascript + import ccxt from '../../js/ccxt.js'; + +// AUTO-TRANSPILE // + +async function example () { + const exchange = new ccxt.pro.binanceusdm ({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'Your_API_SECRET' + }); + const symbols = [ 'BTC/USDT:USDT', 'ETH/USDT:USDT', 'DOGE/USDT:USDT' ]; + while (true) { + const trades = await exchange.watchPositions (symbols); + console.log (trades); + } +} +await example (); + +``` \ No newline at end of file diff --git a/docs/ccxt/wiki/exchangePartials/body.hbs b/docs/ccxt/wiki/exchangePartials/body.hbs new file mode 100644 index 0000000..fa0c6dd --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/body.hbs @@ -0,0 +1,29 @@ +{{>deprecated~}} +{{>description~}} +{{>scope~}} +{{>summary~}} +{{>augments~}} +{{>implements~}} +{{>mixes~}} +{{>default~}} +{{>chainable~}} +{{>overrides~}} +{{>returns~}} +{{>category~}} +{{>throws~}} +{{>fires~}} +{{>this~}} +{{>access~}} +{{>readOnly~}} +{{>requires~}} +{{>customTags~}} +{{>see~}} +{{>since~}} +{{>version~}} +{{>authors~}} +{{>license~}} +{{>copyright~}} +{{>todo~}} +{{>params~}} +{{>properties~}} +{{>examples~}} diff --git a/docs/ccxt/wiki/exchangePartials/deprecated.hbs b/docs/ccxt/wiki/exchangePartials/deprecated.hbs new file mode 100644 index 0000000..8deb529 --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/deprecated.hbs @@ -0,0 +1,3 @@ +{{#if deprecated}}`DEPRECATED` + +{{/if~}} diff --git a/docs/ccxt/wiki/exchangePartials/docs.hbs b/docs/ccxt/wiki/exchangePartials/docs.hbs new file mode 100644 index 0000000..58c624e --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/docs.hbs @@ -0,0 +1,5 @@ +{{>header~}} +{{>body}} +{{>member-index-list~}} +{{>separator~}} +{{>members~}} diff --git a/docs/ccxt/wiki/exchangePartials/header.hbs b/docs/ccxt/wiki/exchangePartials/header.hbs new file mode 100644 index 0000000..8bdf9bc --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/header.hbs @@ -0,0 +1,9 @@ + + + +{{#if exchange}} +{{>heading-indent}}[{{exchange}}](#{{getFragment this}}) +{{else}} +{{>heading-indent}}{{name}}{docsify-ignore} +{{/if~}} + diff --git a/docs/ccxt/wiki/exchangePartials/member-index-list.hbs b/docs/ccxt/wiki/exchangePartials/member-index-list.hbs new file mode 100644 index 0000000..63b6079 --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/member-index-list.hbs @@ -0,0 +1,6 @@ +{{#if (isFunction this)}} +* [{{name}}](#{{getFragment this}}) +{{/if}} +{{#indexChildren ~}} +{{>member-index-list~}} +{{/indexChildren}} diff --git a/docs/ccxt/wiki/exchangePartials/members.hbs b/docs/ccxt/wiki/exchangePartials/members.hbs new file mode 100644 index 0000000..19ac190 --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/members.hbs @@ -0,0 +1,9 @@ +{{#children inherited=undefined ~}} +{{>header~}} +{{>body}} + +```javascript +{{memberof}}.{{name}} ({{methodSig this}}) +``` + +{{/children~}} diff --git a/docs/ccxt/wiki/exchangePartials/params-table.hbs b/docs/ccxt/wiki/exchangePartials/params-table.hbs new file mode 100644 index 0000000..839fdb6 --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/params-table.hbs @@ -0,0 +1,12 @@ +{{#if params}} + +{{tableHead params "name|Param" "type|Type" "optional|Required" "description|Description" ~}} + +{{#tableRow params "name" "type" "optional" "description" ~}} +| {{#if @col1}}{{name}} | {{/if~}} +{{#if @col2}}{{>linked-type-list types=(cleanNames type.names) delimiter=", " }} | {{/if~}} +{{#if @col3}}{{#unless optional}}Yes{{else}}No{{/unless}} | {{/if~}} +{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}} +{{/tableRow}} + +{{/if}} diff --git a/docs/ccxt/wiki/exchangePartials/returns.hbs b/docs/ccxt/wiki/exchangePartials/returns.hbs new file mode 100644 index 0000000..a068ddd --- /dev/null +++ b/docs/ccxt/wiki/exchangePartials/returns.hbs @@ -0,0 +1,12 @@ +{{#if returns}} +{{#if returns.[0].description~}} +**Returns**: {{#each returns~}} + {{#if type~}} + {{#if type.names}}{{>linked-type-list types=(cleanNames type.names) delimiter=" \| " ~}}{{/if}} + {{~#if description}} - {{{inlineLinks description}}}{{/if~}} + {{else~}} + {{{inlineLinks description}~}} + {{/if~}} +{{~/each}} + +{{/if}}{{/if}} diff --git a/docs/ccxt/wiki/exchanges/.gitkeep b/docs/ccxt/wiki/exchanges/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/ccxt/wiki/exchanges/alpaca.md b/docs/ccxt/wiki/exchanges/alpaca.md new file mode 100644 index 0000000..b4f9ef9 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/alpaca.md @@ -0,0 +1,758 @@ + + + +## alpaca{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchTrades](#fetchtrades) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [createMarketOrderWithCost](#createmarketorderwithcost) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [editOrder](#editorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchBalance](#fetchbalance) +* [watchTicker](#watchticker) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchOrders](#watchorders) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for alpaca + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.alpaca.markets/reference/get-v2-assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange api endpoint | + + +```javascript +alpaca.fetchMarkets ([params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.alpaca.markets/reference/cryptotrades +- https://docs.alpaca.markets/reference/cryptolatesttrades + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | +| params.method | string | No | method, default: marketPublicGetV1beta3CryptoLocTrades | + + +```javascript +alpaca.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - A dictionary of [order book structures](https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure) indexed by market symbols + +**See**: https://docs.alpaca.markets/reference/cryptolatestorderbooks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | + + +```javascript +alpaca.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://docs.alpaca.markets/reference/cryptobars +- https://docs.alpaca.markets/reference/cryptolatestbars + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the alpha api endpoint | +| params.loc | string | No | crypto location, default: us | +| params.method | string | No | method, default: marketPublicGetV1beta3CryptoLocBars | + + +```javascript +alpaca.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.alpaca.markets/reference/cryptosnapshots-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | + + +```javascript +alpaca.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.alpaca.markets/reference/cryptosnapshots-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbols of the markets to fetch tickers for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.loc | string | No | crypto location, default: us | + + +```javascript +alpaca.fetchTickers (symbols[, params]) +``` + + + + +### createMarketOrderWithCost{docsify-ignore} +create a market order by providing the symbol, side and cost + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/postorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.createMarketOrderWithCost (symbol, side, cost[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/postorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/postorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/postorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit' or 'stop_limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.cost | float | No | *market orders only* the cost of the order in units of the quote currency | + + +```javascript +alpaca.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/deleteorderbyorderid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/deleteallorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/getorderbyorderid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/getallorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +alpaca.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/getallorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +alpaca.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/getallorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +alpaca.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.alpaca.markets/reference/patchorderbyorderid-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market to create an order in | +| type | string | No | 'market', 'limit' or 'stop_limit' | +| side | string | No | 'buy' or 'sell' | +| amount | float | No | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price for the order, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | string | No | the price to trigger a stop order | +| params.timeInForce | string | No | for crypto trading either 'gtc' or 'ioc' can be used | +| params.clientOrderId | string | No | a unique identifier for the order, automatically generated if not sent | + + +```javascript +alpaca.editOrder (id[, symbol, type, side, amount, price, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.alpaca.markets/reference/getaccountactivitiesbyactivitytype-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.page_token | string | No | page_token - used for paging | + + +```javascript +alpaca.fetchMyTrades ([symbol, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.alpaca.markets/reference/listcryptofundingwallets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.alpaca.markets/reference/createcryptotransferforaccount + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | a memo for the transaction | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.alpaca.markets/reference/listcryptofundingtransfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.alpaca.markets/reference/listcryptofundingtransfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposit structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.fetchDeposits ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.alpaca.markets/reference/listcryptofundingtransfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawal structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.fetchWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.alpaca.markets/reference/getaccount-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.fetchBalance ([params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#quotes + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.watchTicker (symbol[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#bars + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#orderbooks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.alpaca.markets/docs/websocket-streaming#trade-updates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | + + +```javascript +alpaca.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [alpaca](#alpaca) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +alpaca.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/apex.md b/docs/ccxt/wiki/exchanges/apex.md new file mode 100644 index 0000000..d0b2351 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/apex.md @@ -0,0 +1,847 @@ + + + +## apex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchBalance](#fetchbalance) +* [fetchAccount](#fetchaccount) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [createOrder](#createorder) +* [transfer](#transfer) +* [cancelAllOrders](#cancelallorders) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrders](#fetchorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchFundingHistory](#fetchfundinghistory) +* [setLeverage](#setleverage) +* [fetchPositions](#fetchpositions) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchOHLCV](#watchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [watchMyTrades](#watchmytrades) +* [watchPositions](#watchpositions) +* [watchOrders](#watchorders) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [apex](#apex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-system-time-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchTime ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for account info + +**Kind**: instance method of [apex](#apex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-retrieve-user-account-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchBalance ([params]) +``` + + + + +### fetchAccount{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [apex](#apex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-retrieve-user-account-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchAccount ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [apex](#apex) +**Returns**: object - an associative dictionary of currencies + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-all-config-data-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for apex + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-all-config-data-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [apex](#apex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-ticker-data-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [apex](#apex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-ticker-data-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchTickers (symbols[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-candlestick-chart-data-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +apex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [apex](#apex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-market-depth-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-newest-trading-data-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +apex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [apex](#apex) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-ticker-data-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +apex.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://api-docs.pro.apex.exchange/#publicapi-v3-for-omni-get-funding-rate-history-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +apex.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [apex](#apex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-post-creating-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.timeInForce | string | No | "GTC", "IOC", or "POST_ONLY" | +| params.postOnly | bool | No | true or false | +| params.reduceOnly | bool | No | Ensures that the executed order does not flip the opened position. | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +apex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [apex](#apex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.transferId | string | No | UUID, which is unique across the platform | + + +```javascript +apex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-post-cancel-all-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [apex](#apex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-post-cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [apex](#apex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-order-id +- https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-order-by-clientorderid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +apex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user *classic accounts only* + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-all-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve, default 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | object | No | end time, ms | +| params.status | boolean | No | "PENDING", "OPEN", "FILLED", "CANCELED", "EXPIRED", "UNTRIGGERED" | +| params.side | boolean | No | BUY or SELL | +| params.type | string | No | "LIMIT", "MARKET","STOP_LIMIT", "STOP_MARKET", "TAKE_PROFIT_LIMIT","TAKE_PROFIT_MARKET" | +| params.orderType | string | No | "ACTIVE","CONDITION","HISTORY" | +| params.page | boolean | No | Page numbers start from 0 | + + +```javascript +apex.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetches information on multiple orders made by the user *classic accounts only* + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve, default 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | object | No | end time | +| params.side | boolean | No | BUY or SELL | +| params.orderType | string | No | "LIMIT", "MARKET","STOP_LIMIT", "STOP_MARKET", "TAKE_PROFIT_LIMIT","TAKE_PROFIT_MARKET" | +| params.page | boolean | No | Page numbers start from 0 | + + +```javascript +apex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetches information on multiple orders made by the user *classic accounts only* + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve, default 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | object | No | end time, ms | +| params.side | boolean | No | BUY or SELL | +| params.page | boolean | No | Page numbers start from 0 | + + +```javascript +apex.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [apex](#apex) +**Returns**: object - response from the exchange + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-post-sets-the-initial-margin-rate-of-a-contract + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://api-docs.pro.apex.exchange/#privateapi-v3-for-omni-get-retrieve-user-account-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.fetchPositions ([symbols, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [apex](#apex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [apex](#apex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [apex](#apex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [apex](#apex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchTickers (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [apex](#apex) +**Returns**: object - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://api-docs.pro.apex.exchange/#websocket-v3-for-omni-websocket-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.pro.apex.exchange/#private-websocket + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | + + +```javascript +apex.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://api-docs.pro.apex.exchange/#private-websocket + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchPositions ([symbols, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [apex](#apex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.pro.apex.exchange/#private-websocket + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +apex.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/ascendex.md b/docs/ccxt/wiki/exchanges/ascendex.md new file mode 100644 index 0000000..07cecad --- /dev/null +++ b/docs/ccxt/wiki/exchanges/ascendex.md @@ -0,0 +1,958 @@ + + + +## ascendex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTime](#fetchtime) +* [fetchAccounts](#fetchaccounts) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchPositions](#fetchpositions) +* [fetchFundingRates](#fetchfundingrates) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [setLeverage](#setleverage) +* [setMarginMode](#setmarginmode) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [transfer](#transfer) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchMarginModes](#fetchmarginmodes) +* [fetchLeverages](#fetchleverages) +* [watchOHLCV](#watchohlcv) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchBalance](#watchbalance) +* [watchOrders](#watchorders) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for ascendex + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchMarkets ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the ascendex server + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: int - the current integer timestamp in milliseconds from the ascendex server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchTime ([params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchAccounts ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#cash-account-balance +- https://ascendex.github.io/ascendex-pro-api/#margin-account-balance +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#position + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | wallet type, 'spot', 'margin', or 'swap' | +| params.marginMode | string | No | 'cross' or undefined, for spot margin trading, value of 'isolated' is invalid | + + +```javascript +ascendex.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#ticker +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchTickers (symbols[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +ascendex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://ascendex.github.io/ascendex-pro-api/#market-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchTradingFees ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order on the exchange + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: [An order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#place-order +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#new-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| type | string | Yes | "limit" or "market" | +| side | string | Yes | "buy" or "sell" | +| amount | float | Yes | the amount of currency to trade | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", or "PO" | +| params.postOnly | bool | No | true or false | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | *swap only* take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | *swap only* stop loss trigger price | + + +```javascript +ascendex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#place-batch-orders +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#place-batch-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", or "PO" | +| params.postOnly | bool | No | true or false | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | + + +```javascript +ascendex.createOrders (orders[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#query-order +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#list-open-orders +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-open-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#list-history-orders-v2 +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-current-history-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +ascendex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#cancel-order +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list with a single [order structure](https://docs.ccxt.com/#/?id=order-structure) with the response assigned to the info property + +**See** + +- https://ascendex.github.io/ascendex-pro-api/#cancel-all-orders +- https://ascendex.github.io/ascendex-futures-pro-api-v2/#cancel-all-open-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://ascendex.github.io/ascendex-pro-api/#query-deposit-addresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | unified network code for deposit chain | + + +```javascript +ascendex.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchPositions (symbols[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list of [funding rates structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexe by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchFundingRates (symbols[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.addMargin (symbol, amount[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - response from the exchange + +**See**: https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-contract-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.setLeverage (leverage, symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - response from the exchange + +**See**: https://ascendex.github.io/ascendex-futures-pro-api-v2/#change-margin-type + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchLeverageTiers (symbols[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://ascendex.github.io/ascendex-pro-api/#list-all-assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency codeåå | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://ascendex.github.io/ascendex-futures-pro-api-v2/#funding-payment-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +ascendex.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchMarginModes{docsify-ignore} +fetches the set margin mode of the user + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a list of [margin mode structures](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://ascendex.github.io/ascendex-futures-pro-api-v2/#position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchMarginModes ([symbols, params]) +``` + + + + +### fetchLeverages{docsify-ignore} +fetch the set leverage for all contract markets + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://ascendex.github.io/ascendex-futures-pro-api-v2/#position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.fetchLeverages ([symbols, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://ascendex.github.io/ascendex-pro-api/#channel-bar-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://ascendex.github.io/ascendex-pro-api/#channel-market-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://ascendex.github.io/ascendex-pro-api/#channel-market-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.name | string | No | the name of the method to call, 'trade' or 'aggTrade', default is 'trade' | + + +```javascript +ascendex.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://ascendex.github.io/ascendex-pro-api/#channel-level-2-order-book-updates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://ascendex.github.io/ascendex-pro-api/#channel-order-and-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.watchBalance ([params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [ascendex](#ascendex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://ascendex.github.io/ascendex-pro-api/#channel-order-and-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ascendex.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/backpack.md b/docs/ccxt/wiki/exchanges/backpack.md new file mode 100644 index 0000000..4c54aed --- /dev/null +++ b/docs/ccxt/wiki/exchanges/backpack.md @@ -0,0 +1,1153 @@ + + + +## backpack{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchFundingRate](#fetchfundingrate) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchBalance](#fetchbalance) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [fetchDepositAddress](#fetchdepositaddress) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOpenOrder](#fetchopenorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrders](#fetchorders) +* [fetchPositions](#fetchpositions) +* [fetchFundingHistory](#fetchfundinghistory) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [unWatchTickers](#unwatchtickers) +* [watchBidsAsks](#watchbidsasks) +* [unWatchBidsAsks](#unwatchbidsasks) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [unWatchOHLCVForSymbols](#unwatchohlcvforsymbols) +* [watchTrades](#watchtrades) +* [unWatchTrades](#unwatchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [unWatchOrderBook](#unwatchorderbook) +* [unWatchOrderBookForSymbols](#unwatchorderbookforsymbols) +* [watchOrders](#watchorders) +* [unWatchOrders](#unwatchorders) +* [watchPositions](#watchpositions) +* [unWatchPositions](#unwatchpositions) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.backpack.exchange/#tag/Assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitbank + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_markets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchMarkets ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - A dictionary of [order book structures](https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure) indexed by market symbols + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return (default 100, max 200) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +backpack.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_klines + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in seconds of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch (default 100) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +backpack.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_mark_prices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +Retrieves the open interest of a derivative trading pair + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=interest-history-structure](https://docs.ccxt.com/#/?id=interest-history-structure) + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_open_interest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +backpack.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://docs.backpack.exchange/#tag/Markets/operation/get_funding_interval_rates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of funding rate structures | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.backpack.exchange/#tag/Trades/operation/get_recent_trades +- https://docs.backpack.exchange/#tag/Trades/operation/get_historical_trades + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.offset | int | No | the number of trades to skip, default is 0 | + + +```javascript +backpack.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.backpack.exchange/#tag/History/operation/get_fills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve (default 100, max 1000) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.fillType | string | No | 'User' (default) 'BookLiquidation' or 'Adl' or 'Backstop' or 'Liquidation' or 'AllLiquidation' or 'CollateralConversion' or 'CollateralConversionAndSpotLiquidation' | + + +```javascript +backpack.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://docs.backpack.exchange/#tag/System/operation/get_status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [backpack](#backpack) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://developer-pro.bitmart.com/en/spot/#get-system-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchTime ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.backpack.exchange/#tag/Capital/operation/get_balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchBalance ([params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.backpack.exchange/#tag/Capital/operation/get_deposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +backpack.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.backpack.exchange/#tag/Capital/operation/get_withdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (default 50, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | + + +```javascript +backpack.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.backpack.exchange/#tag/Capital/operation/request_withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the network to withdraw on (mandatory) | + + +```javascript +backpack.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.backpack.exchange/#tag/Capital/operation/get_deposit_address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.networkCode | string | No | the network to fetch the deposit address (mandatory) | + + +```javascript +backpack.fetchDepositAddress (code[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Order/operation/execute_order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *market orders only* the cost of the order in units of the quote currency (could be used instead of amount) | +| params.clientOrderId | int | No | a unique id for the order | +| params.postOnly | boolean | No | true to place a post only order | +| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'PO' | +| params.reduceOnly | bool | No | *contract only* Indicates if this order is to reduce the size of a position | +| params.selfTradePrevention | string | No | one of EXPIRE_MAKER, EXPIRE_TAKER or EXPIRE_BOTH | +| params.autoLend | bool | No | *spot margin only* if true then the order can lend | +| params.autoLendRedeem | bool | No | *spot margin only* if true then the order can redeem a lend if required | +| params.autoBorrow | bool | No | *spot margin only* if true then the order can borrow | +| params.autoBorrowRepay | bool | No | *spot margin only* if true then the order can repay a borrow | +| params.triggerPrice | float | No | the price that a trigger order is triggered at | +| params.takeProfit | object | No | *swap markets only - takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.takeProfit.price | float | No | take profit order price (if not provided the order will be a market order) | +| params.stopLoss | object | No | *swap markets only - stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.stopLoss.price | float | No | stop loss order price (if not provided the order will be a market order) | + + +```javascript +backpack.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Order/operation/execute_order_batch + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.createOrders (orders[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Order/operation/get_open_orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrder{docsify-ignore} +fetch an open order by it's id + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Order/operation/get_order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by hollaex fetchOpenOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchOpenOrder (id, symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Order/operation/cancel_order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Order/operation/cancel_open_orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Order> - a list of [order structures](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://docs.backpack.exchange/#tag/History/operation/get_order_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of orde structures to retrieve (default 100, max 1000) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +backpack.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.backpack.exchange/#tag/Futures/operation/get_positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.fetchPositions (symbols[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetches the history of funding payments + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.backpack.exchange/#tag/History/operation/get_funding_payments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch (default 24 hours ago) | +| limit | int | No | the maximum amount of trades to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade to fetch (default now) | + + +```javascript +backpack.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchTickers (symbols[, params]) +``` + + + + +### unWatchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Book-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchBidsAsks (symbols[, params]) +``` + + + + +### unWatchBidsAsks{docsify-ignore} +unWatches best bid & ask for symbols + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/K-Line + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/K-Line + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/K-Line + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### unWatchOHLCVForSymbols{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/K-Line + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchOHLCVForSymbols (symbolsAndTimeframes[, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchTrades (symbol[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unWatches from the stream channel + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchTrades (symbol[, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +unWatches from the stream channel + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchTradesForSymbols (symbols[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.backpack.exchange/#tag/Streams/Public/Depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2' | + + +```javascript +backpack.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchOrderBook (symbol[, params]) +``` + + + + +### unWatchOrderBookForSymbols{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [backpack](#backpack) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2' | + + +```javascript +backpack.unWatchOrderBookForSymbols (symbols[, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Private/Order-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchOrders ([symbol, since, limit, params]) +``` + + + + +### unWatchOrders{docsify-ignore} +unWatches information on multiple orders made by the user + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Private/Order-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchOrders ([symbol, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Private/Position-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols to watch positions for | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.watchPositions ([symbols, since, limit, params]) +``` + + + + +### unWatchPositions{docsify-ignore} +unWatches from the stream channel + +**Kind**: instance method of [backpack](#backpack) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://docs.backpack.exchange/#tag/Streams/Private/Position-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols to watch positions for | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +backpack.unWatchPositions ([symbols, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bigone.md b/docs/ccxt/wiki/exchanges/bigone.md new file mode 100644 index 0000000..78b6b23 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bigone.md @@ -0,0 +1,550 @@ + + + +## bigone{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTime](#fetchtime) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [transfer](#transfer) +* [withdraw](#withdraw) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bigone](#bigone) +**Returns**: dict - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | dict | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bigone + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://open.big.one/docs/spot_asset_pair.html + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://open.big.one/docs/spot_tickers.html + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://open.big.one/docs/spot_tickers.html + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchTickers ([symbols, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bigone](#bigone) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://open.big.one/docs/spot_ping.html + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchTime ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://open.big.one/docs/contract_misc.html#get-orderbook-snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://open.big.one/docs/spot_asset_pair_trade.html + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://open.big.one/docs/spot_asset_pair_candle.html + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the earliest candle to fetch | + + +```javascript +bigone.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://open.big.one/docs/fund_accounts.html +- https://open.big.one/docs/spot_accounts.html + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchBalance ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.timeInForce | string | No | "GTC", "IOC", or "PO" | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount EXCHANGE SPECIFIC PARAMETERS | +| params.operator | string | No | *stop order only* GTE or LTE (default) | +| params.client_order_id | string | No | must match ^[a-zA-Z0-9-_]{1,36}$ this regex. client_order_id is unique in 24 hours, If created 24 hours later and the order closed, it will be released and can be reused | + + +```javascript +bigone.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | Not used by bigone cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#cancel-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#get-one-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by bigone fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://open.big.one/docs/spot_trade.html#trades-of-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://open.big.one/docs/spot_deposit.html#get-deposite-address-of-one-asset-of-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://open.big.one/docs/spot_deposit.html#deposit-of-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bigone](#bigone) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://open.big.one/docs/spot_withdrawal.html#get-withdrawals-of-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://open.big.one/docs/spot_transfer.html#transfer-of-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | 'SPOT', 'FUND', or 'CONTRACT' | +| toAccount | string | Yes | 'SPOT', 'FUND', or 'CONTRACT' | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bigone](#bigone) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bigone.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/binance.md b/docs/ccxt/wiki/exchanges/binance.md new file mode 100644 index 0000000..37c2a69 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/binance.md @@ -0,0 +1,2665 @@ + + + +## binance{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [enableDemoTrading](#enabledemotrading) +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchStatus](#fetchstatus) +* [fetchTicker](#fetchticker) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchLastPrices](#fetchlastprices) +* [fetchTickers](#fetchtickers) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchMarkPrices](#fetchmarkprices) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [editContractOrder](#editcontractorder) +* [editOrder](#editorder) +* [editOrders](#editorders) +* [createOrders](#createorders) +* [createOrder](#createorder) +* [createMarketOrderWithCost](#createmarketorderwithcost) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOpenOrder](#fetchopenorder) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchMyDustTrades](#fetchmydusttrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [withdraw](#withdraw) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingRates](#fetchfundingrates) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchPosition](#fetchposition) +* [fetchOptionPositions](#fetchoptionpositions) +* [fetchPositions](#fetchpositions) +* [fetchFundingHistory](#fetchfundinghistory) +* [setLeverage](#setleverage) +* [setMarginMode](#setmarginmode) +* [setPositionMode](#setpositionmode) +* [fetchLeverages](#fetchleverages) +* [fetchSettlementHistory](#fetchsettlementhistory) +* [fetchMySettlementHistory](#fetchmysettlementhistory) +* [fetchLedgerEntry](#fetchledgerentry) +* [fetchLedger](#fetchledger) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchCrossBorrowRate](#fetchcrossborrowrate) +* [fetchIsolatedBorrowRate](#fetchisolatedborrowrate) +* [fetchIsolatedBorrowRates](#fetchisolatedborrowrates) +* [fetchBorrowRateHistory](#fetchborrowratehistory) +* [createGiftCode](#creategiftcode) +* [redeemGiftCode](#redeemgiftcode) +* [verifyGiftCode](#verifygiftcode) +* [fetchBorrowInterest](#fetchborrowinterest) +* [repayCrossMargin](#repaycrossmargin) +* [repayIsolatedMargin](#repayisolatedmargin) +* [borrowCrossMargin](#borrowcrossmargin) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [fetchOpenInterestHistory](#fetchopeninteresthistory) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchMyLiquidations](#fetchmyliquidations) +* [fetchGreeks](#fetchgreeks) +* [fetchAllGreeks](#fetchallgreeks) +* [fetchPositionMode](#fetchpositionmode) +* [fetchMarginModes](#fetchmarginmodes) +* [fetchMarginMode](#fetchmarginmode) +* [fetchOption](#fetchoption) +* [fetchMarginAdjustmentHistory](#fetchmarginadjustmenthistory) +* [fetchConvertCurrencies](#fetchconvertcurrencies) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTrade](#fetchconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [fetchFundingIntervals](#fetchfundingintervals) +* [fetchLongShortRatioHistory](#fetchlongshortratiohistory) + + + +### enableDemoTrading{docsify-ignore} +enables or disables demo trading mode + +**Kind**: instance method of [binance](#binance) + +**See** + +- https://www.binance.com/en/support/faq/detail/9be58f73e5e14338809e3b705b9687dd +- https://demo.binance.com/en/my/settings/api-management + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| enable | boolean | No | true if demo trading should be enabled, false otherwise | + + +```javascript +binance.enableDemoTrading ([enable]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [binance](#binance) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#check-server-time // spot +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Check-Server-Time // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Check-Server-time // future + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an associative dictionary of currencies + +**See** + +- https://developers.binance.com/docs/wallet/capital/all-coins-info +- https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for binance + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#exchange-information // spot +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Exchange-Information // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Exchange-Information // future +- https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information // option +- https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs // cross margin +- https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol // isolated margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/account-endpoints#account-information-user_data // spot +- https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details // cross margin +- https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info // isolated margin +- https://developers.binance.com/docs/wallet/asset/funding-wallet // funding +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Futures-Account-Balance-V2 // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Futures-Account-Balance // future +- https://developers.binance.com/docs/derivatives/option/account/Option-Account-Information // option +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Account-Balance // portfolio margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'future', 'delivery', 'savings', 'funding', or 'spot' or 'papi' | +| params.marginMode | string | No | 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null | +| params.symbols | Array<string>, undefined | No | unified market symbols, only used in isolated margin mode | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch the balance for a portfolio margin account | +| params.subType | string | No | 'linear' or 'inverse' | + + +```javascript +binance.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [binance](#binance) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book // spot +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Order-Book // future +- https://developers.binance.com/docs/derivatives/option/market-data/Order-Book // option + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://developers.binance.com/docs/wallet/others/system-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchStatus ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#24hr-ticker-price-change-statistics // spot +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#rolling-window-price-change-statistics // spot +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics // future +- https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics // option + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.rolling | boolean | No | (spot only) default false, if true, uses the rolling 24 hour ticker endpoint /api/v3/ticker | + + +```javascript +binance.fetchTicker (symbol[, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#symbol-order-book-ticker // spot +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Order-Book-Ticker // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Symbol-Order-Book-Ticker // future + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchBidsAsks (symbols[, params]) +``` + + + + +### fetchLastPrices{docsify-ignore} +fetches the last price for multiple markets + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a dictionary of lastprices structures + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#symbol-price-ticker // spot +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Price-Ticker // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Symbol-Price-Ticker // future + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the last prices | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchLastPrices (symbols[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#24hr-ticker-price-change-statistics // spot +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics // swap +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics // future +- https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics // option + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | +| params.type | string | No | 'spot', 'option', use params["subType"] for swap and future markets | + + +```javascript +binance.fetchTickers ([symbols, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches mark price for the market + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-and-Mark-Price +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchMarkPrices{docsify-ignore} +fetches mark prices for multiple markets + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-and-Mark-Price +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchMarkPrices ([symbols, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data +- https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Premium-Index-Kline-Data +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Kline-Candlestick-Data +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Mark-Price-Kline-Candlestick-Data +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Premium-Index-Kline-Data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.price | string | No | "mark" or "index" for mark price and index price candles | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +binance.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol +Default fetchTradesMethod + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#compressedaggregate-trades-list // publicGetAggTrades (spot) +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Compressed-Aggregate-Trades-List // fapiPublicGetAggTrades (swap) +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Compressed-Aggregate-Trades-List // dapiPublicGetAggTrades (future) +- https://developers.binance.com/docs/derivatives/option/market-data/Recent-Trades-List // eapiPublicGetTrades (option) +Other fetchTradesMethod +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#recent-trades-list // publicGetTrades (spot) +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Recent-Trades-List // fapiPublicGetTrades (swap) +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Recent-Trades-List // dapiPublicGetTrades (future) +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#old-trade-lookup // publicGetHistoricalTrades (spot) +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Old-Trades-Lookup // fapiPublicGetHistoricalTrades (swap) +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Old-Trades-Lookup // dapiPublicGetHistoricalTrades (future) +- https://developers.binance.com/docs/derivatives/option/market-data/Old-Trades-Lookup // eapiPublicGetHistoricalTrades (option) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | only used when fetchTradesMethod is 'publicGetAggTrades', 'fapiPublicGetAggTrades', or 'dapiPublicGetAggTrades' | +| limit | int | No | default 500, max 1000 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | only used when fetchTradesMethod is 'publicGetAggTrades', 'fapiPublicGetAggTrades', or 'dapiPublicGetAggTrades' | +| params.fetchTradesMethod | int | No | 'publicGetAggTrades' (spot default), 'fapiPublicGetAggTrades' (swap default), 'dapiPublicGetAggTrades' (future default), 'eapiPublicGetTrades' (option default), 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', 'publicGetHistoricalTrades', 'fapiPublicGetHistoricalTrades', 'dapiPublicGetHistoricalTrades', 'eapiPublicGetHistoricalTrades' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) EXCHANGE SPECIFIC PARAMETERS | +| params.fromId | int | No | trade id to fetch from, default gets most recent trades, not used when fetchTradesMethod is 'publicGetTrades', 'fapiPublicGetTrades', 'dapiPublicGetTrades', or 'eapiPublicGetTrades' | + + +```javascript +binance.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### editContractOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-UM-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-CM-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to edit an order in a portfolio margin account | + + +```javascript +binance.editContractOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#cancel-an-existing-order-and-send-a-new-order-trade +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### editOrders{docsify-ignore} +edit a list of trade orders + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Multiple-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Multiple-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.editOrders (orders[, params]) +``` + + + + +### createOrders{docsify-ignore} +*contract only* create a list of trade orders + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Place-Multiple-Orders +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Place-Multiple-Orders +- https://developers.binance.com/docs/derivatives/option/trade/Place-Multiple-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.createOrders (orders[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade +- https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/trading-endpoints#test-new-order-trade +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Order +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api +- https://developers.binance.com/docs/derivatives/option/trade/New-Order +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#sor +- https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/trading-endpoints#sor +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-Margin-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Conditional-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Conditional-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' or 'STOP_LOSS' or 'STOP_LOSS_LIMIT' or 'TAKE_PROFIT' or 'TAKE_PROFIT_LIMIT' or 'STOP' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.reduceOnly | string | No | for swap and future reduceOnly is a string 'true' or 'false' that cant be sent with close position set to true or in hedge mode. For spot margin and option reduceOnly is a boolean. | +| params.marginMode | string | No | 'cross' or 'isolated', for spot margin trading | +| params.sor | boolean | No | *spot only* whether to use SOR (Smart Order Routing) or not, default is false | +| params.test | boolean | No | *spot only* whether to use the test endpoint or not, default is false | +| params.trailingPercent | float | No | the percent to trail away from the current market price | +| params.trailingTriggerPrice | float | No | the price to trigger a trailing order, default uses the price argument | +| params.triggerPrice | float | No | the price that a trigger order is triggered at | +| params.stopLossPrice | float | No | the price that a stop loss order is triggered at | +| params.takeProfitPrice | float | No | the price that a take profit order is triggered at | +| params.portfolioMargin | boolean | No | set to true if you would like to create an order in a portfolio margin account | +| params.selfTradePrevention | string | No | set unified value for stp, one of NONE, EXPIRE_MAKER, EXPIRE_TAKER or EXPIRE_BOTH | +| params.icebergAmount | float | No | set iceberg amount for limit orders | +| params.stopLossOrTakeProfit | string | No | 'stopLoss' or 'takeProfit', required for spot trailing orders | +| params.positionSide | string | No | *swap and portfolio margin only* "BOTH" for one-way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode | +| params.hedged | bool | No | *swap and portfolio margin only* true for hedged mode, false for one way mode, default is false | + + +```javascript +binance.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createMarketOrderWithCost{docsify-ignore} +create a market order by providing the symbol, side and cost + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.createMarketOrderWithCost (symbol, side, cost[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [binance](#binance) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#query-order-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-Order +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Query-Order +- https://developers.binance.com/docs/derivatives/option/trade/Query-Single-Order +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-UM-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-CM-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated', for spot margin trading | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch an order in a portfolio margin account | + + +```javascript +binance.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#all-orders-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated', for spot margin trading | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch orders in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to fetch portfolio margin account trigger or conditional orders | + + +```javascript +binance.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#current-open-orders-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Current-All-Open-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Current-All-Open-Orders +- https://developers.binance.com/docs/derivatives/option/trade/Query-Current-Open-Option-Orders +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Conditional-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Conditional-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated', for spot margin trading | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch open orders in the portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to fetch portfolio margin account conditional orders | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrder{docsify-ignore} +fetch an open order by the id + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-Current-Open-Order +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Query-Current-Open-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Conditional-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Conditional-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | string | No | set to true if you would like to fetch portfolio margin account stop or conditional orders | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch for a portfolio margin account | + + +```javascript +binance.fetchOpenOrder (id, symbol[, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#all-orders-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch orders in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to fetch portfolio margin account trigger or conditional orders | + + +```javascript +binance.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#all-orders-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch orders in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to fetch portfolio margin account trigger or conditional orders | + + +```javascript +binance.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#all-orders-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/All-Orders +- https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch orders in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to fetch portfolio margin account trigger or conditional orders | + + +```javascript +binance.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [binance](#binance) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#cancel-order-trade +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Order +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Cancel-Order +- https://developers.binance.com/docs/derivatives/option/trade/Cancel-Option-Order +- https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-UM-Conditional-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-CM-Conditional-Order +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to cancel an order in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to cancel a portfolio margin account conditional order | + + +```javascript +binance.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#cancel-all-open-orders-on-a-symbol-trade +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-All-Open-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Cancel-All-Open-Orders +- https://developers.binance.com/docs/derivatives/option/trade/Cancel-all-Option-orders-on-specific-symbol +- https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Conditional-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Conditional-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Cancel-Margin-Account-All-Open-Orders-on-a-Symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated', for spot margin trading | +| params.portfolioMargin | boolean | No | set to true if you would like to cancel orders in a portfolio margin account | +| params.trigger | boolean | No | set to true if you would like to cancel portfolio margin account conditional orders | + + +```javascript +binance.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Multiple-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Cancel-Multiple-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | alternative to ids, array of client order ids EXCHANGE SPECIFIC PARAMETERS | +| params.origClientOrderIdList | Array<string> | No | max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma | +| params.recvWindow | Array<int> | No | | + + +```javascript +binance.cancelOrders (ids[, symbol, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/account-endpoints#account-trade-list-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Account-Trade-List +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Account-Trade-List +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://developers.binance.com/docs/binance-spot-api-docs/rest-api/account-endpoints#account-trade-list-user_data +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Account-Trade-List +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Account-Trade-List +- https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List +- https://developers.binance.com/docs/derivatives/option/trade/Account-Trade-List +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/UM-Account-Trade-List +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/CM-Account-Trade-List + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch trades for a portfolio margin account | + + +```javascript +binance.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyDustTrades{docsify-ignore} +fetch all dust trades made by the user + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://developers.binance.com/docs/wallet/asset/dust-log + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | not used by binance fetchMyDustTrades () | +| since | int | No | the earliest time in ms to fetch my dust trades for | +| limit | int | No | the maximum number of dust trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'margin', default spot | + + +```javascript +binance.fetchMyDustTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://developers.binance.com/docs/wallet/capital/deposite-history +- https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.fiat | bool | No | if true, only fiat deposits will be returned | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +binance.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://developers.binance.com/docs/wallet/capital/withdraw-history +- https://developers.binance.com/docs/fiat/rest-api/Get-Fiat-Deposit-Withdraw-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.fiat | bool | No | if true, only fiat withdrawals will be returned | +| params.until | int | No | the latest time in ms to fetch withdrawals for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +binance.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://developers.binance.com/docs/wallet/asset/user-universal-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | exchange specific transfer type | +| params.symbol | string | No | the unified symbol, required for isolated margin transfers | + + +```javascript +binance.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.internal | boolean | No | default false, when true will fetch pay trade history | + + +```javascript +binance.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://developers.binance.com/docs/wallet/capital/deposite-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | network for fetch deposit address | + + +```javascript +binance.fetchDepositAddress (code[, params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFees instead + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://developers.binance.com/docs/wallet/capital/all-coins-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | not used by binance fetchTransactionFees () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://developers.binance.com/docs/wallet/capital/all-coins-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | not used by binance fetchDepositWithdrawFees () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developers.binance.com/docs/wallet/capital/withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://developers.binance.com/docs/wallet/asset/trade-fee +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/User-Commission-Rate +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/User-Commission-Rate +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-User-Commission-Rate-for-UM +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-User-Commission-Rate-for-CM + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch trading fees in a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See** + +- https://developers.binance.com/docs/wallet/asset/trade-fee +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2 +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Config + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchTradingFees ([params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-and-Mark-Price + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Get-Funding-Rate-History +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Get-Funding-Rate-History-of-Perpetual-Futures + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-and-Mark-Price + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Notional-and-Leverage-Brackets +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Notional-Bracket-for-Pair +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/UM-Notional-and-Leverage-Brackets +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/CM-Notional-and-Leverage-Brackets + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch the leverage tiers for a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchLeverageTiers (symbols[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchPosition (symbol[, params]) +``` + + + + +### fetchOptionPositions{docsify-ignore} +fetch data on open options positions + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchOptionPositions (symbols[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2 +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V2 +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Position-Information +- https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | method name to call, "positionRisk", "account" or "option", default is "positionRisk" | +| params.useV2 | bool | No | set to true if you want to use the obsolete endpoint, where some more additional fields were provided | + + +```javascript +binance.fetchPositions ([symbols, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Income-History +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Get-Income-History +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding history entry | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch the funding history for a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [binance](#binance) +**Returns**: object - response from the exchange + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Change-Initial-Leverage +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Change-Initial-Leverage +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-UM-Initial-Leverage +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Change-CM-Initial-Leverage + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to set the leverage for a trading pair in a portfolio margin account | + + +```javascript +binance.setLeverage (leverage, symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [binance](#binance) +**Returns**: object - response from the exchange + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Change-Margin-Type +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Change-Margin-Type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [binance](#binance) +**Returns**: object - response from the exchange + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Change-Position-Mode +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Change-Position-Mode +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Current-Position-Mode +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Current-Position-Mode + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by binance setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to set the position mode for a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchLeverages{docsify-ignore} +fetch the set leverage for all markets + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2 +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Account-Detail +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Account-Detail +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchLeverages ([symbols, params]) +``` + + + + +### fetchSettlementHistory{docsify-ignore} +fetches historical settlement records + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [settlement history objects](https://docs.ccxt.com/#/?id=settlement-history-structure) + +**See**: https://developers.binance.com/docs/derivatives/option/market-data/Historical-Exercise-Records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records, default 100, max 100 | +| params | object | No | exchange specific params | + + +```javascript +binance.fetchSettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchMySettlementHistory{docsify-ignore} +fetches historical settlement records of the user + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [settlement history objects] + +**See**: https://developers.binance.com/docs/derivatives/option/trade/User-Exercise-Record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | + + +```javascript +binance.fetchMySettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchLedgerEntry{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the identification number of the ledger entry | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchLedgerEntry (id, code[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Income-History +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Get-Income-History +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch the ledger for a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchLedger ([code, since, limit, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Isolated-Position-Margin +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Isolated-Position-Margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Isolated-Position-Margin +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Modify-Isolated-Position-Margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.addMargin (symbol, amount[, params]) +``` + + + + +### fetchCrossBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [borrow rate structure](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchCrossBorrowRate (code[, params]) +``` + + + + +### fetchIsolatedBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [isolated borrow rate structure](https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure) + +**See**: https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.vipLevel | object | No | user's current specific margin data will be returned if viplevel is omitted | + + +```javascript +binance.fetchIsolatedBorrowRate (symbol[, params]) +``` + + + + +### fetchIsolatedBorrowRates{docsify-ignore} +fetch the borrow interest rates of all currencies + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [borrow rate structure](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | object | No | unified market symbol EXCHANGE SPECIFIC PARAMETERS | +| params.vipLevel | object | No | user's current specific margin data will be returned if viplevel is omitted | + + +```javascript +binance.fetchIsolatedBorrowRates ([params]) +``` + + + + +### fetchBorrowRateHistory{docsify-ignore} +retrieves a history of a currencies borrow interest rate at specific time slots + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - an array of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | timestamp for the earliest borrow rate | +| limit | int | No | the maximum number of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchBorrowRateHistory (code[, since, limit, params]) +``` + + + + +### createGiftCode{docsify-ignore} +create gift code + +**Kind**: instance method of [binance](#binance) +**Returns**: object - The gift code id, code, currency and amount + +**See**: https://developers.binance.com/docs/gift_card/market-data/Create-a-single-token-gift-card + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | gift code | +| amount | float | Yes | amount of currency for the gift | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.createGiftCode (code, amount[, params]) +``` + + + + +### redeemGiftCode{docsify-ignore} +redeem gift code + +**Kind**: instance method of [binance](#binance) +**Returns**: object - response from the exchange + +**See**: https://developers.binance.com/docs/gift_card/market-data/Redeem-a-Binance-Gift-Card + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| giftcardCode | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.redeemGiftCode (giftcardCode[, params]) +``` + + + + +### verifyGiftCode{docsify-ignore} +verify gift code + +**Kind**: instance method of [binance](#binance) +**Returns**: object - response from the exchange + +**See**: https://developers.binance.com/docs/gift_card/market-data/Verify-Binance-Gift-Card-by-Gift-Card-Number + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | reference number id | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.verifyGiftCode (id[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See** + +- https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History +- https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-Margin-BorrowLoan-Interest-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| symbol | string | No | unified market symbol when fetch interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch the borrow interest in a portfolio margin account | + + +```javascript +binance.fetchBorrowInterest ([code, symbol, since, limit, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay +- https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Repay-Debt + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to repay margin in a portfolio margin account | +| params.repayCrossMarginMethod | string | No | *portfolio margin only* 'papiPostRepayLoan' (default), 'papiPostMarginRepayDebt' (alternative) | +| params.specifyRepayAssets | string | No | *portfolio margin papiPostMarginRepayDebt only* specific asset list to repay debt | + + +```javascript +binance.repayCrossMargin (code, amount[, params]) +``` + + + + +### repayIsolatedMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for isolated margin | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.repayIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Margin-Account-Borrow + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to borrow margin in a portfolio margin account | + + +```javascript +binance.borrowCrossMargin (code, amount[, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-Account-Borrow-Repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for isolated margin | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### fetchOpenInterestHistory{docsify-ignore} +Retrieves the open interest history of a currency + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an array of [open interest structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Open-Interest-Statistics +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Open-Interest-Statistics + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| timeframe | string | Yes | "5m","15m","30m","1h","2h","4h","6h","12h", or "1d" | +| since | int | No | the time(ms) of the earliest record to retrieve as a unix timestamp | +| limit | int | No | default 30, max 500 | +| params | object | No | exchange specific parameters | +| params.until | int | No | the time(ms) of the latest record to retrieve as a unix timestamp | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +binance.fetchOpenInterestHistory (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Open-Interest +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Open-Interest +- https://developers.binance.com/docs/derivatives/option/market-data/Open-Interest + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +binance.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See** + +- https://developers.binance.com/docs/margin_trading/trade/Get-Force-Liquidation-Record +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Users-Force-Orders +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Users-Force-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-UM-Force-Orders +- https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Query-Users-CM-Force-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the binance api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.paginate | boolean | No | *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch liquidations in a portfolio margin account | +| params.type | string | No | "spot" | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchMyLiquidations ([symbol, since, limit, params]) +``` + + + + +### fetchGreeks{docsify-ignore} +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchGreeks (symbol[, params]) +``` + + + + +### fetchAllGreeks{docsify-ignore} +fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch greeks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchAllGreeks ([symbols, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Current-Position-Mode +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Get-Current-Position-Mode + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchPositionMode (symbol[, params]) +``` + + + + +### fetchMarginModes{docsify-ignore} +fetches margin modes ("isolated" or "cross") that the market for the symbol in in, with symbol=undefined all markets for a subType (linear/inverse) are returned + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a list of [margin mode structures](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2 +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchMarginModes (symbols[, params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of a specific symbol + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Symbol-Config +- https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchMarginMode (symbol[, params]) +``` + + + + +### fetchOption{docsify-ignore} +fetches option data that is commonly found in an option chain + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an [option chain structure](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchOption (symbol[, params]) +``` + + + + +### fetchMarginAdjustmentHistory{docsify-ignore} +fetches the history of margin added or reduced from contract isolated positions + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [margin structures](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Get-Position-Margin-Change-History +- https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Get-Position-Margin-Change-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| type | string | No | "add" or "reduce" | +| since | int | No | timestamp in ms of the earliest change to fetch | +| limit | int | No | the maximum amount of changes to fetch | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | timestamp in ms of the latest change to fetch | + + +```javascript +binance.fetchMarginAdjustmentHistory (symbol[, type, since, limit, params]) +``` + + + + +### fetchConvertCurrencies{docsify-ignore} +fetches all available currencies that can be converted + +**Kind**: instance method of [binance](#binance) +**Returns**: object - an associative dictionary of currencies + +**See**: https://developers.binance.com/docs/convert/market-data/Query-order-quantity-precision-per-asset + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchConvertCurrencies ([params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://developers.binance.com/docs/convert/trade/Send-quote-request + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | Yes | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.walletType | string | No | either 'SPOT' or 'FUNDING', the default is 'SPOT' | + + +```javascript +binance.fetchConvertQuote (fromCode, toCode, amount[, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://developers.binance.com/docs/convert/trade/Accept-Quote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.createConvertTrade (id, fromCode, toCode[, amount, params]) +``` + + + + +### fetchConvertTrade{docsify-ignore} +fetch the data for a conversion trade + +**Kind**: instance method of [binance](#binance) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://developers.binance.com/docs/convert/trade/Order-Status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to fetch | +| code | string | No | the unified currency code of the conversion trade | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +binance.fetchConvertTrade (id[, code, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://developers.binance.com/docs/convert/trade/Get-Convert-Trade-History + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest conversion to fetch | + + +```javascript +binance.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### fetchFundingIntervals{docsify-ignore} +fetch the funding rate interval for multiple markets + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Get-Funding-Rate-Info +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Get-Funding-Info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +binance.fetchFundingIntervals ([symbols, params]) +``` + + + + +### fetchLongShortRatioHistory{docsify-ignore} +fetches the long short ratio history for a unified market symbol + +**Kind**: instance method of [binance](#binance) +**Returns**: Array<object> - an array of [long short ratio structures](https://docs.ccxt.com/#/?id=long-short-ratio-structure) + +**See** + +- https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Long-Short-Ratio +- https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Long-Short-Ratio + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the long short ratio for | +| timeframe | string | No | the period for the ratio, default is 24 hours | +| since | int | No | the earliest time in ms to fetch ratios for | +| limit | int | No | the maximum number of long short ratio structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ratio to fetch | + + +```javascript +binance.fetchLongShortRatioHistory (symbol[, timeframe, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bingx.md b/docs/ccxt/wiki/exchanges/bingx.md new file mode 100644 index 0000000..84df05d --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bingx.md @@ -0,0 +1,1753 @@ + + + +## bingx{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchOrderBook](#fetchorderbook) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchMarkPrices](#fetchmarkprices) +* [fetchBalance](#fetchbalance) +* [fetchPositionHistory](#fetchpositionhistory) +* [fetchPositions](#fetchpositions) +* [fetchPosition](#fetchposition) +* [createMarketOrderWithCost](#createmarketorderwithcost) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [setMarginMode](#setmarginmode) +* [setMargin](#setmargin) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [withdraw](#withdraw) +* [fetchMyLiquidations](#fetchmyliquidations) +* [closePosition](#closeposition) +* [fetchPositionMode](#fetchpositionmode) +* [setPositionMode](#setpositionmode) +* [editOrder](#editorder) +* [fetchMarginMode](#fetchmarginmode) +* [fetchTradingFee](#fetchtradingfee) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTrades](#watchtrades) +* [unWatchTrades](#unwatchtrades) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchBalance](#watchbalance) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the bingx server + +**Kind**: instance method of [bingx](#bingx) +**Returns**: int - the current integer timestamp in milliseconds from the bingx server + +**See**: https://bingx-api.github.io/docs/#/swapV2/base-info.html#Get%20Server%20Time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an associative dictionary of currencies + +**See**: https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bingx + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols +- https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information +- https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Contract%20Information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchMarkets ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bingx-api.github.io/docs/#/swapV2/market-api.html#K-Line%20Data +- https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data +- https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data +- https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20Kline/Candlestick%20Data +- https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bingx.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20transaction%20records +- https://bingx-api.github.io/docs/#/swapV2/market-api.html#The%20latest%20Trade%20of%20a%20Trading%20Pair + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20depth%20information +- https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Market%20Depth +- https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%20Depth%20Data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate +- https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Price%20&%20Current%20Funding%20Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rate for multiple symbols + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchFundingRates ([symbols, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Funding%20Rate%20History + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bingx.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a trading pair + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Swap%20Open%20Positions +- https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20Swap%20Open%20Positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +bingx.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Get%20Ticker +- https://bingx-api.github.io/docs/#/en-us/spot/market-api.html#24-hour%20price%20changes +- https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%2024-Hour%20Price%20Change + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Get%20Ticker +- https://bingx-api.github.io/docs/#/en-us/spot/market-api.html#24-hour%20price%20changes +- https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%2024-Hour%20Price%20Change + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchTickers (symbols[, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches mark prices for the market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchMarkPrices{docsify-ignore} +fetches mark prices for multiple markets + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#Mark%20Price%20and%20Funding%20Rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchMarkPrices ([symbols, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets +- https://bingx-api.github.io/docs/#/swapV2/account-api.html#Get%20Perpetual%20Swap%20Account%20Asset%20Information +- https://bingx-api.github.io/docs/#/standard/contract-interface.html#Query%20standard%20contract%20balance +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Account%20Assets + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.standard | boolean | No | whether to fetch standard contract balances | +| params.type | string | No | the type of balance to fetch (spot, swap, funding) default is `spot` | + + +```javascript +bingx.fetchBalance ([params]) +``` + + + + +### fetchPositionHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Position%20History + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified contract symbol | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum amount of records to fetch | +| params | object | No | extra parameters specific to the exchange api endpoint | +| params.until | int | No | the latest time in ms to fetch positions for | + + +```javascript +bingx.fetchPositionHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20position%20data +- https://bingx-api.github.io/docs/#/en-us/standard/contract-interface.html#position +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20warehouse + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.standard | boolean | No | whether to fetch standard contract positions | + + +```javascript +bingx.fetchPositions (symbols[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20position%20data +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20warehouse + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchPosition (symbol[, params]) +``` + + + + +### createMarketOrderWithCost{docsify-ignore} +create a market order by providing the symbol, side and cost + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.createMarketOrderWithCost (symbol, side, cost[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Trade%20order +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Place%20TWAP%20Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the order | +| params.postOnly | bool | No | true to place a post only order | +| params.timeInForce | string | No | spot supports 'PO', 'GTC' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK' | +| params.reduceOnly | bool | No | *swap only* true or false whether the order is reduce only | +| params.triggerPrice | float | No | triggerPrice at which the attached take profit / stop loss order will be triggered | +| params.stopLossPrice | float | No | stop loss trigger price | +| params.takeProfitPrice | float | No | take profit trigger price | +| params.cost | float | No | the quote quantity that can be used as an alternative for the amount | +| params.trailingAmount | float | No | *swap only* the quote amount to trail away from the current market price | +| params.trailingPercent | float | No | *swap only* the percent to trail away from the current market price | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.test | boolean | No | *swap only* whether to use the test endpoint or not, default is false | +| params.positionSide | string | No | *contracts only* "BOTH" for one way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode | +| params.hedged | boolean | No | *swap only* whether the order is in hedged mode or one way mode | + + +```javascript +bingx.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/spot/trade-api.html#Batch%20Placing%20Orders +- https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Bulk%20order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.sync | boolean | No | *spot only* if true, multiple orders are ordered serially and all orders do not require the same symbol/side/type | + + +```javascript +bingx.createOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20Order +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20Order +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20an%20Order +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20TWAP%20Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +bingx.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20orders%20by%20symbol +- https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20All%20Orders +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20all%20orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.cancelAllOrders ([symbol, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20a%20Batch%20of%20Orders +- https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%20a%20Batch%20of%20Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | client order ids | + + +```javascript +bingx.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - the api result + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20all%20orders%20in%20countdown +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20all%20orders%20in%20countdown + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | spot or swap market | + + +```javascript +bingx.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20details +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20details +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#TWAP%20Order%20Details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.twap | boolean | No | if fetching twap order | + + +```javascript +bingx.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#All%20Orders +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history (returns less fields than above) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.orderId | int | No | Only return subsequent orders, and return the latest order by default | + + +```javascript +bingx.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Current%20Open%20Orders +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Current%20All%20Open%20Orders +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20all%20current%20pending%20orders +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20TWAP%20Entrusted%20Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.twap | boolean | No | if fetching twap open orders | + + +```javascript +bingx.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders +- https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the closed orders | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the max number of closed orders to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.standard | boolean | No | whether to fetch standard contract orders | + + +```javascript +bingx.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders +- https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the canceled orders | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the max number of canceled orders to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.standard | boolean | No | whether to fetch standard contract orders | + + +```javascript +bingx.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders +- https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20TWAP%20Historical%20Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.standard | boolean | No | whether to fetch standard contract orders | +| params.twap | boolean | No | if fetching twap orders | + + +```javascript +bingx.fetchCanceledAndClosedOrders ([symbol, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer%20New + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from (spot, swap, futures, or funding) | +| toAccount | string | Yes | account to transfer to (spot, swap (linear or inverse), future, or funding) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20transfer%20records%20new + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve (default 10, max 100) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.fromAccount | string | Yes | (mandatory) transfer from (spot, swap (linear or inverse), future, or funding) | +| params.toAccount | string | Yes | (mandatory) transfer to (spot, swap(linear or inverse), future, or funding) | +| params.paginate | boolean | No | whether to paginate the results (default false) | + + +```javascript +bingx.fetchTransfers ([code, since, limit, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch the deposit addresses for a currency associated with this account + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a dictionary [address structures](https://docs.ccxt.com/#/?id=address-structure), indexed by the network + +**See**: https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency | + + +```javascript +bingx.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://bingx-api.github.io/docs/#/spot/account-api.html#Deposit%20History(supporting%20network) + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchDeposits ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://bingx-api.github.io/docs/#/spot/account-api.html#Withdraw%20History%20(supporting%20network) + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchWithdrawals ([code, since, limit, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - response from the exchange + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Change%20Margin%20Type +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Set%20Margin%20Type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setMargin{docsify-ignore} +Either adds or reduces margin in an isolated position in order to set the margin to a specific value + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - A [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Adjust%20isolated%20margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to set margin in | +| amount | float | Yes | the amount to set the margin to | +| params | object | No | parameters specific to the bingx api endpoint | + + +```javascript +bingx.setMargin (symbol, amount[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See** + +- https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20Leverage +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Leverage + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - response from the exchange + +**See** + +- https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Switch%20Leverage +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Modify%20Leverage + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | hedged: ['long' or 'short']. one way: ['both'] | + + +```javascript +bingx.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20transaction%20details +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20orders +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20historical%20transaction%20details +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order%20Trade%20Detail + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is undefined | +| params.trandingUnit | string | Yes | COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets) | +| params.orderId | string | Yes | the order id required for inverse swap | + + +```javascript +bingx.fetchMyTrades ([symbol, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins'%20Information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://bingx-api.github.io/docs/#/en-us/spot/wallet-api.html#Withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | No | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.walletType | int | No | 1 fund account, 2 standard account, 3 perpetual account, 15 spot account | + + +```javascript +bingx.withdraw (code, amount, address[, tag, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See** + +- https://bingx-api.github.io/docs/#/swapV2/trade-api.html#User's%20Force%20Orders +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20force%20orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bingx api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | + + +```javascript +bingx.fetchMyLiquidations ([symbol, since, limit, params]) +``` + + + + +### closePosition{docsify-ignore} +closes open positions for a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Close%20all%20positions%20in%20bulk + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | No | not used by bingx | +| params | object | No | extra parameters specific to the bingx api endpoint | +| params.positionId | string, undefined | No | the id of the position you would like to close | + + +```javascript +bingx.closePosition (symbol[, side, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See**: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchPositionMode (symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - response from the exchange + +**See**: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Set%20Position%20Mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by bingx setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.setPositionMode (hedged, symbol[, params]) +``` + + + + +### editOrder{docsify-ignore} +cancels an order and places a new order + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20order%20and%20place%20a%20new%20order // spot +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20an%20order%20and%20then%20Place%20a%20new%20order // swap + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | string | No | Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types. | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price EXCHANGE SPECIFIC PARAMETERS | +| params.cancelClientOrderID | string | No | the user-defined id of the order to be canceled, 1-40 characters, different orders cannot use the same clientOrderID, only supports a query range of 2 hours | +| params.cancelRestrictions | string | No | cancel orders with specified status, NEW: New order, PENDING: Pending order, PARTIALLY_FILLED: Partially filled | +| params.cancelReplaceMode | string | No | STOP_ON_FAILURE - if the cancel order fails, it will not continue to place a new order, ALLOW_FAILURE - regardless of whether the cancel order succeeds or fails, it will continue to place a new order | +| params.quoteOrderQty | float | No | order amount | +| params.newClientOrderId | string | No | custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId. | +| params.positionSide | string | No | *contract only* position direction, required for single position as BOTH, for both long and short positions only LONG or SHORT can be chosen, defaults to LONG if empty | +| params.reduceOnly | string | No | *contract only* true or false, default=false for single position mode. this parameter is not accepted for both long and short positions mode | +| params.priceRate | float | No | *contract only* for type TRAILING_STOP_Market or TRAILING_TP_SL, Max = 1 | +| params.workingType | string | No | *contract only* StopPrice trigger price types, MARK_PRICE (default), CONTRACT_PRICE, or INDEX_PRICE | + + +```javascript +bingx.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of the trading pair + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Type +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Margin%20Type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the margin mode for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchMarginMode (symbol[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Trading%20Commission%20Rate +- https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20Trading%20Commission%20Rate +- https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Trade%20Commission%20Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.fetchTradingFee (symbol[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscribe%20to%2024-hour%20Price%20Change +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20to%2024-hour%20price%20changes +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscribe%20to%2024-Hour%20Price%20Change + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscribe%20to%2024-hour%20Price%20Change +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20to%2024-hour%20price%20changes +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscribe%20to%2024-Hour%20Price%20Change + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.unWatchTicker (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscription%20transaction%20by%20transaction +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20the%20Latest%20Trade%20Detail +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscription%20transaction%20by%20transaction + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.watchTrades (symbol[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unsubscribes from the trades channel + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscription%20transaction%20by%20transaction +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20the%20Latest%20Trade%20Detail +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscription%20transaction%20by%20transaction + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.name | string | No | the name of the method to call, 'trade' or 'aggTrade', default is 'trade' | + + +```javascript +bingx.unWatchTrades (symbol[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscribe%20Market%20Depth%20Data +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20Market%20Depth%20Data +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscribe%20to%20Limited%20Depth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscribe%20Market%20Depth%20Data +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20Market%20Depth%20Data +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscribe%20to%20Limited%20Depth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#K-line%20Streams +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20K-Line%20Data +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscribe%20to%20Latest%20Trading%20Pair%20K-Line + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#K-line%20Streams +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20K-Line%20Data +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/market.html#Subscribe%20to%20Latest%20Trading%20Pair%20K-Line + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20order%20update%20data +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Order%20update%20push +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/account.html#Order%20update%20push + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders are made in | +| since | int | No | the earliest time in ms to watch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.watchOrders ([symbol, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [bingx](#bingx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20order%20update%20data +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Order%20update%20push +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/account.html#Order%20update%20push + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market the trades are made in | +| since | int | No | the earliest time in ms to watch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.watchMyTrades ([symbol, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bingx](#bingx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20account%20balance%20push +- https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push +- https://bingx-api.github.io/docs/#/en-us/cswap/socket/account.html#Account%20balance%20and%20position%20update%20push + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bingx.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bit2c.md b/docs/ccxt/wiki/exchanges/bit2c.md new file mode 100644 index 0000000..0240a20 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bit2c.md @@ -0,0 +1,264 @@ + + + +## bit2c{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrder](#fetchorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddress](#fetchdepositaddress) + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://bit2c.co.il/home/api#balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://bit2c.co.il/home/api#orderb + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://bit2c.co.il/home/api#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://bit2c.co.il/home/api#transactions +- https://bit2c.co.il/home/api#trades + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://bit2c.co.il/home/api#balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchTradingFees ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bit2c.co.il/home/api#addo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bit2c.co.il/home/api#cancelo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | Not used by bit2c cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bit2c.co.il/home/api#geto + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bit2c.co.il/home/api#getoid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://bit2c.co.il/home/api#orderh + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bit2c](#bit2c) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://bit2c.co.il/home/api#addc + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bit2c.fetchDepositAddress (code[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitbank.md b/docs/ccxt/wiki/exchanges/bitbank.md new file mode 100644 index 0000000..ed4941c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitbank.md @@ -0,0 +1,331 @@ + + + +## bitbank{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitbank + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-all-pairs-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-all-pairs-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/public-api.md#candlestick + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#create-new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#fetch-order-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#fetch-active-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#fetch-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#get-withdrawal-accounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitbank](#bitbank) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/bitbankinc/bitbank-api-docs/blob/38d6d7c6f486c793872fd4b4087a0d090a04cd0a/rest-api.md#new-withdrawal-request + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbank.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitbns.md b/docs/ccxt/wiki/exchanges/bitbns.md new file mode 100644 index 0000000..8e6d1be --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitbns.md @@ -0,0 +1,336 @@ + + + +## bitbns{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositAddress](#fetchdepositaddress) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchStatus ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitbns + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchTickers (symbols[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/place-orders +- https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-1/market-orders-quantity // market orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at EXCHANGE SPECIFIC PARAMETERS | +| params.target_rate | float | No | *requires params.trail_rate when set, type must be 'limit'* a bracket order is placed when set | +| params.trail_rate | float | No | *requires params.target_rate when set, type must be 'limit'* a bracket order is placed when set | + + +```javascript +bitbns.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/cancel-orders +- https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-1/cancel-stop-loss-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if cancelling a trigger order | + + +```javascript +bitbns.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-1/order-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/order-status-limit +- https://docs.bitbns.com/bitbns/rest-endpoints/order-apis/version-2/order-status-limit/order-status-stop-limit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if fetching trigger orders | + + +```javascript +bitbns.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitbns](#bitbns) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitbns.fetchDepositAddress (code[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitfinex.md b/docs/ccxt/wiki/exchanges/bitfinex.md new file mode 100644 index 0000000..e4a2743 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitfinex.md @@ -0,0 +1,1142 @@ + + + +## bitfinex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchBalance](#fetchbalance) +* [transfer](#transfer) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [cancelAllOrders](#cancelallorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [fetchOpenOrder](#fetchopenorder) +* [fetchClosedOrder](#fetchclosedorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchTradingFees](#fetchtradingfees) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [withdraw](#withdraw) +* [fetchPositions](#fetchpositions) +* [fetchLedger](#fetchledger) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchOpenInterests](#fetchopeninterests) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchOpenInterestHistory](#fetchopeninteresthistory) +* [fetchLiquidations](#fetchliquidations) +* [setMargin](#setmargin) +* [fetchOrder](#fetchorder) +* [editOrder](#editorder) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchTrades](#watchtrades) +* [unWatchTrades](#unwatchtrades) +* [watchMyTrades](#watchmytrades) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchOrderBook](#watchorderbook) +* [watchBalance](#watchbalance) +* [watchOrders](#watchorders) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-platform-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchStatus ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitfinex + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.bitfinex.com/reference/rest-public-conf + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.bitfinex.com/reference/rest-public-conf + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchCurrencies ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-wallets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchBalance ([params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.bitfinex.com/reference/rest-public-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return, bitfinex only allows 1, 25, or 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.bitfinex.com/reference/rest-public-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch, default 120, max 10000 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +bitfinex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.bitfinex.com/reference/rest-public-candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch, default 100 max 10000 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitfinex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create an order on the exchange + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-submit-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| type | string | Yes | 'limit' or 'market' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | the amount of currency to trade | +| price | float | No | price of the order | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price that triggers a trigger order | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", or "PO" | +| params.postOnly | boolean | No | set to true if you want to make a post only order | +| params.reduceOnly | boolean | No | indicates that the order is to reduce the size of a position | +| params.flags | int | No | additional order parameters: 4096 (Post Only), 1024 (Reduce Only), 16384 (OCO), 64 (Hidden), 512 (Close), 524288 (No Var Rates) | +| params.lev | int | No | leverage for a derivative order, supported by derivative symbol orders only. The value should be between 1 and 100 inclusive. | +| params.price_aux_limit | string | No | order price for stop limit orders | +| params.price_oco_stop | string | No | OCO stop price | +| params.trailingAmount | string | No | *swap only* the quote amount to trail away from the current market price | + + +```javascript +bitfinex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-order-multi + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.createOrders (orders[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-cancel-orders-multiple + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | Not used by bitfinex cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders at the same time + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an array of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-cancel-orders-multiple + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.cancelOrders (ids, symbol[, params]) +``` + + + + +### fetchOpenOrder{docsify-ignore} +fetch an open order by it's id + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchOpenOrder (id, symbol[, params]) +``` + + + + +### fetchClosedOrder{docsify-ignore} +fetch an open order by it's id + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchClosedOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitfinex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-order-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.bitfinex.com/reference/rest-auth-trades +- https://docs.bitfinex.com/reference/rest-auth-trades-by-symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchDepositAddress (code[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.bitfinex.com/reference/rest-auth-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchTradingFees ([params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.bitfinex.com/reference/movement-info +- https://docs.bitfinex.com/reference/rest-auth-movements + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchPositions (symbols[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://docs.bitfinex.com/reference/rest-auth-ledgers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined, max is 2500 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitfinex.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rate for multiple symbols + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-derivatives-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-derivatives-status-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | timestamp in ms of the earliest funding rate entry | +| limit | int | No | max number of funding rate entrys to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitfinex.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchOpenInterests{docsify-ignore} +Retrieves the open interest for a list of symbols + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-derivatives-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified CCXT market symbols | +| params | object | No | exchange specific parameters | + + +```javascript +bitfinex.fetchOpenInterests ([symbols, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [open interest structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-derivatives-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +bitfinex.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchOpenInterestHistory{docsify-ignore} +retrieves the open interest history of a currency + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: An array of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-derivatives-status-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| timeframe | string | Yes | the time period of each row of data, not used by bitfinex | +| since | int | No | the time in ms of the earliest record to retrieve as a unix timestamp | +| limit | int | No | the number of records in the response | +| params | object | No | exchange specific parameters | +| params.until | int | No | the time in ms of the latest record to retrieve as a unix timestamp | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitfinex.fetchOpenInterestHistory (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchLiquidations{docsify-ignore} +retrieves the public liquidations of a trading pair + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://docs.bitfinex.com/reference/rest-public-liquidations + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitfinex.fetchLiquidations (symbol[, since, limit, params]) +``` + + + + +### setMargin{docsify-ignore} +either adds or reduces margin in a swap position in order to set the margin to a specific value + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - A [margin structure](https://github.com/ccxt/ccxt/wiki/Manual#add-margin-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-deriv-pos-collateral-set + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to set margin in | +| amount | float | Yes | the amount to set the margin to | +| params | object | No | parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.setMargin (symbol, amount[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders +- https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.fetchOrder (id[, symbol, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitfinex.com/reference/rest-auth-update-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | edit order id | +| symbol | string | Yes | unified symbol of the market to edit an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price that triggers a trigger order | +| params.postOnly | boolean | No | set to true if you want to make a post only order | +| params.reduceOnly | boolean | No | indicates that the order is to reduce the size of a position | +| params.flags | int | No | additional order parameters: 4096 (Post Only), 1024 (Reduce Only), 16384 (OCO), 64 (Hidden), 512 (Close), 524288 (No Var Rates) | +| params.leverage | int | No | leverage for a derivative order, supported by derivative symbol orders only, the value should be between 1 and 100 inclusive | +| params.clientOrderId | int | No | a unique client order id for the order | +| params.trailingAmount | float | No | *swap only* the quote amount to trail away from the current market price | + + +```javascript +bitfinex.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: bool - true if successfully unsubscribed, false otherwise + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unWatches the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.unWatchTrades (symbol[, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.unWatchTicker (symbol[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | str | No | spot or contract if not provided this.options['defaultType'] is used | + + +```javascript +bitfinex.watchBalance ([params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bitfinex](#bitfinex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitfinex.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitflyer.md b/docs/ccxt/wiki/exchanges/bitflyer.md new file mode 100644 index 0000000..2c4474c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitflyer.md @@ -0,0 +1,425 @@ + + + +## bitflyer{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrder](#fetchorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchPositions](#fetchpositions) +* [withdraw](#withdraw) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchFundingRate](#fetchfundingrate) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitflyer + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://lightning.bitflyer.com/docs?lang=en#market-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#get-account-asset-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://lightning.bitflyer.com/docs?lang=en#order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://lightning.bitflyer.com/docs?lang=en#list-executions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#get-trading-commission + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchTradingFee (symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#send-a-new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#list-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#list-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#list-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#list-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#list-executions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#get-open-interest-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchPositions (symbols[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#withdrawing-funds + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#get-crypto-assets-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://lightning.bitflyer.com/docs?lang=en#get-crypto-assets-transaction-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [bitflyer](#bitflyer) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://lightning.bitflyer.com/docs#funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitflyer.fetchFundingRate (symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitget.md b/docs/ccxt/wiki/exchanges/bitget.md new file mode 100644 index 0000000..5851cd6 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitget.md @@ -0,0 +1,4752 @@ + + + +## bitget{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [fetchDeposits](#fetchdeposits) +* [withdraw](#withdraw) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [fetchLedger](#fetchledger) +* [fetchMyTrades](#fetchmytrades) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingHistory](#fetchfundinghistory) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [setMarginMode](#setmarginmode) +* [setPositionMode](#setpositionmode) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchTransfers](#fetchtransfers) +* [transfer](#transfer) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [borrowCrossMargin](#borrowcrossmargin) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [repayIsolatedMargin](#repayisolatedmargin) +* [repayCrossMargin](#repaycrossmargin) +* [fetchMyLiquidations](#fetchmyliquidations) +* [fetchIsolatedBorrowRate](#fetchisolatedborrowrate) +* [fetchCrossBorrowRate](#fetchcrossborrowrate) +* [fetchBorrowInterest](#fetchborrowinterest) +* [closePosition](#closeposition) +* [closeAllPositions](#closeallpositions) +* [fetchMarginMode](#fetchmarginmode) +* [fetchPositionsHistory](#fetchpositionshistory) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [fetchConvertCurrencies](#fetchconvertcurrencies) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchLongShortRatioHistory](#fetchlongshortratiohistory) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [watchPositions](#watchpositions) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchBalance](#watchbalance) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bitget](#bitget) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://www.bitget.com/api-doc/common/public/Get-Server-Time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitget + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Symbols +- https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts +- https://www.bitget.com/api-doc/margin/common/support-currencies +- https://www.bitget.com/api-doc/uta/public/Instruments + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.bitget.com/api-doc/spot/market/Get-Coin-List + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchCurrencies ([params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/Get-Query-Position-Lever +- https://www.bitget.com/api-doc/margin/cross/account/Cross-Tier-Data +- https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Tier-Data +- https://www.bitget.com/api-doc/uta/public/Get-Position-Tier-Data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | for spot margin 'cross' or 'isolated', default is 'isolated' | +| params.code | string | No | required for cross spot margin | +| params.productType | string | No | *contract and uta only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchMarketLeverageTiers (symbol[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Deposit-Record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in milliseconds | +| params.idLessThan | string | No | return records with id less than the provided value | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchDeposits (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Wallet-Withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.chain | string | No | the blockchain network the withdrawal is taking place on | + + +```javascript +bitget.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Withdraw-Record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in milliseconds | +| params.idLessThan | string | No | return records with id less than the provided value | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Deposit-Address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchDepositAddress (code[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Orderbook +- https://www.bitget.com/api-doc/contract/market/Get-Merge-Depth +- https://www.bitget.com/api-doc/uta/public/OrderBook + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Tickers +- https://www.bitget.com/api-doc/contract/market/Get-Ticker +- https://www.bitget.com/api-doc/uta/public/Tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchTicker (symbol[, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches the mark price for a specific market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitget.com/api-doc/contract/market/Get-Symbol-Price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Tickers +- https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker +- https://www.bitget.com/api-doc/uta/public/Tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.subType | string | No | *contract only* 'linear', 'inverse' | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | + + +```javascript +bitget.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Recent-Trades +- https://www.bitget.com/api-doc/spot/market/Get-Market-Trades +- https://www.bitget.com/api-doc/contract/market/Get-Recent-Fills +- https://www.bitget.com/api-doc/contract/market/Get-Fills-History +- https://www.bitget.com/api-doc/uta/public/Fills + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.until | int | No | *only applies to publicSpotGetV2SpotMarketFillsHistory and publicMixGetV2MixMarketFillsHistory* the latest time in ms to fetch trades for | +| params.paginate | boolean | No | *only applies to publicSpotGetV2SpotMarketFillsHistory and publicMixGetV2MixMarketFillsHistory* default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +bitget.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitget.com/api-doc/common/public/Get-Trade-Rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross', for finding the fee rate of spot margin trading pairs | + + +```javascript +bitget.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Symbols +- https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts +- https://www.bitget.com/api-doc/margin/common/support-currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.margin | boolean | No | set to true for spot margin | + + +```javascript +bitget.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Candle-Data +- https://www.bitget.com/api-doc/spot/market/Get-History-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-History-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-History-Index-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-History-Mark-Candle-Data +- https://www.bitget.com/api-doc/uta/public/Get-Candle-Data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.useHistoryEndpoint | boolean | No | whether to force to use historical endpoint (it has max limit of 200) | +| params.useHistoryEndpointForPagination | boolean | No | whether to force to use historical endpoint for pagination (default true) | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.price | string | No | *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles) | + + +```javascript +bitget.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/account/Get-Account-Assets +- https://www.bitget.com/api-doc/contract/account/Get-Account-List +- https://www.bitget.com/api-doc/margin/cross/account/Get-Cross-Assets +- https://www.bitget.com/api-doc/margin/isolated/account/Get-Isolated-Assets +- https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-assets +- https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-assets +- https://www.bitget.com/api-doc/uta/account/Get-Account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | string | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchBalance ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Place-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Place-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Place-Order +- https://www.bitget.com/api-doc/spot/plan/Place-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Place-Order +- https://www.bitget.com/api-doc/contract/plan/Place-Tpsl-Order +- https://www.bitget.com/api-doc/contract/plan/Place-Plan-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Place-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order +- https://www.bitget.com/api-doc/uta/trade/Place-Order +- https://www.bitget.com/api-doc/uta/strategy/Place-Strategy-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *spot only* how much you want to trade in units of the quote currency, for market buy orders only | +| params.triggerPrice | float | No | *swap only* The price at which a trigger order is triggered at | +| params.stopLossPrice | float | No | *swap only* The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | *swap only* The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | *swap only* take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | *swap only* stop loss trigger price | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", or "PO" | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.loanType | string | No | *spot margin only* 'normal', 'autoLoan', 'autoRepay', or 'autoLoanAndRepay' default is 'normal' | +| params.holdSide | string | No | *contract stopLossPrice, takeProfitPrice only* Two-way position: ('long' or 'short'), one-way position: ('buy' or 'sell') | +| params.stopLoss.price | float | No | *swap only* the execution price for a stop loss attached to a trigger order | +| params.takeProfit.price | float | No | *swap only* the execution price for a take profit attached to a trigger order | +| params.stopLoss.type | string | No | *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.takeProfit.type | string | No | *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.trailingPercent | string | No | *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10 | +| params.trailingTriggerPrice | string | No | *swap and future only* the price to trigger a trailing stop order, default uses the price argument | +| params.triggerType | string | No | *swap and future only* 'fill_price', 'mark_price' or 'index_price' | +| params.oneWayMode | boolean | No | *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method | +| params.hedged | bool | No | *swap and future only* true for hedged mode, false for one way mode, default is false | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.posSide | string | No | *uta only* hedged two-way position side, long or short | + + +```javascript +bitget.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders (all orders should be of the same symbol) + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Batch-Place-Orders +- https://www.bitget.com/api-doc/contract/trade/Batch-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Batch-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Batch-Order +- https://www.bitget.com/api-doc/uta/trade/Place-Batch + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the api endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/plan/Modify-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Modify-Order +- https://www.bitget.com/api-doc/contract/plan/Modify-Tpsl-Order +- https://www.bitget.com/api-doc/contract/plan/Modify-Plan-Order +- https://www.bitget.com/api-doc/uta/trade/Modify-Order +- https://www.bitget.com/api-doc/uta/strategy/Modify-Strategy-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price that a trigger order is triggered at | +| params.stopLossPrice | float | No | *swap only* The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | *swap only* The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | *swap only* take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | *swap only* stop loss trigger price | +| params.stopLoss.price | float | No | *swap only* the execution price for a stop loss attached to a trigger order | +| params.takeProfit.price | float | No | *swap only* the execution price for a take profit attached to a trigger order | +| params.stopLoss.type | string | No | *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.takeProfit.type | string | No | *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.trailingPercent | string | No | *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10 | +| params.trailingTriggerPrice | string | No | *swap and future only* the price to trigger a trailing stop order, default uses the price argument | +| params.newTriggerType | string | No | *swap and future only* 'fill_price', 'mark_price' or 'index_price' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Cancel-Order +- https://www.bitget.com/api-doc/spot/plan/Cancel-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Cancel-Order +- https://www.bitget.com/api-doc/contract/plan/Cancel-Plan-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Cancel-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Cancel-Order +- https://www.bitget.com/api-doc/uta/trade/Cancel-Order +- https://www.bitget.com/api-doc/uta/strategy/Cancel-Strategy-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.trigger | boolean | No | set to true for canceling trigger orders | +| params.planType | string | No | *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan | +| params.trailing | boolean | No | set to true if you want to cancel a trailing order | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.clientOrderId | string | No | the clientOrderId of the order, id does not need to be provided if clientOrderId is provided | + + +```javascript +bitget.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an array of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Batch-Cancel-Orders +- https://www.bitget.com/api-doc/contract/trade/Batch-Cancel-Orders +- https://www.bitget.com/api-doc/contract/plan/Cancel-Plan-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Batch-Cancel-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Batch-Cancel-Orders +- https://www.bitget.com/api-doc/uta/trade/Cancel-Batch + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.trigger | boolean | No | *contract only* set to true for canceling trigger orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Cancel-Symbol-Orders +- https://www.bitget.com/api-doc/spot/plan/Batch-Cancel-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Batch-Cancel-Orders +- https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders +- https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order +- https://www.bitget.com/api-doc/uta/trade/Cancel-All-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.trigger | boolean | No | *contract only* set to true for canceling trigger orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-Order-Info +- https://www.bitget.com/api-doc/contract/trade/Get-Order-Details +- https://www.bitget.com/api-doc/uta/trade/Get-Order-Details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.clientOrderId | string | No | the clientOrderId of the order, id does not need to be provided if clientOrderId is provided | + + +```javascript +bitget.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-Unfilled-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-Current-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-Pending +- https://www.bitget.com/api-doc/contract/plan/get-orders-plan-pending +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Open-Orders +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Open-Orders +- https://www.bitget.com/api-doc/uta/strategy/Get-Unfilled-Strategy-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-History-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-History-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-History +- https://www.bitget.com/api-doc/contract/plan/orders-plan-history +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History +- https://www.bitget.com/api-doc/uta/trade/Get-Order-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the closed orders | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the max number of closed orders to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | + + +```javascript +bitget.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-History-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-History-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-History +- https://www.bitget.com/api-doc/contract/plan/orders-plan-history +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History +- https://www.bitget.com/api-doc/uta/trade/Get-Order-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the canceled orders | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the max number of canceled orders to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | + + +```javascript +bitget.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple canceled and closed orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-History-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-History-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-History +- https://www.bitget.com/api-doc/contract/plan/orders-plan-history +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History +- https://www.bitget.com/api-doc/uta/trade/Get-Order-History +- https://www.bitget.com/api-doc/uta/strategy/Get-History-Strategy-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://www.bitget.com/api-doc/spot/account/Get-Account-Bills +- https://www.bitget.com/api-doc/contract/account/Get-Account-Bill + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.symbol | string | No | *contract only* unified market symbol | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-Fills +- https://www.bitget.com/api-doc/contract/trade/Get-Order-Fills +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-Fills +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Transaction-Details +- https://www.bitget.com/api-doc/uta/trade/Get-Order-Fills + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/get-single-position +- https://www.bitget.com/api-doc/uta/trade/Get-Position + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/get-all-position +- https://www.bitget.com/api-doc/contract/position/Get-History-Position +- https://www.bitget.com/api-doc/uta/trade/Get-Position + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginCoin | string | No | the settle currency of the positions, needs to match the productType | +| params.productType | string | No | 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.useHistoryEndpoint | boolean | No | default false, when true will use the historic endpoint to fetch positions | +| params.method | string | No | either (default) 'privateMixGetV2MixPositionAllPosition', 'privateMixGetV2MixPositionHistoryPosition', or 'privateUtaGetV3PositionCurrentPosition' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchPositions ([symbols, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-History-Funding-Rate +- https://www.bitget.com/api-doc/uta/public/Get-History-Funding-Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of funding rate structures to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate +- https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time +- https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.method | string | No | either (default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime' | + + +```javascript +bitget.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rates for all markets + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a dictionary of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | *contract only* 'linear', 'inverse' | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | + + +```javascript +bitget.fetchFundingRates ([symbols, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the funding history + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [funding history structures](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Get-Account-Bill + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the starting timestamp in milliseconds | +| limit | int | No | the number of entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch funding history for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Change-Margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Change-Margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.addMargin (symbol, amount[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Get-Single-Account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - response from the exchange + +**See** + +- https://www.bitget.com/api-doc/contract/account/Change-Leverage +- https://www.bitget.com/api-doc/uta/account/Change-Leverage + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | int | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.holdSide | string | No | *isolated only* position direction, 'long' or 'short' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.posSide | boolean | No | required for uta isolated margin, long or short | + + +```javascript +bitget.setLeverage (leverage, symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - response from the exchange + +**See**: https://www.bitget.com/api-doc/contract/account/Change-Margin-Mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - response from the exchange + +**See** + +- https://www.bitget.com/api-doc/contract/account/Change-Hold-Mode +- https://www.bitget.com/api-doc/uta/account/Change-Position-Mode + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by bitget setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | required if not uta and symbol is undefined: 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-Open-Interest +- https://www.bitget.com/api-doc/uta/public/Get-Open-Interest + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Account-TransferRecords + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +bitget.fetchTransfers (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Wallet-Transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | unified CCXT market symbol, required when transferring to or from an account type that is a leveraged position-by-position account | +| params.clientOid | string | No | custom id | + + +```javascript +bitget.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitget.com/api-doc/spot/market/Get-Coin-List + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/cross/account/Cross-Borrow + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | string | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.borrowCrossMargin (code, amount[, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Borrow + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | string | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### repayIsolatedMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to repay | +| amount | string | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.repayIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/cross/account/Cross-Repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | string | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.repayCrossMargin (code, amount[, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See** + +- https://www.bitget.com/api-doc/margin/cross/record/Get-Cross-Liquidation-Records +- https://www.bitget.com/api-doc/margin/isolated/record/Get-Isolated-Liquidation-Records + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitget api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.marginMode | string | No | 'cross' or 'isolated' default value is 'cross' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchMyLiquidations ([symbol, since, limit, params]) +``` + + + + +### fetchIsolatedBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [isolated borrow rate structure](https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure) + +**See**: https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Margin-Interest-Rate-And-Max-Borrowable-Amount + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchIsolatedBorrowRate (symbol[, params]) +``` + + + + +### fetchCrossBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [borrow rate structure](https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure) + +**See** + +- https://www.bitget.com/api-doc/margin/cross/account/Get-Cross-Margin-Interest-Rate-And-Borrowable +- https://www.bitget.com/api-doc/uta/public/Get-Margin-Loans + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchCrossBorrowRate (code[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See** + +- https://www.bitget.com/api-doc/margin/cross/record/Get-Cross-Interest-Records +- https://www.bitget.com/api-doc/margin/isolated/record/Get-Isolated-Interest-Records + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| symbol | string | No | unified market symbol when fetching interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchBorrowInterest ([code, symbol, since, limit, params]) +``` + + + + +### closePosition{docsify-ignore} +closes an open position for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position +- https://www.bitget.com/api-doc/uta/trade/Close-All-Positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| side | string | No | one-way mode: 'buy' or 'sell', hedge-mode: 'long' or 'short' | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.closePosition (symbol[, side, params]) +``` + + + + +### closeAllPositions{docsify-ignore} +closes all open positions for a market type + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - A list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position +- https://www.bitget.com/api-doc/uta/trade/Close-All-Positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.closeAllPositions ([params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of a trading pair + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Get-Single-Account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the margin mode for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchMarginMode (symbol[, params]) +``` + + + + +### fetchPositionsHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/Get-History-Position +- https://www.bitget.com/api-doc/uta/trade/Get-Position-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified contract symbols | +| since | int | No | timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months | +| limit | int | No | the maximum amount of records to fetch, default=20, max=100 | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months | +| params.productType | string | No | USDT-FUTURES (default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchPositionsHistory ([symbols, since, limit, params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.bitget.com/api-doc/common/convert/Get-Quoted-Price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchConvertQuote (fromCode, toCode[, amount, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.bitget.com/api-doc/common/convert/Trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | Yes | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.price | string | Yes | the price of the conversion, obtained from fetchConvertQuote() | +| params.toAmount | string | Yes | the amount you want to trade in units of the toCurrency, obtained from fetchConvertQuote() | + + +```javascript +bitget.createConvertTrade (id, fromCode, toCode, amount[, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.bitget.com/api-doc/common/convert/Get-Convert-Record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### fetchConvertCurrencies{docsify-ignore} +fetches all available currencies that can be converted + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.bitget.com/api-doc/common/convert/Get-Convert-Currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchConvertCurrencies ([params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time +- https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchLongShortRatioHistory{docsify-ignore} +fetches the long short ratio history for a unified market symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - an array of [long short ratio structures](https://docs.ccxt.com/#/?id=long-short-ratio-structure) + +**See** + +- https://www.bitget.com/api-doc/common/apidata/Margin-Ls-Ratio +- https://www.bitget.com/api-doc/common/apidata/Account-Long-Short + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the long short ratio for | +| timeframe | string | No | the period for the ratio | +| since | int | No | the earliest time in ms to fetch ratios for | +| limit | int | No | the maximum number of long short ratio structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchLongShortRatioHistory (symbol[, timeframe, since, limit, params]) +``` + + + + +### bitget{docsify-ignore} +watching delivery future markets is not yet implemented (perpertual future & swap is implemented) + + + +```javascript +bitget.bitget () +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to watch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unsubscribe from the ticker channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: any - status of the unwatch request + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to watch the tickers for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unsubscribe from the ohlcv channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the ohlcv for | +| timeframe | string | No | the period for the ratio, default is 1 minute | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.unWatchOHLCV (symbol[, timeframe, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Depth-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Order-Book-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Order-Book-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unsubscribe from the orderbook channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Depth-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Order-Book-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Order-Book-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | orderbook limit, default is undefined | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Depth-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Order-Book-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Order-Book-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unsubscribe from the trades channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: any - status of the unwatch request + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.unWatchTrades (symbol[, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/websocket/private/Positions-Channel +- https://www.bitget.com/api-doc/uta/websocket/private/Positions-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | one of 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES', default is 'USDT-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchPositions (symbols[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/private/Order-Channel +- https://www.bitget.com/api-doc/contract/websocket/private/Order-Channel +- https://www.bitget.com/api-doc/contract/websocket/private/Plan-Order-Channel +- https://www.bitget.com/api-doc/margin/cross/websocket/private/Cross-Orders +- https://www.bitget.com/api-doc/margin/isolated/websocket/private/Isolate-Orders +- https://www.bitget.com/api-doc/uta/websocket/private/Order-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | *contract only* set to true for watching trigger orders | +| params.marginMode | string | No | 'isolated' or 'cross' for watching spot margin orders] | +| params.type | string | No | 'spot', 'swap' | +| params.subType | string | No | 'linear', 'inverse' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches trades made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/websocket/private/Fill-Channel +- https://www.bitget.com/api-doc/uta/websocket/private/Fill-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | str | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/private/Account-Channel +- https://www.bitget.com/api-doc/contract/websocket/private/Account-Channel +- https://www.bitget.com/api-doc/margin/cross/websocket/private/Margin-Cross-Account-Assets +- https://www.bitget.com/api-doc/margin/isolated/websocket/private/Margin-isolated-account-assets +- https://www.bitget.com/api-doc/uta/websocket/private/Account-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | str | No | spot or contract if not provided this.options['defaultType'] is used | +| params.instType | string | No | one of 'SPOT', 'MARGIN', 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.marginMode | string | No | 'isolated' or 'cross' for watching spot margin balances | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchBalance ([params]) +``` + + + + +## bitget{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [fetchDeposits](#fetchdeposits) +* [withdraw](#withdraw) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [fetchLedger](#fetchledger) +* [fetchMyTrades](#fetchmytrades) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingHistory](#fetchfundinghistory) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [setMarginMode](#setmarginmode) +* [setPositionMode](#setpositionmode) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchTransfers](#fetchtransfers) +* [transfer](#transfer) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [borrowCrossMargin](#borrowcrossmargin) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [repayIsolatedMargin](#repayisolatedmargin) +* [repayCrossMargin](#repaycrossmargin) +* [fetchMyLiquidations](#fetchmyliquidations) +* [fetchIsolatedBorrowRate](#fetchisolatedborrowrate) +* [fetchCrossBorrowRate](#fetchcrossborrowrate) +* [fetchBorrowInterest](#fetchborrowinterest) +* [closePosition](#closeposition) +* [closeAllPositions](#closeallpositions) +* [fetchMarginMode](#fetchmarginmode) +* [fetchPositionsHistory](#fetchpositionshistory) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [fetchConvertCurrencies](#fetchconvertcurrencies) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchLongShortRatioHistory](#fetchlongshortratiohistory) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [watchPositions](#watchpositions) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchBalance](#watchbalance) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bitget](#bitget) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://www.bitget.com/api-doc/common/public/Get-Server-Time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitget + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Symbols +- https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts +- https://www.bitget.com/api-doc/margin/common/support-currencies +- https://www.bitget.com/api-doc/uta/public/Instruments + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.bitget.com/api-doc/spot/market/Get-Coin-List + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchCurrencies ([params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/Get-Query-Position-Lever +- https://www.bitget.com/api-doc/margin/cross/account/Cross-Tier-Data +- https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Tier-Data +- https://www.bitget.com/api-doc/uta/public/Get-Position-Tier-Data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | for spot margin 'cross' or 'isolated', default is 'isolated' | +| params.code | string | No | required for cross spot margin | +| params.productType | string | No | *contract and uta only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchMarketLeverageTiers (symbol[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Deposit-Record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in milliseconds | +| params.idLessThan | string | No | return records with id less than the provided value | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchDeposits (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Wallet-Withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.chain | string | No | the blockchain network the withdrawal is taking place on | + + +```javascript +bitget.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Withdraw-Record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in milliseconds | +| params.idLessThan | string | No | return records with id less than the provided value | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Deposit-Address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchDepositAddress (code[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Orderbook +- https://www.bitget.com/api-doc/contract/market/Get-Merge-Depth +- https://www.bitget.com/api-doc/uta/public/OrderBook + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Tickers +- https://www.bitget.com/api-doc/contract/market/Get-Ticker +- https://www.bitget.com/api-doc/uta/public/Tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchTicker (symbol[, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches the mark price for a specific market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitget.com/api-doc/contract/market/Get-Symbol-Price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Tickers +- https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker +- https://www.bitget.com/api-doc/uta/public/Tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.subType | string | No | *contract only* 'linear', 'inverse' | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | + + +```javascript +bitget.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Recent-Trades +- https://www.bitget.com/api-doc/spot/market/Get-Market-Trades +- https://www.bitget.com/api-doc/contract/market/Get-Recent-Fills +- https://www.bitget.com/api-doc/contract/market/Get-Fills-History +- https://www.bitget.com/api-doc/uta/public/Fills + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.until | int | No | *only applies to publicSpotGetV2SpotMarketFillsHistory and publicMixGetV2MixMarketFillsHistory* the latest time in ms to fetch trades for | +| params.paginate | boolean | No | *only applies to publicSpotGetV2SpotMarketFillsHistory and publicMixGetV2MixMarketFillsHistory* default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +bitget.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitget.com/api-doc/common/public/Get-Trade-Rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross', for finding the fee rate of spot margin trading pairs | + + +```javascript +bitget.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Symbols +- https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts +- https://www.bitget.com/api-doc/margin/common/support-currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.margin | boolean | No | set to true for spot margin | + + +```javascript +bitget.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.bitget.com/api-doc/spot/market/Get-Candle-Data +- https://www.bitget.com/api-doc/spot/market/Get-History-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-History-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-History-Index-Candle-Data +- https://www.bitget.com/api-doc/contract/market/Get-History-Mark-Candle-Data +- https://www.bitget.com/api-doc/uta/public/Get-Candle-Data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.useHistoryEndpoint | boolean | No | whether to force to use historical endpoint (it has max limit of 200) | +| params.useHistoryEndpointForPagination | boolean | No | whether to force to use historical endpoint for pagination (default true) | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.price | string | No | *swap only* "mark" (to fetch mark price candles) or "index" (to fetch index price candles) | + + +```javascript +bitget.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/account/Get-Account-Assets +- https://www.bitget.com/api-doc/contract/account/Get-Account-List +- https://www.bitget.com/api-doc/margin/cross/account/Get-Cross-Assets +- https://www.bitget.com/api-doc/margin/isolated/account/Get-Isolated-Assets +- https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-assets +- https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-assets +- https://www.bitget.com/api-doc/uta/account/Get-Account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | string | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchBalance ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Place-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Place-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Place-Order +- https://www.bitget.com/api-doc/spot/plan/Place-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Place-Order +- https://www.bitget.com/api-doc/contract/plan/Place-Tpsl-Order +- https://www.bitget.com/api-doc/contract/plan/Place-Plan-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Place-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Place-Order +- https://www.bitget.com/api-doc/uta/trade/Place-Order +- https://www.bitget.com/api-doc/uta/strategy/Place-Strategy-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *spot only* how much you want to trade in units of the quote currency, for market buy orders only | +| params.triggerPrice | float | No | *swap only* The price at which a trigger order is triggered at | +| params.stopLossPrice | float | No | *swap only* The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | *swap only* The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | *swap only* take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | *swap only* stop loss trigger price | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", or "PO" | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.loanType | string | No | *spot margin only* 'normal', 'autoLoan', 'autoRepay', or 'autoLoanAndRepay' default is 'normal' | +| params.holdSide | string | No | *contract stopLossPrice, takeProfitPrice only* Two-way position: ('long' or 'short'), one-way position: ('buy' or 'sell') | +| params.stopLoss.price | float | No | *swap only* the execution price for a stop loss attached to a trigger order | +| params.takeProfit.price | float | No | *swap only* the execution price for a take profit attached to a trigger order | +| params.stopLoss.type | string | No | *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.takeProfit.type | string | No | *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.trailingPercent | string | No | *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10 | +| params.trailingTriggerPrice | string | No | *swap and future only* the price to trigger a trailing stop order, default uses the price argument | +| params.triggerType | string | No | *swap and future only* 'fill_price', 'mark_price' or 'index_price' | +| params.oneWayMode | boolean | No | *swap and future only* required to set this to true in one_way_mode and you can leave this as undefined in hedge_mode, can adjust the mode using the setPositionMode() method | +| params.hedged | bool | No | *swap and future only* true for hedged mode, false for one way mode, default is false | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.posSide | string | No | *uta only* hedged two-way position side, long or short | + + +```javascript +bitget.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders (all orders should be of the same symbol) + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Batch-Place-Orders +- https://www.bitget.com/api-doc/contract/trade/Batch-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Batch-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Batch-Order +- https://www.bitget.com/api-doc/uta/trade/Place-Batch + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the api endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/plan/Modify-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Modify-Order +- https://www.bitget.com/api-doc/contract/plan/Modify-Tpsl-Order +- https://www.bitget.com/api-doc/contract/plan/Modify-Plan-Order +- https://www.bitget.com/api-doc/uta/trade/Modify-Order +- https://www.bitget.com/api-doc/uta/strategy/Modify-Strategy-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price that a trigger order is triggered at | +| params.stopLossPrice | float | No | *swap only* The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | *swap only* The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | *swap only* take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | *swap only* stop loss trigger price | +| params.stopLoss.price | float | No | *swap only* the execution price for a stop loss attached to a trigger order | +| params.takeProfit.price | float | No | *swap only* the execution price for a take profit attached to a trigger order | +| params.stopLoss.type | string | No | *swap only* the type for a stop loss attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.takeProfit.type | string | No | *swap only* the type for a take profit attached to a trigger order, 'fill_price', 'index_price' or 'mark_price', default is 'mark_price' | +| params.trailingPercent | string | No | *swap and future only* the percent to trail away from the current market price, rate can not be greater than 10 | +| params.trailingTriggerPrice | string | No | *swap and future only* the price to trigger a trailing stop order, default uses the price argument | +| params.newTriggerType | string | No | *swap and future only* 'fill_price', 'mark_price' or 'index_price' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Cancel-Order +- https://www.bitget.com/api-doc/spot/plan/Cancel-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Cancel-Order +- https://www.bitget.com/api-doc/contract/plan/Cancel-Plan-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Cancel-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Cancel-Order +- https://www.bitget.com/api-doc/uta/trade/Cancel-Order +- https://www.bitget.com/api-doc/uta/strategy/Cancel-Strategy-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.trigger | boolean | No | set to true for canceling trigger orders | +| params.planType | string | No | *swap only* either profit_plan, loss_plan, normal_plan, pos_profit, pos_loss, moving_plan or track_plan | +| params.trailing | boolean | No | set to true if you want to cancel a trailing order | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.clientOrderId | string | No | the clientOrderId of the order, id does not need to be provided if clientOrderId is provided | + + +```javascript +bitget.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an array of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Batch-Cancel-Orders +- https://www.bitget.com/api-doc/contract/trade/Batch-Cancel-Orders +- https://www.bitget.com/api-doc/contract/plan/Cancel-Plan-Order +- https://www.bitget.com/api-doc/margin/cross/trade/Cross-Batch-Cancel-Order +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Batch-Cancel-Orders +- https://www.bitget.com/api-doc/uta/trade/Cancel-Batch + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.trigger | boolean | No | *contract only* set to true for canceling trigger orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Cancel-Symbol-Orders +- https://www.bitget.com/api-doc/spot/plan/Batch-Cancel-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Batch-Cancel-Orders +- https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders +- https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order +- https://www.bitget.com/api-doc/uta/trade/Cancel-All-Order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross' for spot margin trading | +| params.trigger | boolean | No | *contract only* set to true for canceling trigger orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-Order-Info +- https://www.bitget.com/api-doc/contract/trade/Get-Order-Details +- https://www.bitget.com/api-doc/uta/trade/Get-Order-Details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.clientOrderId | string | No | the clientOrderId of the order, id does not need to be provided if clientOrderId is provided | + + +```javascript +bitget.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-Unfilled-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-Current-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-Pending +- https://www.bitget.com/api-doc/contract/plan/get-orders-plan-pending +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Open-Orders +- https://www.bitget.com/api-doc/margin/isolated/trade/Isolated-Open-Orders +- https://www.bitget.com/api-doc/uta/strategy/Get-Unfilled-Strategy-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-History-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-History-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-History +- https://www.bitget.com/api-doc/contract/plan/orders-plan-history +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History +- https://www.bitget.com/api-doc/uta/trade/Get-Order-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the closed orders | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the max number of closed orders to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | + + +```javascript +bitget.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-History-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-History-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-History +- https://www.bitget.com/api-doc/contract/plan/orders-plan-history +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History +- https://www.bitget.com/api-doc/uta/trade/Get-Order-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the canceled orders | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the max number of canceled orders to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | + + +```javascript +bitget.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple canceled and closed orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-History-Orders +- https://www.bitget.com/api-doc/spot/plan/Get-History-Plan-Order +- https://www.bitget.com/api-doc/contract/trade/Get-Orders-History +- https://www.bitget.com/api-doc/contract/plan/orders-plan-history +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-History +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Order-History +- https://www.bitget.com/api-doc/uta/trade/Get-Order-History +- https://www.bitget.com/api-doc/uta/strategy/Get-History-Strategy-Orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.planType | string | No | *contract stop only* 'normal_plan': average trigger order, 'profit_loss': opened tp/sl orders, 'track_plan': trailing stop order, default is 'normal_plan' | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.isPlan | string | No | *swap only* 'plan' for stop orders and 'profit_loss' for tp/sl orders, default is 'plan' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://www.bitget.com/api-doc/spot/account/Get-Account-Bills +- https://www.bitget.com/api-doc/contract/account/Get-Account-Bill + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.symbol | string | No | *contract only* unified market symbol | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/trade/Get-Fills +- https://www.bitget.com/api-doc/contract/trade/Get-Order-Fills +- https://www.bitget.com/api-doc/margin/cross/trade/Get-Cross-Order-Fills +- https://www.bitget.com/api-doc/margin/isolated/trade/Get-Isolated-Transaction-Details +- https://www.bitget.com/api-doc/uta/trade/Get-Order-Fills + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/get-single-position +- https://www.bitget.com/api-doc/uta/trade/Get-Position + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/get-all-position +- https://www.bitget.com/api-doc/contract/position/Get-History-Position +- https://www.bitget.com/api-doc/uta/trade/Get-Position + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginCoin | string | No | the settle currency of the positions, needs to match the productType | +| params.productType | string | No | 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.useHistoryEndpoint | boolean | No | default false, when true will use the historic endpoint to fetch positions | +| params.method | string | No | either (default) 'privateMixGetV2MixPositionAllPosition', 'privateMixGetV2MixPositionHistoryPosition', or 'privateUtaGetV3PositionCurrentPosition' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchPositions ([symbols, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-History-Funding-Rate +- https://www.bitget.com/api-doc/uta/public/Get-History-Funding-Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of funding rate structures to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate +- https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time +- https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.method | string | No | either (default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime' | + + +```javascript +bitget.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rates for all markets + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a dictionary of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | *contract only* 'linear', 'inverse' | +| params.productType | string | No | *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | + + +```javascript +bitget.fetchFundingRates ([symbols, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the funding history + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [funding history structures](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Get-Account-Bill + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the starting timestamp in milliseconds | +| limit | int | No | the number of entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch funding history for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Change-Margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Change-Margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.addMargin (symbol, amount[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Get-Single-Account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - response from the exchange + +**See** + +- https://www.bitget.com/api-doc/contract/account/Change-Leverage +- https://www.bitget.com/api-doc/uta/account/Change-Leverage + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | int | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.holdSide | string | No | *isolated only* position direction, 'long' or 'short' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | +| params.posSide | boolean | No | required for uta isolated margin, long or short | + + +```javascript +bitget.setLeverage (leverage, symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - response from the exchange + +**See**: https://www.bitget.com/api-doc/contract/account/Change-Margin-Mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - response from the exchange + +**See** + +- https://www.bitget.com/api-doc/contract/account/Change-Hold-Mode +- https://www.bitget.com/api-doc/uta/account/Change-Position-Mode + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by bitget setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | required if not uta and symbol is undefined: 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-Open-Interest +- https://www.bitget.com/api-doc/uta/public/Get-Open-Interest + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Get-Account-TransferRecords + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +bitget.fetchTransfers (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.bitget.com/api-doc/spot/account/Wallet-Transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | unified CCXT market symbol, required when transferring to or from an account type that is a leveraged position-by-position account | +| params.clientOid | string | No | custom id | + + +```javascript +bitget.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitget.com/api-doc/spot/market/Get-Coin-List + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/cross/account/Cross-Borrow + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | string | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.borrowCrossMargin (code, amount[, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Borrow + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | string | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### repayIsolatedMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to repay | +| amount | string | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.repayIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.bitget.com/api-doc/margin/cross/account/Cross-Repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | string | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.repayCrossMargin (code, amount[, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See** + +- https://www.bitget.com/api-doc/margin/cross/record/Get-Cross-Liquidation-Records +- https://www.bitget.com/api-doc/margin/isolated/record/Get-Isolated-Liquidation-Records + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitget api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.marginMode | string | No | 'cross' or 'isolated' default value is 'cross' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchMyLiquidations ([symbol, since, limit, params]) +``` + + + + +### fetchIsolatedBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an [isolated borrow rate structure](https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure) + +**See**: https://www.bitget.com/api-doc/margin/isolated/account/Isolated-Margin-Interest-Rate-And-Max-Borrowable-Amount + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchIsolatedBorrowRate (symbol[, params]) +``` + + + + +### fetchCrossBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [borrow rate structure](https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure) + +**See** + +- https://www.bitget.com/api-doc/margin/cross/account/Get-Cross-Margin-Interest-Rate-And-Borrowable +- https://www.bitget.com/api-doc/uta/public/Get-Margin-Loans + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchCrossBorrowRate (code[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See** + +- https://www.bitget.com/api-doc/margin/cross/record/Get-Cross-Interest-Records +- https://www.bitget.com/api-doc/margin/isolated/record/Get-Isolated-Interest-Records + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| symbol | string | No | unified market symbol when fetching interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitget.fetchBorrowInterest ([code, symbol, since, limit, params]) +``` + + + + +### closePosition{docsify-ignore} +closes an open position for a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position +- https://www.bitget.com/api-doc/uta/trade/Close-All-Positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| side | string | No | one-way mode: 'buy' or 'sell', hedge-mode: 'long' or 'short' | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.closePosition (symbol[, side, params]) +``` + + + + +### closeAllPositions{docsify-ignore} +closes all open positions for a market type + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - A list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/trade/Flash-Close-Position +- https://www.bitget.com/api-doc/uta/trade/Close-All-Positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.closeAllPositions ([params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of a trading pair + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://www.bitget.com/api-doc/contract/account/Get-Single-Account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the margin mode for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchMarginMode (symbol[, params]) +``` + + + + +### fetchPositionsHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/position/Get-History-Position +- https://www.bitget.com/api-doc/uta/trade/Get-Position-History + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified contract symbols | +| since | int | No | timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months | +| limit | int | No | the maximum amount of records to fetch, default=20, max=100 | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months | +| params.productType | string | No | USDT-FUTURES (default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchPositionsHistory ([symbols, since, limit, params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.bitget.com/api-doc/common/convert/Get-Quoted-Price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchConvertQuote (fromCode, toCode[, amount, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.bitget.com/api-doc/common/convert/Trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | Yes | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.price | string | Yes | the price of the conversion, obtained from fetchConvertQuote() | +| params.toAmount | string | Yes | the amount you want to trade in units of the toCurrency, obtained from fetchConvertQuote() | + + +```javascript +bitget.createConvertTrade (id, fromCode, toCode, amount[, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.bitget.com/api-doc/common/convert/Get-Convert-Record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### fetchConvertCurrencies{docsify-ignore} +fetches all available currencies that can be converted + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.bitget.com/api-doc/common/convert/Get-Convert-Currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchConvertCurrencies ([params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time +- https://www.bitget.com/api-doc/uta/public/Get-Current-Funding-Rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchLongShortRatioHistory{docsify-ignore} +fetches the long short ratio history for a unified market symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - an array of [long short ratio structures](https://docs.ccxt.com/#/?id=long-short-ratio-structure) + +**See** + +- https://www.bitget.com/api-doc/common/apidata/Margin-Ls-Ratio +- https://www.bitget.com/api-doc/common/apidata/Account-Long-Short + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the long short ratio for | +| timeframe | string | No | the period for the ratio | +| since | int | No | the earliest time in ms to fetch ratios for | +| limit | int | No | the maximum number of long short ratio structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.fetchLongShortRatioHistory (symbol[, timeframe, since, limit, params]) +``` + + + + +### bitget{docsify-ignore} +watching delivery future markets is not yet implemented (perpertual future & swap is implemented) + + + +```javascript +bitget.bitget () +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to watch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unsubscribe from the ticker channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: any - status of the unwatch request + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitget.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to watch the tickers for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unsubscribe from the ohlcv channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the ohlcv for | +| timeframe | string | No | the period for the ratio, default is 1 minute | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.unWatchOHLCV (symbol[, timeframe, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Depth-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Order-Book-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Order-Book-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unsubscribe from the orderbook channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Depth-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Order-Book-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Order-Book-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | orderbook limit, default is undefined | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Depth-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/Order-Book-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/Order-Book-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unsubscribe from the trades channel + +**Kind**: instance method of [bitget](#bitget) +**Returns**: any - status of the unwatch request + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel +- https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel +- https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.unWatchTrades (symbol[, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/websocket/private/Positions-Channel +- https://www.bitget.com/api-doc/uta/websocket/private/Positions-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | one of 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES', default is 'USDT-FUTURES' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchPositions (symbols[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/private/Order-Channel +- https://www.bitget.com/api-doc/contract/websocket/private/Order-Channel +- https://www.bitget.com/api-doc/contract/websocket/private/Plan-Order-Channel +- https://www.bitget.com/api-doc/margin/cross/websocket/private/Cross-Orders +- https://www.bitget.com/api-doc/margin/isolated/websocket/private/Isolate-Orders +- https://www.bitget.com/api-doc/uta/websocket/private/Order-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | *contract only* set to true for watching trigger orders | +| params.marginMode | string | No | 'isolated' or 'cross' for watching spot margin orders] | +| params.type | string | No | 'spot', 'swap' | +| params.subType | string | No | 'linear', 'inverse' | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches trades made by the user + +**Kind**: instance method of [bitget](#bitget) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.bitget.com/api-doc/contract/websocket/private/Fill-Channel +- https://www.bitget.com/api-doc/uta/websocket/private/Fill-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | str | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitget](#bitget) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.bitget.com/api-doc/spot/websocket/private/Account-Channel +- https://www.bitget.com/api-doc/contract/websocket/private/Account-Channel +- https://www.bitget.com/api-doc/margin/cross/websocket/private/Margin-Cross-Account-Assets +- https://www.bitget.com/api-doc/margin/isolated/websocket/private/Margin-isolated-account-assets +- https://www.bitget.com/api-doc/uta/websocket/private/Account-Channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | str | No | spot or contract if not provided this.options['defaultType'] is used | +| params.instType | string | No | one of 'SPOT', 'MARGIN', 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES' | +| params.marginMode | string | No | 'isolated' or 'cross' for watching spot margin balances | +| params.uta | boolean | No | set to true for the unified trading account (uta), defaults to false | + + +```javascript +bitget.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bithumb.md b/docs/ccxt/wiki/exchanges/bithumb.md new file mode 100644 index 0000000..77a2855 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bithumb.md @@ -0,0 +1,383 @@ + + + +## bithumb{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [cancelOrder](#cancelorder) +* [withdraw](#withdraw) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchOrderBook](#watchorderbook) +* [watchTrades](#watchtrades) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bithumb + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B3%B4%EC%9C%A0%EC%9E%90%EC%82%B0-%EC%A1%B0%ED%9A%8C + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%B8%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C-all + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%ED%98%84%EC%9E%AC%EA%B0%80-%EC%A0%95%EB%B3%B4-%EC%A1%B0%ED%9A%8C + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchTicker (symbol[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/candlestick-rest-api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EC%B5%9C%EA%B7%BC-%EC%B2%B4%EA%B2%B0-%EB%82%B4%EC%97%AD + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://apidocs.bithumb.com/v1.2.0/reference/%EC%A7%80%EC%A0%95%EA%B0%80-%EC%A3%BC%EB%AC%B8%ED%95%98%EA%B8%B0 +- https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EC%88%98%ED%95%98%EA%B8%B0 +- https://apidocs.bithumb.com/v1.2.0/reference/%EC%8B%9C%EC%9E%A5%EA%B0%80-%EB%A7%A4%EB%8F%84%ED%95%98%EA%B8%B0 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%83%81%EC%84%B8-%EC%A1%B0%ED%9A%8C + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EA%B1%B0%EB%9E%98-%EC%A3%BC%EB%AC%B8%EB%82%B4%EC%97%AD-%EC%A1%B0%ED%9A%8C + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EC%A3%BC%EB%AC%B8-%EC%B7%A8%EC%86%8C%ED%95%98%EA%B8%B0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.cancelOrder (id, symbol[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EC%BD%94%EC%9D%B8-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0-%EA%B0%9C%EC%9D%B8 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.withdraw (code, amount, address, tag[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - a [ticker structure](https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +bithumb.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.watchTickers (symbols[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: object - A dictionary of [order book structures](https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure) indexed by market symbols + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bithumb](#bithumb) +**Returns**: Array<object> - a list of [trade structures](https://github.com/ccxt/ccxt/wiki/Manual#public-trades) + +**See**: https://apidocs.bithumb.com/v1.2.0/reference/%EB%B9%97%EC%8D%B8-%EA%B1%B0%EB%9E%98%EC%86%8C-%EC%A0%95%EB%B3%B4-%EC%88%98%EC%8B%A0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bithumb.watchTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitmart.md b/docs/ccxt/wiki/exchanges/bitmart.md new file mode 100644 index 0000000..eba1f1a --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitmart.md @@ -0,0 +1,1587 @@ + + + +## bitmart{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchStatus](#fetchstatus) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTransactionFee](#fetchtransactionfee) +* [fetchDepositWithdrawFee](#fetchdepositwithdrawfee) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderTrades](#fetchordertrades) +* [fetchBalance](#fetchbalance) +* [fetchTradingFee](#fetchtradingfee) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchOrder](#fetchorder) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [fetchDeposit](#fetchdeposit) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawal](#fetchwithdrawal) +* [fetchWithdrawals](#fetchwithdrawals) +* [repayIsolatedMargin](#repayisolatedmargin) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [fetchIsolatedBorrowRate](#fetchisolatedborrowrate) +* [fetchIsolatedBorrowRates](#fetchisolatedborrowrates) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [fetchBorrowInterest](#fetchborrowinterest) +* [fetchOpenInterest](#fetchopeninterest) +* [setLeverage](#setleverage) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchMyLiquidations](#fetchmyliquidations) +* [editOrder](#editorder) +* [fetchLedger](#fetchledger) +* [fetchFundingHistory](#fetchfundinghistory) +* [setPositionMode](#setpositionmode) +* [fetchPositionMode](#fetchpositionmode) +* [watchBalance](#watchbalance) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOrders](#watchorders) +* [watchPositions](#watchpositions) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://developer-pro.bitmart.com/en/spot/#get-system-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchTime ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-system-service-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchStatus ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitmart + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://developer-pro.bitmart.com/en/spot/#get-trading-pair-details-v1 +- https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an associative dictionary of currencies + +**See**: https://developer-pro.bitmart.com/en/spot/#get-currency-list-v1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchCurrencies ([params]) +``` + + + + +### fetchTransactionFee{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFee instead + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the network code of the currency | + + +```javascript +bitmart.fetchTransactionFee (code[, params]) +``` + + + + +### fetchDepositWithdrawFee{docsify-ignore} +fetch the fee for deposits and withdrawals + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#withdraw-quota-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the network code of the currency | + + +```javascript +bitmart.fetchDepositWithdrawFee (code[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3 +- https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3 +- https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchTickers (symbols[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://developer-pro.bitmart.com/en/spot/#get-depth-v3 +- https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get a list of the most recent trades for a particular symbol + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-recent-trades-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum number of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://developer-pro.bitmart.com/en/spot/#get-history-k-line-v3 +- https://developer-pro.bitmart.com/en/futuresv2/#get-k-line + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp of the latest candle in ms | +| params.paginate | boolean | No | *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitmart.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed +- https://developer-pro.bitmart.com/en/futuresv2/#get-order-trade-keyed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.marginMode | boolean | No | *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported) | +| params.stpMode | string | No | self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] | + + +```javascript +bitmart.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#order-trade-list-v4-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stpMode | string | No | self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] | + + +```javascript +bitmart.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance-keyed +- https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed +- https://developer-pro.bitmart.com/en/spot/#get-account-balance-keyed +- https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated-keyed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchBalance ([params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-actual-trade-fee-rate-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchTradingFee (symbol[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed +- https://developer-pro.bitmart.com/en/spot/#new-margin-order-v1-signed +- https://developer-pro.bitmart.com/en/futuresv2/#submit-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-sl-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#submit-trail-order-signed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit' or 'trailing' for swap markets only | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | +| params.leverage | string | No | *swap only* leverage level | +| params.clientOrderId | string | No | client order id of the order | +| params.reduceOnly | boolean | No | *swap only* reduce only | +| params.postOnly | boolean | No | make sure the order is posted to the order book and not matched immediately | +| params.triggerPrice | string | No | *swap only* the price to trigger a stop order | +| params.price_type | int | No | *swap only* 1: last price, 2: fair price, default is 1 | +| params.price_way | int | No | *swap only* 1: price way long, 2: price way short | +| params.activation_price_type | int | No | *swap trailing order only* 1: last price, 2: fair price, default is 1 | +| params.trailingPercent | string | No | *swap only* the percent to trail away from the current market price, min 0.1 max 5 | +| params.trailingTriggerPrice | string | No | *swap only* the price to trigger a trailing order, default uses the price argument | +| params.stopLossPrice | string | No | *swap only* the price to trigger a stop-loss order | +| params.takeProfitPrice | string | No | *swap only* the price to trigger a take-profit order | +| params.plan_category | int | No | *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1 | +| params.stpMode | string | No | self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] | + + +```javascript +bitmart.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stpMode | string | No | self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] | + + +```javascript +bitmart.createOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed +- https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed +- https://developer-pro.bitmart.com/en/futuresv2/#cancel-plan-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#cancel-trail-order-signed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | *spot only* the client order id of the order to cancel | +| params.trigger | boolean | No | *swap only* whether the order is a trigger order | +| params.trailing | boolean | No | *swap only* whether the order is a stop order | + + +```javascript +bitmart.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#cancel-batch-order-v4-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | client order ids | + + +```javascript +bitmart.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#cancel-all-order-v4-signed +- https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | *spot only* 'buy' or 'sell' | + + +```javascript +bitmart.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed +- https://developer-pro.bitmart.com/en/futuresv2/#get-all-open-orders-keyed +- https://developer-pro.bitmart.com/en/futuresv2/#get-all-current-plan-orders-keyed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | boolean | No | *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported) | +| params.until | int | No | *spot* the latest time in ms to fetch orders for | +| params.type | string | No | *swap* order type, 'limit' or 'market' | +| params.order_state | string | No | *swap* the order state, 'all' or 'partially_filled', default is 'all' | +| params.orderType | string | No | *swap only* 'limit', 'market', or 'trailing' | +| params.trailing | boolean | No | *swap only* set to true if you want to fetch trailing orders | +| params.trigger | boolean | No | *swap only* set to true if you want to fetch trigger orders | +| params.stpMode | string | No | self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] | + + +```javascript +bitmart.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed +- https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest entry | +| params.marginMode | string | No | *spot only* 'cross' or 'isolated', for margin trading | +| params.stpMode | string | No | self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] | + + +```javascript +bitmart.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed +- https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed +- https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the order | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | *spot* fetch the order by client order id instead of order id | +| params.orderType | string | No | *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing' | +| params.trailing | boolean | No | *swap only* set to true if you want to fetch a trailing order | +| params.stpMode | string | No | self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both'] | + + +```javascript +bitmart.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#deposit-address-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#withdraw-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the network name for this withdrawal | + + +```javascript +bitmart.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch information on a deposit + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-a-deposit-or-withdraw-detail-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | Yes | not used by bitmart fetchDeposit () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchDeposit (id, code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-deposit-and-withdraw-history-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawal{docsify-ignore} +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-a-deposit-or-withdraw-detail-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | withdrawal id | +| code | string | Yes | not used by bitmart.fetchWithdrawal | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchWithdrawal (id, code[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-deposit-and-withdraw-history-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### repayIsolatedMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#margin-repay-isolated-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to repay | +| amount | string | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.repayIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#margin-borrow-isolated-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | string | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### fetchIsolatedBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an [isolated borrow rate structure](https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the borrow rate for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchIsolatedBorrowRate (symbol[, params]) +``` + + + + +### fetchIsolatedBorrowRates{docsify-ignore} +fetch the borrow interest rates of all currencies, currently only works for isolated margin + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a list of [isolated borrow rate structures](https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-trading-pair-borrowing-rate-and-amount-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchIsolatedBorrowRates ([params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed +- https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account, only transfers between spot and swap are supported + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-transfer-list-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfer structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.page | int | No | the required number of pages, default is 1, max is 1000 | +| params.until | int | No | the latest time in ms to fetch transfers for | + + +```javascript +bitmart.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See**: https://developer-pro.bitmart.com/en/spot/#get-borrow-record-isolated-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| symbol | string | Yes | unified market symbol when fetch interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchBorrowInterest (code, symbol[, since, limit, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +Retrieves the open interest of a currency + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +bitmart.fetchOpenInterest (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - response from the exchange + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'isolated' or 'cross' | + + +```javascript +bitmart.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | not sent to exchange api, exchange api always returns the most recent data, only used to filter exchange response | +| limit | int | No | the maximum amount of funding rate structures to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open contract positions + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-keyed +- https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-v2-keyed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchPositions (symbols[, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmart api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | + + +```javascript +bitmart.fetchMyLiquidations (symbol[, since, limit, params]) +``` + + + + +### editOrder{docsify-ignore} +edits an open order + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/futuresv2/#modify-plan-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#modify-tp-sl-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#modify-preset-plan-order-signed +- https://developer-pro.bitmart.com/en/futuresv2/#modify-limit-order-signed + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to edit an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | No | how much you want to trade in units of the base currency | +| price | float | No | the price to fulfill the order, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | string | No | *swap only* the price to trigger a stop order | +| params.stopLossPrice | string | No | *swap only* the price to trigger a stop-loss order | +| params.takeProfitPrice | string | No | *swap only* the price to trigger a take-profit order | +| params.stopLoss.triggerPrice | string | No | *swap only* the price to trigger a preset stop-loss order | +| params.takeProfit.triggerPrice | string | No | *swap only* the price to trigger a preset take-profit order | +| params.clientOrderId | string | No | client order id of the order | +| params.price_type | int | No | *swap only* 1: last price, 2: fair price, default is 1 | +| params.plan_category | int | No | *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1 | + + +```javascript +bitmart.editOrder (id, symbol, type, side[, amount, price, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [ledger structures](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | + + +```javascript +bitmart.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [funding history structures](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the starting timestamp in milliseconds | +| limit | int | No | the number of entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch funding history for | + + +```javascript +bitmart.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - response from the exchange + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by bingx setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See**: https://developer-pro.bitmart.com/en/futuresv2/#get-position-mode-keyed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | not used | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.fetchPositionMode (symbol[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#private-balance-change +- https://developer-pro.bitmart.com/en/futuresv2/#private-assets-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchBalance ([params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#public-trade-channel +- https://developer-pro.bitmart.com/en/futuresv2/#public-trade-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://developer-pro.bitmart.com/en/spot/#public-trade-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#public-ticker-channel +- https://developer-pro.bitmart.com/en/futuresv2/#public-ticker-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#public-ticker-channel +- https://developer-pro.bitmart.com/en/futuresv2/#public-ticker-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#public-ticker-channel +- https://developer-pro.bitmart.com/en/futuresv2/#public-ticker-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer-pro.bitmart.com/en/spot/#private-order-progress +- https://developer-pro.bitmart.com/en/futuresv2/#private-order-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://developer-pro.bitmart.com/en/futures/#private-position-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchPositions (symbols[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://developer-pro.bitmart.com/en/spot/#public-kline-channel +- https://developer-pro.bitmart.com/en/futuresv2/#public-klinebin-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmart.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://developer-pro.bitmart.com/en/spot/#public-depth-all-channel +- https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel +- https://developer-pro.bitmart.com/en/futuresv2/#public-depth-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.speed | string | No | *futures only* '100ms' or '200ms' | + + +```javascript +bitmart.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitmart](#bitmart) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.depth | string | No | the type of order book to subscribe to, default is 'depth/increase100', also accepts 'depth5' or 'depth20' or depth50 | + + +```javascript +bitmart.watchOrderBookForSymbols (symbols[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitmex.md b/docs/ccxt/wiki/exchanges/bitmex.md new file mode 100644 index 0000000..e161d3f --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitmex.md @@ -0,0 +1,1018 @@ + + + +## bitmex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchLedger](#fetchledger) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchLeverages](#fetchleverages) +* [fetchPositions](#fetchpositions) +* [withdraw](#withdraw) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [setLeverage](#setleverage) +* [setMarginMode](#setmarginmode) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchLiquidations](#fetchliquidations) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchLiquidations](#watchliquidations) +* [watchLiquidationsForSymbols](#watchliquidationsforsymbols) +* [watchBalance](#watchbalance) +* [watchTrades](#watchtrades) +* [watchPositions](#watchpositions) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOHLCV](#watchohlcv) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.bitmex.com/api/explorer/#!/Wallet/Wallet_getAssetsConfig + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitmex + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActive + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/User/User_getMargin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.bitmex.com/api/explorer/#!/OrderBook/OrderBook_getL2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the earliest time in ms to fetch orders for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitmex.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_getOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Execution/Execution_getTradeHistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitmex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchTickers (symbols[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.bitmex.com/api/explorer/#!/Trade/Trade_getBucketed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitmex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.bitmex.com/api/explorer/#!/Trade/Trade_get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitmex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - an [order structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_new + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | object | No | the price at which a trigger order is triggered at | +| params.triggerDirection | object | No | the direction whenever the trigger happens with relation to price - 'ascending' or 'descending' | +| params.trailingAmount | float | No | the quote amount to trail away from the current market price | + + +```javascript +bitmex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by bitmex cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by bitmex cancelOrders () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAll + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - the api result + +**See**: https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAllAfter + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchLeverages{docsify-ignore} +fetch the set leverage for all contract markets + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchLeverages ([symbols, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchPositions (symbols[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/User/User_requestWithdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://www.bitmex.com/api/explorer/#!/Instrument/Instrument_getActiveAndIndices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +Fetches the history of funding rates + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Funding/Funding_get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for ending date filter | +| params.reverse | bool | No | if true, will sort results newest first | +| params.start | int | No | starting point for results | +| params.columns | string | No | array of column names to fetch in info, if omitted, will return all columns | +| params.filter | string | No | generic table filter, send json key/value pairs, such as {"key": "value"}, you can key on individual fields, and do more advanced querying on timestamps, see the [timestamp docs](https://www.bitmex.com/app/restAPI#Timestamp-Filters) for more details | + + +```javascript +bitmex.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - response from the exchange + +**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_updateLeverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.setLeverage (leverage, symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - response from the exchange + +**See**: https://www.bitmex.com/api/explorer/#!/Position/Position_isolateMargin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/User/User_getDepositAddress + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | deposit chain, can view all chains via this.publicGetWalletAssets, default is eth, unless the currency has a default chain within this.options['networks'] | + + +```javascript +bitmex.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Wallet/Wallet_getAssetsConfig + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchLiquidations{docsify-ignore} +retrieves the public liquidations of a trading pair + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://www.bitmex.com/api/explorer/#!/Liquidation/Liquidation_get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitmex.fetchLiquidations (symbol[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchTickers (symbols[, params]) +``` + + + + +### watchLiquidations{docsify-ignore} +watch the public liquidations of a trading pair + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Liquidation + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | + + +```javascript +bitmex.watchLiquidations (symbol[, since, limit, params]) +``` + + + + +### watchLiquidationsForSymbols{docsify-ignore} +watch the public liquidations of a trading pair + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Liquidation + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | + + +```javascript +bitmex.watchLiquidationsForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchBalance ([params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| since | int | No | the earliest time in ms to watch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchPositions (symbols[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.bitmex.com/app/wsAPI#OrderBookL2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.bitmex.com/app/wsAPI#OrderBookL2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitmex](#bitmex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.bitmex.com/app/wsAPI#Subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitmex.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitopro.md b/docs/ccxt/wiki/exchanges/bitopro.md new file mode 100644 index 0000000..7079fd5 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitopro.md @@ -0,0 +1,653 @@ + + + +## bitopro{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchWithdrawal](#fetchwithdrawal) +* [withdraw](#withdraw) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [watchOrderBook](#watchorderbook) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchTicker](#watchticker) +* [watchBalance](#watchbalance) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - an associative dictionary of currencies + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_currency_info.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitopro + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_trading_pair_info.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_ticker_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_ticker_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchTickers (symbols[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_orderbook_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_trades_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_limitations_and_fees.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_ohlc_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_account_balance.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/create_an_order.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | object | No | the price at which a trigger order is triggered at | + + +```javascript +bitopro.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/cancel_an_order.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/cancel_batch_orders.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/cancel_all_orders.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_an_order_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_orders_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_open_orders_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_orders_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_trades_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_deposit_invoices_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_withdraw_invoices_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchWithdrawal{docsify-ignore} +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_an_withdraw_invoice_data.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | withdrawal id | +| code | string | Yes | unified currency code of the currency withdrawn, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchWithdrawal (id, code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/create_an_withdraw_invoice.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/public/get_currency_info.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/order_book_stream.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/trade_stream.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/matches_stream.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/public/ticker_stream.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.watchTicker (symbol[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitopro](#bitopro) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://github.com/bitoex/bitopro-offical-api-docs/blob/master/ws/private/user_balance_stream.md + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitopro.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitrue.md b/docs/ccxt/wiki/exchanges/bitrue.md new file mode 100644 index 0000000..7f98636 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitrue.md @@ -0,0 +1,767 @@ + + + +## bitrue{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchOHLCV](#fetchohlcv) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOpenOrders](#fetchopenorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchTransfers](#fetchtransfers) +* [transfer](#transfer) +* [setLeverage](#setleverage) +* [setMargin](#setmargin) +* [watchBalance](#watchbalance) +* [watchOrders](#watchorders) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#test-connectivity + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#check-server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitrue + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://github.com/Bitrue-exchange/Spot-official-api-docs#exchangeInfo_endpoint +- https://www.bitrue.com/api-docs#current-open-contract +- https://www.bitrue.com/api_docs_includes_file/delivery.html#current-open-contract + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange api endpoint | + + +```javascript +bitrue.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://github.com/Bitrue-exchange/Spot-official-api-docs#account-information-user_data +- https://www.bitrue.com/api-docs#account-information-v2-user_data-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#account-information-v2-user_data-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'future', 'delivery', 'spot', 'swap' | +| params.subType | string | No | 'linear', 'inverse' | + + +```javascript +bitrue.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://github.com/Bitrue-exchange/Spot-official-api-docs#order-book +- https://www.bitrue.com/api-docs#order-book +- https://www.bitrue.com/api_docs_includes_file/delivery.html#order-book + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://github.com/Bitrue-exchange/Spot-official-api-docs#24hr-ticker-price-change-statistics +- https://www.bitrue.com/api-docs#ticker +- https://www.bitrue.com/api_docs_includes_file/delivery.html#ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchTicker (symbol[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.bitrue.com/api_docs_includes_file/spot/index.html#kline-data +- https://www.bitrue.com/api_docs_includes_file/futures/index.html#kline-candlestick-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for | + + +```javascript +bitrue.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://github.com/Bitrue-exchange/Spot-official-api-docs#symbol-order-book-ticker +- https://www.bitrue.com/api-docs#ticker +- https://www.bitrue.com/api_docs_includes_file/delivery.html#ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchBidsAsks (symbols[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://github.com/Bitrue-exchange/Spot-official-api-docs#24hr-ticker-price-change-statistics +- https://www.bitrue.com/api-docs#ticker +- https://www.bitrue.com/api_docs_includes_file/delivery.html#ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#recent-trades-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitrue.com/api-docs#new-order-trade-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#new-order-trade-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitrue.com/api_docs_includes_file/spot/index.html#new-order-trade +- https://www.bitrue.com/api_docs_includes_file/futures/index.html#new-order-trade-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | *spot only* the price at which a trigger order is triggered at | +| params.clientOrderId | string | No | a unique id for the order, automatically generated if not sent | +| params.leverage | decimal | No | in future order, the leverage value of the order should consistent with the user contract configuration, default is 1 | +| params.timeInForce | string | No | 'fok', 'ioc' or 'po' | +| params.postOnly | bool | No | default false | +| params.reduceOnly | bool | No | default false EXCHANGE SPECIFIC PARAMETERS | +| params.icebergQty | decimal | No | | +| params.recvWindow | long | No | | +| params.cost | float | No | *swap market buy only* the quote quantity that can be used as an alternative for the amount | + + +```javascript +bitrue.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitrue.com/api_docs_includes_file/spot/index.html#query-order-user_data +- https://www.bitrue.com/api_docs_includes_file/futures/index.html#query-order-user_data-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitrue.com/api_docs_includes_file/spot/index.html#all-orders-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitrue.com/api_docs_includes_file/spot/index.html#current-open-orders-user_data +- https://www.bitrue.com/api_docs_includes_file/futures/index.html#cancel-all-open-orders-trade-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://github.com/Bitrue-exchange/Spot-official-api-docs#cancel-order-trade +- https://www.bitrue.com/api-docs#cancel-order-trade-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#cancel-order-trade-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<object> - a list of [order structures](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See** + +- https://www.bitrue.com/api-docs#cancel-all-open-orders-trade-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#cancel-all-open-orders-trade-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated', for spot margin trading | + + +```javascript +bitrue.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.bitrue.com/api_docs_includes_file/spot/index.html#account-trade-list-user_data +- https://www.bitrue.com/api_docs_includes_file/futures/index.html#account-trade-list-user_data-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#deposit-history--withdraw_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#withdraw-history--withdraw_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#withdraw-commit--withdraw_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#exchangeInfo_endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: Array<object> - a list of [transfer structures](https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure) + +**See** + +- https://www.bitrue.com/api-docs#get-future-account-transfer-history-list-user_data-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#get-future-account-transfer-history-list-user_data-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for | +| params.type | string | No | transfer type wallet_to_contract or contract_to_wallet | + + +```javascript +bitrue.fetchTransfers (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a [transfer structure](https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure) + +**See** + +- https://www.bitrue.com/api-docs#new-future-account-transfer-user_data-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#user-commission-rate-user_data-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - response from the exchange + +**See** + +- https://www.bitrue.com/api-docs#change-initial-leverage-trade-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#change-initial-leverage-trade-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.setLeverage (leverage, symbol[, params]) +``` + + + + +### setMargin{docsify-ignore} +Either adds or reduces margin in an isolated position in order to set the margin to a specific value + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - A [margin structure](https://github.com/ccxt/ccxt/wiki/Manual#add-margin-structure) + +**See** + +- https://www.bitrue.com/api-docs#modify-isolated-position-margin-trade-hmac-sha256 +- https://www.bitrue.com/api_docs_includes_file/delivery.html#modify-isolated-position-margin-trade-hmac-sha256 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to set margin in | +| amount | float | Yes | the amount to set the margin to | +| params | object | No | parameters specific to the exchange API endpoint | + + +```javascript +bitrue.setMargin (symbol, amount[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#balance-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.watchBalance ([params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on user orders + +**Kind**: instance method of [bitrue](#bitrue) +**Returns**: object - A dictionary of [order structure](https://docs.ccxt.com/#/?id=order-structure) indexed by market symbols + +**See**: https://github.com/Bitrue-exchange/Spot-official-api-docs#order-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the maximum amount of orders to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitrue.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitso.md b/docs/ccxt/wiki/exchanges/bitso.md new file mode 100644 index 0000000..5b7c893 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitso.md @@ -0,0 +1,514 @@ + + + +## bitso{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchLedger](#fetchledger) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchMyTrades](#fetchmytrades) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchDeposit](#fetchdeposit) +* [fetchDeposits](#fetchdeposits) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [withdraw](#withdraw) + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitso + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.bitso.com/bitso-api/docs/list-available-books + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/get-account-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.bitso.com/bitso-api/docs/list-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchTicker (symbol[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.bitso.com/bitso-api/docs/list-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.bitso.com/bitso-api/docs/list-fees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchTradingFees ([params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/user-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/place-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/cancel-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by bitso cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/cancel-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/cancel-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | undefined | Yes | bitso does not support canceling orders for only a specific market | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/list-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/look-up-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by bitso fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/list-user-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch information on a deposit + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.bitso.com/bitso-payouts-funding/docs/fundings + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | Yes | bitso does not support filtering by currency code and will ignore this argument | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchDeposit (id, code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.bitso.com/bitso-payouts-funding/docs/fundings + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchDepositAddress (code[, params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFees instead + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/list-fees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitso](#bitso) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.bitso.com/bitso-api/docs/list-fees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitso](#bitso) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitso.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitstamp.md b/docs/ccxt/wiki/exchanges/bitstamp.md new file mode 100644 index 0000000..adc1a30 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitstamp.md @@ -0,0 +1,657 @@ + + + +## bitstamp{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchLedger](#fetchledger) +* [fetchOpenOrders](#fetchopenorders) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [transfer](#transfer) +* [watchOrderBook](#watchorderbook) +* [watchTrades](#watchtrades) +* [watchOrders](#watchorders) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitstamp + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchCurrencies ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.bitstamp.net/api/#tag/Order-book/operation/GetOrderBook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitstamp.net/api/#tag/Tickers/operation/GetMarketTicker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.bitstamp.net/api/#tag/Tickers/operation/GetCurrencyPairTickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.bitstamp.net/api/#tag/Transactions-public/operation/GetTransactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.bitstamp.net/api/#tag/Account-balances/operation/GetAccountBalances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchBalance ([params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitstamp.net/api/#tag/Fees/operation/GetTradingFeesForCurrency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchTradingFees ([params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFees instead + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitstamp.net/api/#tag/Fees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.bitstamp.net/api/#tag/Fees/operation/GetAllWithdrawalFees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantBuyOrder +- https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketBuyOrder +- https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitBuyOrder +- https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantSellOrder +- https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketSellOrder +- https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitSellOrder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitstamp.net/api/#tag/Orders/operation/CancelAllOrders +- https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrdersForMarket + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.bitstamp.net/api/#tag/Orders/operation/GetOrderStatus + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions +- https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactionsForMarket + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.bitstamp.net/api/#tag/Withdrawals/operation/GetWithdrawalRequests + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.bitstamp.net/api/#tag/Orders/operation/GetAllOpenOrders +- https://www.bitstamp.net/api/#tag/Orders/operation/GetOpenOrdersForMarket + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.bitstamp.net/api/#tag/Deposits/operation/GetCryptoDepositAddress + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestFiatWithdrawal +- https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestCryptoWithdrawal + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.withdraw (code, amount, address, tag[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromMainToSub +- https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromSubToMain + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bitstamp](#bitstamp) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitstamp.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitteam.md b/docs/ccxt/wiki/exchanges/bitteam.md new file mode 100644 index 0000000..81de670 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitteam.md @@ -0,0 +1,403 @@ + + + +## bitteam{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrders](#fetchorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitteam + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://bit.team/trade/api/documentation#/CCXT/getTradeApiCcxtPairs + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange api endpoint | + + +```javascript +bitteam.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - an associative dictionary of currencies + +**See**: https://bit.team/trade/api/documentation#/PUBLIC/getTradeApiCurrencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchCurrencies ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - A dictionary of [order book structures](https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure) indexed by market symbols + +**See**: https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcOrderbookPair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return (default 100, max 200) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<Order> - a list of [order structures](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of orde structures to retrieve (default 10) | +| params | object | No | extra parameters specific to the bitteam api endpoint | +| params.type | string | No | the status of the order - 'active', 'closed', 'cancelled', 'all', 'history' (default 'all') | + + +```javascript +bitteam.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - An [order structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrderId + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | int, string | Yes | order id | +| symbol | string | Yes | not used by bitteam fetchOrder () | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<Order> - a list of [order structures](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve (default 10) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<Order> - a list of [order structures](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of closed order structures to retrieve (default 10) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - a list of [order structures](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of canceled order structures to retrieve (default 10) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - an [order structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtOrdercreate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - An [order structure](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtCancelorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by bitteam cancelOrder () | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel open orders of market + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<object> - a list of [order structures](https://github.com/ccxt/ccxt/wiki/Manual#order-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtCancelallorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - a dictionary of [ticker structures](https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure) + +**See**: https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcSummary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - a [ticker structure](https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure) + +**See**: https://bit.team/trade/api/documentation#/PUBLIC/getTradeApiPairName + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<Trade> - a list of [trade structures](https://github.com/ccxt/ccxt/wiki/Manual#public-trades) + +**See**: https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcTradesPair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: Array<Trade> - a list of [trade structures](https://github.com/ccxt/ccxt/wiki/Manual#trade-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtTradesofuser + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve (default 10) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals from external wallets and between CoinList Pro trading account and CoinList wallet + +**Kind**: instance method of [bitteam](#bitteam) +**Returns**: object - a list of [transaction structure](https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure) + +**See**: https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiTransactionsofuser + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal | +| limit | int | No | max number of deposit/withdrawals to return (default 10) | +| params | object | No | extra parameters specific to the bitteam api endpoint | + + +```javascript +bitteam.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bittrade.md b/docs/ccxt/wiki/exchanges/bittrade.md new file mode 100644 index 0000000..b874f90 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bittrade.md @@ -0,0 +1,628 @@ + + + +## bittrade{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchAccounts](#fetchaccounts) +* [fetchCurrencies](#fetchcurrencies) +* [fetchBalance](#fetchbalance) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [watchTicker](#watchticker) +* [watchTrades](#watchtrades) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for huobijp + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchTickers (symbols[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchAccounts ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchCurrencies ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchBalance ([params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by bittrade cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by bittrade cancelOrders () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.withdraw (code, amount, address, tag[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.watchTicker (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bittrade](#bittrade) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bittrade.watchOrderBook (symbol[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bitvavo.md b/docs/ccxt/wiki/exchanges/bitvavo.md new file mode 100644 index 0000000..b8cd645 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bitvavo.md @@ -0,0 +1,1122 @@ + + + +## bitvavo{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [fetchDepositAddress](#fetchdepositaddress) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [withdraw](#withdraw) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchTrades](#watchtrades) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [createOrderWs](#createorderws) +* [editOrderWs](#editorderws) +* [cancelOrderWs](#cancelorderws) +* [cancelAllOrdersWs](#cancelallordersws) +* [fetchOrderWs](#fetchorderws) +* [fetchOrdersWs](#fetchordersws) +* [fetchOpenOrdersWs](#fetchopenordersws) +* [fetchMyTradesWs](#fetchmytradesws) +* [withdrawWs](#withdrawws) +* [fetchWithdrawalsWs](#fetchwithdrawalsws) +* [fetchOHLCVWs](#fetchohlcvws) +* [fetchDepositsWs](#fetchdepositsws) +* [fetchTradingFeesWs](#fetchtradingfeesws) +* [fetchMarketsWs](#fetchmarketsws) +* [fetchCurrenciesWs](#fetchcurrenciesws) +* [fetchBalanceWs](#fetchbalancews) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitvavo + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.bitvavo.com/#tag/General/paths/~1markets/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.bitvavo.com/#tag/General/paths/~1assets/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchCurrencies ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.bitvavo.com/#tag/Market-Data/paths/~1ticker~124h/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1trades/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitvavo.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1account/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchTradingFees ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1book/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitvavo.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1balance/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchBalance ([params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchDepositAddress (code[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the bitvavo api endpoint | +| params.timeInForce | string | No | "GTC", "IOC", or "PO" | +| params.stopPrice | float | No | Alias for triggerPrice | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.postOnly | bool | No | If true, the order will only be posted to the order book and not executed immediately | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.triggerType | string | No | "price" | +| params.triggerReference | string | No | "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order | +| params.selfTradePrevention | string | No | one of EXPIRE_BOTH, cancelOldest, cancelNewest or decrementAndCancel | +| params.disableMarketProtection | bool | No | don't cancel if the next fill price is 10% worse than the best fill price | +| params.responseRequired | bool | No | Set this to 'false' when only an acknowledgement of success or failure is required, this is faster. | + + +```javascript +bitvavo.createOrder (symbol, type, side, amount, price[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Orders/paths/~1order/put + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | No | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.editOrder (id, symbol, type, side[, amount, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete +- https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1orders/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +bitvavo.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1ordersOpen/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1trades/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bitvavo.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.bitvavo.com/#tag/General/paths/~1assets/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.bitvavo.com/#tag/Market-data-subscription-WebSocket/paths/~1subscribeTicker24h/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.bitvavo.com/#tag/Market-data-subscription-WebSocket/paths/~1subscribeTicker24h/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchTickers ([symbols, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.bitvavo.com/#tag/Market-data-subscription-WebSocket/paths/~1subscribeTicker24h/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchBidsAsks (symbols[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bitvavo.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### createOrderWs{docsify-ignore} +create a trade order + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Orders/paths/~1order/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the bitvavo api endpoint | +| params.timeInForce | string | No | "GTC", "IOC", or "PO" | +| params.stopPrice | float | No | The price at which a trigger order is triggered at | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.postOnly | bool | No | If true, the order will only be posted to the order book and not executed immediately | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.triggerType | string | No | "price" | +| params.triggerReference | string | No | "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use this to determine which parameter will trigger the order | +| params.selfTradePrevention | string | No | "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth" | +| params.disableMarketProtection | bool | No | don't cancel if the next fill price is 10% worse than the best fill price | +| params.responseRequired | bool | No | Set this to 'false' when only an acknowledgement of success or failure is required, this is faster. | + + +```javascript +bitvavo.createOrderWs (symbol, type, side, amount, price[, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Orders/paths/~1order/put + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | No | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.editOrderWs (id, symbol, type, side[, amount, price, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.cancelOrderWs (id, symbol[, params]) +``` + + + + +### cancelAllOrdersWs{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.cancelAllOrdersWs (symbol[, params]) +``` + + + + +### fetchOrderWs{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/General/paths/~1assets/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchOrderWs (id, symbol[, params]) +``` + + + + +### fetchOrdersWs{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.bitvavo.com/#tag/Orders/paths/~1orders/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of orde structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchOrdersWs (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrdersWs{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchOpenOrdersWs (symbol[, since, limit, params]) +``` + + + + +### fetchMyTradesWs{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.bitvavo.com/#tag/Trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchMyTradesWs (symbol[, since, limit, params]) +``` + + + + +### withdrawWs{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.withdrawWs (code, amount, address, tag[, params]) +``` + + + + +### fetchWithdrawalsWs{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchWithdrawalsWs (code[, since, limit, params]) +``` + + + + +### fetchOHLCVWs{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchOHLCVWs (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchDepositsWs{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchDepositsWs (code[, since, limit, params]) +``` + + + + +### fetchTradingFeesWs{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1account/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchTradingFeesWs ([params]) +``` + + + + +### fetchMarketsWs{docsify-ignore} +retrieves data on all markets for bitvavo + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.bitvavo.com/#tag/General/paths/~1markets/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange api endpoint | + + +```javascript +bitvavo.fetchMarketsWs ([params]) +``` + + + + +### fetchCurrenciesWs{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.bitvavo.com/#tag/General/paths/~1assets/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchCurrenciesWs ([params]) +``` + + + + +### fetchBalanceWs{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bitvavo](#bitvavo) +**Returns**: object - a [balance structure](https://docs.ccxt.com/en/latest/manual.html?#balance-structure) + +**See**: https://docs.bitvavo.com/#tag/Account/paths/~1balance/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the bitvavo api endpoint | + + +```javascript +bitvavo.fetchBalanceWs ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/blockchaincom.md b/docs/ccxt/wiki/exchanges/blockchaincom.md new file mode 100644 index 0000000..7146222 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/blockchaincom.md @@ -0,0 +1,631 @@ + + + +## blockchaincom{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchL3OrderBook](#fetchl3orderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchTradingFees](#fetchtradingfees) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchWithdrawal](#fetchwithdrawal) +* [fetchDeposits](#fetchdeposits) +* [fetchDeposit](#fetchdeposit) +* [fetchBalance](#fetchbalance) +* [fetchOrder](#fetchorder) +* [watchBalance](#watchbalance) +* [watchOHLCV](#watchohlcv) +* [watchTicker](#watchticker) +* [watchTrades](#watchtrades) +* [fetchOrders](#fetchorders) +* [watchOrderBook](#watchorderbook) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for blockchaincom + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://api.blockchain.com/v3/#getsymbols + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api.blockchain.com/v3/#getl3orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchL3OrderBook{docsify-ignore} +fetches level 3 information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - an [order book structure](https://docs.ccxt.com/#/?id=order-book-structure) + +**See**: https://api.blockchain.com/v3/#getl3orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchL3OrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.blockchain.com/v3/#gettickerbysymbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.blockchain.com/v3/#gettickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchTickers (symbols[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.blockchain.com/v3/#createorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.blockchain.com/v3/#deleteorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.blockchain.com/v3/#deleteallorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in, all markets are used if undefined, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://api.blockchain.com/v3/#getfees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchTradingFees ([params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.blockchain.com/v3/#getorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.blockchain.com/v3/#getorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.blockchain.com/v3/#getorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://api.blockchain.com/v3/#getfills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://api.blockchain.com/v3/#getdepositaddress + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.blockchain.com/v3/#createwithdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.blockchain.com/v3/#getwithdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchWithdrawal{docsify-ignore} +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.blockchain.com/v3/#getwithdrawalbyid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | withdrawal id | +| code | string | Yes | not used by blockchaincom.fetchWithdrawal | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchWithdrawal (id, code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.blockchain.com/v3/#getdeposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch information on a deposit + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.blockchain.com/v3/#getdepositbyid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | Yes | not used by blockchaincom fetchDeposit () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchDeposit (id, code[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://api.blockchain.com/v3/#getaccounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchBalance ([params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.blockchain.com/v3/#getorderbyid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by blockchaincom fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchOrder (id, symbol[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://exchange.blockchain.com/api/#balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.watchBalance ([params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market. + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://exchange.blockchain.com/api/#prices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents. Allows '1m', '5m', '15m', '1h', '6h' '1d'. Can only watch one timeframe per symbol. | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://exchange.blockchain.com/api/#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.watchTicker (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://exchange.blockchain.com/api/#trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.watchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange.blockchain.com/api/#mass-order-status-request-ordermassstatusrequest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blockchaincom.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [blockchaincom](#blockchaincom) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://exchange.blockchain.com/api/#l2-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | objectConstructor | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | accepts l2 or l3 for level 2 or level 3 order book | + + +```javascript +blockchaincom.watchOrderBook (symbol[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/blofin.md b/docs/ccxt/wiki/exchanges/blofin.md new file mode 100644 index 0000000..d500298 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/blofin.md @@ -0,0 +1,1068 @@ + + + +## blofin{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingRate](#fetchfundingrate) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [createOrders](#createorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchLedger](#fetchledger) +* [cancelOrders](#cancelorders) +* [transfer](#transfer) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchLeverages](#fetchleverages) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [closePosition](#closeposition) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMarginMode](#fetchmarginmode) +* [setMarginMode](#setmarginmode) +* [fetchPositionMode](#fetchpositionmode) +* [setPositionMode](#setpositionmode) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [watchBalance](#watchbalance) +* [watchOrdersForSymbols](#watchordersforsymbols) +* [watchPositions](#watchpositions) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for blofin + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://blofin.com/docs#get-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://blofin.com/docs#get-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://blofin.com/docs#get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.fetchTicker (symbol[, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches mark price for the market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.blofin.com/index.html#get-mark-price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +blofin.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://blofin.com/docs#get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.fetchTickers ([symbols, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://blofin.com/docs#get-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +blofin.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://blofin.com/docs#get-candlesticks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +blofin.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://blofin.com/docs#get-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | timestamp in ms of the latest funding rate to fetch | + + +```javascript +blofin.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://blofin.com/docs#get-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://blofin.com/docs#get-balance +- https://blofin.com/docs#get-futures-account-balance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountType | string | No | the type of account to fetch the balance for, either 'funding' or 'futures' or 'copy_trading' or 'earn' | + + +```javascript +blofin.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://blofin.com/docs#place-order +- https://blofin.com/docs#place-tpsl-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' or 'post_only' or 'ioc' or 'fok' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | string | No | the trigger price for a trigger order | +| params.reduceOnly | bool | No | a mark to reduce the position size for margin, swap and future orders | +| params.postOnly | bool | No | true to place a post only order | +| params.marginMode | string | No | 'cross' or 'isolated', default is 'cross' | +| params.stopLossPrice | float | No | stop loss trigger price (will use privatePostTradeOrderTpsl) | +| params.takeProfitPrice | float | No | take profit trigger price (will use privatePostTradeOrderTpsl) | +| params.positionSide | string | No | *stopLossPrice/takeProfitPrice orders only* 'long' or 'short' or 'net' default is 'net' | +| params.hedged | boolean | No | if true, the positionSide will be set to long/short instead of net, default is false | +| params.clientOrderId | string | No | a unique id for the order | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.takeProfit.price | float | No | take profit order price (if not provided the order will be a market order) | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.stopLoss.price | float | No | stop loss order price (if not provided the order will be a market order) | + + +```javascript +blofin.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://blofin.com/docs#cancel-order +- https://blofin.com/docs#cancel-tpsl-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | True if cancelling a trigger/conditional | +| params.tpsl | boolean | No | True if cancelling a tpsl order | + + +```javascript +blofin.cancelOrder (id, symbol[, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://blofin.com/docs#place-multiple-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.createOrders (orders[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +Fetch orders that are still open + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://blofin.com/docs#get-active-orders +- https://blofin.com/docs#get-active-tpsl-orders +- https://docs.blofin.com/index.html#get-active-algo-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if fetching trigger or conditional orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +blofin.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://blofin.com/docs#get-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | Timestamp in ms of the latest time to retrieve trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +blofin.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://blofin.com/docs#get-deposite-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +blofin.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://blofin.com/docs#get-withdraw-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +blofin.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://blofin.com/docs#get-funds-transfer-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +blofin.fetchLedger ([code, since, limit, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://blofin.com/docs#cancel-multiple-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/trigger order | + + +```javascript +blofin.cancelOrders (ids, symbol[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://blofin.com/docs#funds-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from (funding, swap, copy_trading, earn) | +| toAccount | string | Yes | account to transfer to (funding, swap, copy_trading, earn) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://blofin.com/docs#get-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | MARGIN, SWAP, FUTURES, OPTION | + + +```javascript +blofin.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://blofin.com/docs#get-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | MARGIN, SWAP, FUTURES, OPTION | + + +```javascript +blofin.fetchPositions ([symbols, params]) +``` + + + + +### fetchLeverages{docsify-ignore} +fetch the set leverage for all contract markets + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://docs.blofin.com/index.html#get-multiple-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | a list of unified market symbols, required on blofin | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | + + +```javascript +blofin.fetchLeverages (symbols[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://docs.blofin.com/index.html#get-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | + + +```javascript +blofin.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - response from the exchange + +**See**: https://blofin.com/docs#set-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | int | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | +| params.positionSide | string | No | 'long' or 'short' - required for hedged mode in isolated margin | + + +```javascript +blofin.setLeverage (leverage, symbol[, params]) +``` + + + + +### closePosition{docsify-ignore} +closes open positions for a market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - [A list of position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://blofin.com/docs#close-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | No | 'buy' or 'sell', leave as undefined in net mode | +| params | object | No | extra parameters specific to the blofin api endpoint | +| params.clientOrderId | string | No | a unique identifier for the order | +| params.marginMode | string | No | 'cross' or 'isolated', default is 'cross; | +| params.code | string | No | *required in the case of closing cross MARGIN position for Single-currency margin* margin currency EXCHANGE SPECIFIC PARAMETERS | +| params.autoCxl | boolean | No | whether any pending orders for closing out needs to be automatically canceled when close position via a market order. false or true, the default is false | +| params.tag | string | No | order tag a combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters | + + +```javascript +blofin.closePosition (symbol[, side, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://blofin.com/docs#get-order-history +- https://blofin.com/docs#get-tpsl-order-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of orde structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if fetching trigger or conditional orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +blofin.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of a trading pair + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://docs.blofin.com/index.html#get-margin-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the margin mode for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.fetchMarginMode (symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - response from the exchange + +**See**: https://docs.blofin.com/index.html#set-margin-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | No | unified market symbol (not used in blofin setMarginMode) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.setMarginMode (marginMode[, symbol, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See**: https://docs.blofin.com/index.html#get-position-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified symbol of the market to fetch the position mode for (not used in blofin fetchPositionMode) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.fetchPositionMode ([symbol, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - response from the exchange + +**See**: https://docs.blofin.com/index.html#set-position-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use hedged mode, false for one-way mode | +| symbol | string | No | not used by blofin setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.setPositionMode (hedged[, symbol, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.blofin.com/index.html#ws-trades-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.blofin.com/index.html#ws-trades-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.blofin.com/index.html#ws-order-book-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.blofin.com/index.html#ws-order-book-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.depth | string | No | the type of order book to subscribe to, default is 'depth/increase100', also accepts 'depth5' or 'depth20' or depth50 | + + +```javascript +blofin.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.blofin.com/index.html#ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.blofin.com/index.html#ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.blofin.com/index.html#ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.blofin.com/index.html#ws-candlesticks-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [blofin](#blofin) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.blofin.com/index.html#ws-account-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchBalance ([params]) +``` + + + + +### watchOrdersForSymbols{docsify-ignore} +watches information on multiple orders made by the user across multiple symbols + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure + +**See**: https://docs.blofin.com/index.html#ws-order-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchOrdersForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [blofin](#blofin) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://docs.blofin.com/index.html#ws-positions-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +blofin.watchPositions (symbols[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/btcalpha.md b/docs/ccxt/wiki/exchanges/btcalpha.md new file mode 100644 index 0000000..7acd753 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/btcalpha.md @@ -0,0 +1,381 @@ + + + +## btcalpha{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for btcalpha + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://btc-alpha.github.io/api-docs/#list-all-currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchMarkets ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://btc-alpha.github.io/api-docs/#tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://btc-alpha.github.io/api-docs/#tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://btc-alpha.github.io/api-docs/#get-orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://btc-alpha.github.io/api-docs/#list-all-exchanges + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://btc-alpha.github.io/api-docs/#list-own-deposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://btc-alpha.github.io/api-docs/#list-own-made-withdraws + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://btc-alpha.github.io/api-docs/#charts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://btc-alpha.github.io/api-docs/#list-own-wallets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://btc-alpha.github.io/api-docs/#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://btc-alpha.github.io/api-docs/#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://btc-alpha.github.io/api-docs/#retrieve-single-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by btcalpha fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://btc-alpha.github.io/api-docs/#list-own-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://btc-alpha.github.io/api-docs/#list-own-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://btc-alpha.github.io/api-docs/#list-own-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [btcalpha](#btcalpha) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://btc-alpha.github.io/api-docs/#list-own-exchanges + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcalpha.fetchMyTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/btcbox.md b/docs/ccxt/wiki/exchanges/btcbox.md new file mode 100644 index 0000000..9a3ffe7 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/btcbox.md @@ -0,0 +1,258 @@ + + + +## btcbox{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for ace + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc13 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://blog.btcbox.jp/en/archives/8762#toc6 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc5 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchTickers ([symbols, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc7 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc18 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc17 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc16 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc15 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [btcbox](#btcbox) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://blog.btcbox.jp/en/archives/8762#toc15 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcbox.fetchOpenOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/btcmarkets.md b/docs/ccxt/wiki/exchanges/btcmarkets.md new file mode 100644 index 0000000..c7a6b41 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/btcmarkets.md @@ -0,0 +1,453 @@ + + + +## btcmarkets{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchMarkets](#fetchmarkets) +* [fetchTime](#fetchtime) +* [fetchBalance](#fetchbalance) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [cancelOrders](#cancelorders) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [withdraw](#withdraw) + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1transfers/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1deposits/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1withdrawals/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for btcmarkets + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchMarkets ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.btcmarkets.net/v3/#tag/Misc-APIs/paths/~1v3~1time/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchTime ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Account-APIs/paths/~1v3~1accounts~1me~1balances/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchBalance ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1candles/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1orderbook/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1ticker/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.btcmarkets.net/v3/#tag/Market-Data-APIs/paths/~1v3~1markets~1{marketId}~1trades/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Order-Placement-APIs/paths/~1v3~1orders/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | + + +```javascript +btcmarkets.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Batch-Order-APIs/paths/~1v3~1batchorders~1{ids}/delete + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by btcmarkets cancelOrders () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcmarkets.net/v3/#operation/cancelOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by btcmarket cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcmarkets.net/v3/#operation/getOrderById + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by btcmarkets fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcmarkets.net/v3/#operation/listOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcmarkets.net/v3/#operation/listOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcmarkets.net/v3/#operation/listOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.btcmarkets.net/v3/#operation/getTrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [btcmarkets](#btcmarkets) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.btcmarkets.net/v3/#tag/Fund-Management-APIs/paths/~1v3~1withdrawals/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcmarkets.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/btcturk.md b/docs/ccxt/wiki/exchanges/btcturk.md new file mode 100644 index 0000000..4d79597 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/btcturk.md @@ -0,0 +1,287 @@ + + + +## btcturk{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrders](#fetchorders) +* [fetchMyTrades](#fetchmytrades) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for btcturk + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.btcturk.com/public-endpoints/exchange-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.btcturk.com/private-endpoints/account-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.btcturk.com/public-endpoints/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.btcturk.com/public-endpoints/ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.btcturk.com/public-endpoints/ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.btcturk.com/public-endpoints/trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.btcturk.com/public-endpoints/get-kline-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +btcturk.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcturk.com/private-endpoints/submit-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcturk.com/private-endpoints/cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by btcturk cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcturk.com/private-endpoints/open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.btcturk.com/private-endpoints/all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [btcturk](#btcturk) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.btcturk.com/private-endpoints/user-transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +btcturk.fetchMyTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/bybit.md b/docs/ccxt/wiki/exchanges/bybit.md new file mode 100644 index 0000000..e8decfa --- /dev/null +++ b/docs/ccxt/wiki/exchanges/bybit.md @@ -0,0 +1,2764 @@ + + + +## bybit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [enableDemoTrading](#enabledemotrading) +* [isUnifiedEnabled](#isunifiedenabled) +* [upgradeUnifiedTradeAccount](#upgradeunifiedtradeaccount) +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchOHLCV](#fetchohlcv) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchTrades](#fetchtrades) +* [fetchOrderBook](#fetchorderbook) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarkeSellOrderWithCost](#createmarkesellorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [editOrders](#editorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [cancelOrdersForSymbols](#cancelordersforsymbols) +* [cancelAllOrders](#cancelallorders) +* [fetchOrderClassic](#fetchorderclassic) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOrdersClassic](#fetchordersclassic) +* [fetchClosedOrder](#fetchclosedorder) +* [fetchOpenOrder](#fetchopenorder) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchLedger](#fetchledger) +* [withdraw](#withdraw) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchLeverage](#fetchleverage) +* [setMarginMode](#setmarginmode) +* [setLeverage](#setleverage) +* [setPositionMode](#setpositionmode) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchOpenInterestHistory](#fetchopeninteresthistory) +* [fetchCrossBorrowRate](#fetchcrossborrowrate) +* [fetchBorrowInterest](#fetchborrowinterest) +* [fetchBorrowRateHistory](#fetchborrowratehistory) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [borrowCrossMargin](#borrowcrossmargin) +* [repayCrossMargin](#repaycrossmargin) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchSettlementHistory](#fetchsettlementhistory) +* [fetchMySettlementHistory](#fetchmysettlementhistory) +* [fetchVolatilityHistory](#fetchvolatilityhistory) +* [fetchGreeks](#fetchgreeks) +* [fetchAllGreeks](#fetchallgreeks) +* [fetchMyLiquidations](#fetchmyliquidations) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchOption](#fetchoption) +* [fetchOptionChain](#fetchoptionchain) +* [fetchPositionsHistory](#fetchpositionshistory) +* [fetchConvertCurrencies](#fetchconvertcurrencies) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTrade](#fetchconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [fetchLongShortRatioHistory](#fetchlongshortratiohistory) +* [createOrderWs](#createorderws) +* [editOrderWs](#editorderws) +* [cancelOrderWs](#cancelorderws) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [unWatchTickers](#unwatchtickers) +* [unWatchTicker](#unwatchticker) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [unWatchOHLCVForSymbols](#unwatchohlcvforsymbols) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [unWatchOrderBookForSymbols](#unwatchorderbookforsymbols) +* [unWatchOrderBook](#unwatchorderbook) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [watchMyTrades](#watchmytrades) +* [unWatchMyTrades](#unwatchmytrades) +* [watchPositions](#watchpositions) +* [unWatchPositions](#unwatchpositions) +* [watchLiquidations](#watchliquidations) +* [watchOrders](#watchorders) +* [unWatchOrders](#unwatchorders) +* [watchBalance](#watchbalance) + + + +### enableDemoTrading{docsify-ignore} +enables or disables demo trading mode + +**Kind**: instance method of [bybit](#bybit) + +**See**: https://bybit-exchange.github.io/docs/v5/demo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| enable | boolean | No | true if demo trading should be enabled, false otherwise | + + +```javascript +bybit.enableDemoTrading ([enable]) +``` + + + + +### isUnifiedEnabled{docsify-ignore} +returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled + +**Kind**: instance method of [bybit](#bybit) +**Returns**: any - [enableUnifiedMargin, enableUnifiedAccount] + +**See** + +- https://bybit-exchange.github.io/docs/v5/user/apikey-info#http-request +- https://bybit-exchange.github.io/docs/v5/account/account-info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.isUnifiedEnabled ([params]) +``` + + + + +### upgradeUnifiedTradeAccount{docsify-ignore} +upgrades the account to unified trade account *warning* this is irreversible + +**Kind**: instance method of [bybit](#bybit) +**Returns**: any - nothing + +**See**: https://bybit-exchange.github.io/docs/v5/account/upgrade-unified-account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.upgradeUnifiedTradeAccount ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [bybit](#bybit) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://bybit-exchange.github.io/docs/v5/market/time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an associative dictionary of currencies + +**See**: https://bybit-exchange.github.io/docs/v5/asset/coin-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bybit + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://bybit-exchange.github.io/docs/v5/market/instrument + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an array of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | *contract only* 'linear', 'inverse' | +| params.baseCoin | string | No | *option only* base coin, default is 'BTC' | + + +```javascript +bybit.fetchTickers (symbols[, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | *contract only* 'linear', 'inverse' | +| params.baseCoin | string | No | *option only* base coin, default is 'BTC' | + + +```javascript +bybit.fetchBidsAsks (symbols[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bybit-exchange.github.io/docs/v5/market/kline +- https://bybit-exchange.github.io/docs/v5/market/mark-kline +- https://bybit-exchange.github.io/docs/v5/market/index-kline +- https://bybit-exchange.github.io/docs/v5/market/preimum-index-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetches funding rates for multiple markets + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/history-fund-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://bybit-exchange.github.io/docs/v5/market/recent-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | + + +```javascript +bybit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://bybit-exchange.github.io/docs/v5/market/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/spot-margin-normal/account-info +- https://bybit-exchange.github.io/docs/v5/asset/all-balance +- https://bybit-exchange.github.io/docs/v5/account/wallet-balance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | wallet type, ['spot', 'swap', 'funding'] | + + +```javascript +bybit.fetchBalance ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarkeSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.createMarkeSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/order/create-order +- https://bybit-exchange.github.io/docs/v5/position/trading-stop + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | "GTC", "IOC", "FOK" | +| params.postOnly | bool | No | true or false whether the order is post-only | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.positionIdx | string | No | *contracts only* 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode | +| params.hedged | bool | No | *contracts only* true for hedged mode, false for one way mode, default is false | +| params.isLeverage | int | No | *unified spot only* false then spot trading true then margin trading | +| params.tpslMode | string | No | *contract only* 'full' or 'partial' | +| params.mmp | string | No | *option only* market maker protection | +| params.triggerDirection | string | No | *contract only* the direction for trigger orders, 'ascending' or 'descending' | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.trailingAmount | string | No | the quote amount to trail away from the current market price | +| params.trailingTriggerPrice | string | No | the price to trigger a trailing order, default uses the price argument | + + +```javascript +bybit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/batch-place + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/order/amend-order +- https://bybit-exchange.github.io/docs/derivatives/unified/replace-order +- https://bybit-exchange.github.io/docs/api-explorer/derivatives/trade/contract/replace-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price that a trigger order is triggered at | +| params.stopLossPrice | float | No | The price that a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price that a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.triggerBy | string | No | 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice | +| params.slTriggerBy | string | No | 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss | +| params.tpTriggerby | string | No | 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit | + + +```javascript +bybit.editOrder (id, symbol, type, side, amount, price[, params]) +``` + + + + +### editOrders{docsify-ignore} +edit a list of trade orders + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/batch-amend + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.editOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | *spot only* whether the order is a trigger order | +| params.stop | boolean | No | alias for trigger | +| params.orderFilter | string | No | *spot only* 'Order' or 'StopOrder' or 'tpslOrder' | + + +```javascript +bybit.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/batch-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | client order ids | + + +```javascript +bybit.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - the api result + +**See**: https://bybit-exchange.github.io/docs/v5/order/dcp + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.product | string | No | OPTIONS, DERIVATIVES, SPOT, default is 'DERIVATIVES' | + + +```javascript +bybit.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### cancelOrdersForSymbols{docsify-ignore} +cancel multiple orders for multiple symbols + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/batch-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array<CancellationRequest> | Yes | list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}] | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.cancelOrdersForSymbols (orders[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/cancel-all + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if trigger order | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.baseCoin | string | No | Base coin. Supports linear, inverse & option | +| params.settleCoin | string | No | Settle coin. Supports linear, inverse & option | + + +```javascript +bybit.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrderClassic{docsify-ignore} +fetches information on an order made by the user *classic accounts only* + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchOrderClassic (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +*classic accounts only/ spot not supported* fetches information on an order made by the user *classic accounts only* + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.acknowledged | object | No | to suppress the warning, set to true | + + +```javascript +bybit.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +*classic accounts only/ spot not supported* fetches information on multiple orders made by the user *classic accounts only/ spot not supported* + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if trigger order | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrdersClassic{docsify-ignore} +fetches information on multiple orders made by the user *classic accounts only* + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if trigger order | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchOrdersClassic (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrder{docsify-ignore} +fetches information on a closed order made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching a closed trigger order | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | + + +```javascript +bybit.fetchClosedOrder (id[, symbol, params]) +``` + + + + +### fetchOpenOrder{docsify-ignore} +fetches information on an open order made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/open-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching an open trigger order | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.baseCoin | string | No | Base coin. Supports linear, inverse & option | +| params.settleCoin | string | No | Settle coin. Supports linear, inverse & option | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | + + +```javascript +bybit.fetchOpenOrder (id[, symbol, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple canceled and closed orders made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchCanceledAndClosedOrders ([symbol, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching closed trigger orders | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchClosedOrders ([symbol, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if trigger order | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchCanceledOrders ([symbol, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/order/open-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching open trigger orders | +| params.stop | boolean | No | alias for trigger | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.baseCoin | string | No | Base coin. Supports linear, inverse & option | +| params.settleCoin | string | No | Settle coin. Supports linear, inverse & option | +| params.orderFilter | string | No | 'Order' or 'StopOrder' or 'tpslOrder' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/position/execution + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + +**See**: https://bybit-exchange.github.io/docs/v5/asset/master-deposit-addr + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/master-deposit-addr + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/deposit-record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for, default = 30 days before the current time | +| limit | int | No | the maximum number of deposits structures to retrieve, default = 50, max = 50 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch deposits for, default = 30 days after since EXCHANGE SPECIFIC PARAMETERS | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.cursor | string | No | used for pagination | + + +```javascript +bybit.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/withdraw-record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://bybit-exchange.github.io/docs/v5/account/transaction-log +- https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.subType | string | No | if inverse will use v5/account/contract-transaction-log | + + +```javascript +bybit.fetchLedger ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountType | string | No | 'UTA', 'FUND', 'FUND,UTA', and 'SPOT (for classic accounts only) | + + +```javascript +bybit.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.baseCoin | string | No | Base coin. Supports linear, inverse & option | +| params.settleCoin | string | No | Settle coin. Supports linear, inverse & option | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +bybit.fetchPositions (symbols[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchLeverage (symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode (account) or trade mode (symbol) + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - response from the exchange + +**See** + +- https://bybit-exchange.github.io/docs/v5/account/set-margin-mode +- https://bybit-exchange.github.io/docs/v5/position/cross-isolate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | account mode must be either [isolated, cross, portfolio], trade mode must be either [isolated, cross] | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.leverage | string | No | the rate of leverage, is required if setting trade mode (symbol) | + + +```javascript +bybit.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - response from the exchange + +**See**: https://bybit-exchange.github.io/docs/v5/position/leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.buyLeverage | string | No | leverage for buy side | +| params.sellLeverage | string | No | leverage for sell side | + + +```javascript +bybit.setLeverage (leverage, symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - response from the exchange + +**See**: https://bybit-exchange.github.io/docs/v5/position/position-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | | +| symbol | string | Yes | used for unified account with inverse market | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +Retrieves the open interest of a derivative trading pair + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/open-interest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| params | object | No | exchange specific parameters | +| params.interval | string | No | 5m, 15m, 30m, 1h, 4h, 1d | +| params.category | string | No | "linear" or "inverse" | + + +```javascript +bybit.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchOpenInterestHistory{docsify-ignore} +Gets the total amount of unsettled contracts. In other words, the total number of contracts held in open positions + +**Kind**: instance method of [bybit](#bybit) +**Returns**: An array of open interest structures + +**See**: https://bybit-exchange.github.io/docs/v5/market/open-interest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified market symbol | +| timeframe | string | Yes | "5m", 15m, 30m, 1h, 4h, 1d | +| since | int | No | Not used by Bybit | +| limit | int | No | The number of open interest structures to return. Max 200, default 50 | +| params | object | No | Exchange specific parameters | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchOpenInterestHistory (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchCrossBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [borrow rate structure](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://bybit-exchange.github.io/docs/zh-TW/v5/spot-margin-normal/interest-quota + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchCrossBorrowRate (code[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See**: https://bybit-exchange.github.io/docs/zh-TW/v5/spot-margin-normal/account-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| symbol | string | Yes | unified market symbol when fetch interest in isolated markets | +| since | number | No | the earliest time in ms to fetch borrrow interest for | +| limit | number | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchBorrowInterest (code, symbol[, since, limit, params]) +``` + + + + +### fetchBorrowRateHistory{docsify-ignore} +retrieves a history of a currencies borrow interest rate at specific time slots + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - an array of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/spot-margin-uta/historical-interest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | timestamp for the earliest borrow rate | +| limit | int | No | the maximum number of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +bybit.fetchBorrowRateHistory (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/create-inter-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.transferId | string | No | UUID, which is unique across the platform | + + +```javascript +bybit.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/inter-transfer-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfer structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchTransfers (code[, since, limit, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrow + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.borrowCrossMargin (code, amount[, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/spot-margin-normal/repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.repayCrossMargin (code, amount[, params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/risk-limit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchMarketLeverageTiers (symbol[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/account/fee-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://bybit-exchange.github.io/docs/v5/account/fee-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | + + +```javascript +bybit.fetchTradingFees ([params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/coin-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string> | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchSettlementHistory{docsify-ignore} +fetches historical settlement records + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [settlement history objects] + +**See**: https://bybit-exchange.github.io/docs/v5/market/delivery-price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | + + +```javascript +bybit.fetchSettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchMySettlementHistory{docsify-ignore} +fetches historical settlement records of the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [settlement history objects] + +**See**: https://bybit-exchange.github.io/docs/v5/asset/delivery + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | + + +```javascript +bybit.fetchMySettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchVolatilityHistory{docsify-ignore} +fetch the historical volatility of an option market based on an underlying asset + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [volatility history objects](https://docs.ccxt.com/#/?id=volatility-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/iv + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.period | int | No | the period in days to fetch the volatility for: 7,14,21,30,60,90,180,270 | + + +```javascript +bybit.fetchVolatilityHistory (code[, params]) +``` + + + + +### fetchGreeks{docsify-ignore} +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchGreeks (symbol[, params]) +``` + + + + +### fetchAllGreeks{docsify-ignore} +fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://bybit-exchange.github.io/docs/api-explorer/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch greeks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.baseCoin | string | No | the baseCoin of the symbol, default is BTC | + + +```javascript +bybit.fetchAllGreeks ([symbols, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the exchange API endpoint | +| params.type | string | No | market type, ['swap', 'option', 'spot'] | +| params.subType | string | No | market subType, ['linear', 'inverse'] | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchMyLiquidations ([symbol, since, limit, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, for different trade sizes + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See**: https://bybit-exchange.github.io/docs/v5/market/risk-limit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | market subType, ['linear', 'inverse'], default is 'linear' | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchLeverageTiers ([symbols, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +bybit.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchOption{docsify-ignore} +fetches option data that is commonly found in an option chain + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [option chain structure](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchOption (symbol[, params]) +``` + + + + +### fetchOptionChain{docsify-ignore} +fetches data for an underlying asset that is commonly found in an option chain + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a list of [option chain structures](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | base currency to fetch an option chain for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchOptionChain (code[, params]) +``` + + + + +### fetchPositionsHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/position/close-pnl + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | a list of unified market symbols | +| since | int | No | timestamp in ms of the earliest position to fetch, params["until"] - since <= 7 days | +| limit | int | No | the maximum amount of records to fetch, default=50, max=100 | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | timestamp in ms of the latest position to fetch, params["until"] - since <= 7 days | +| params.subType | string | No | 'linear' or 'inverse' | + + +```javascript +bybit.fetchPositionsHistory (symbols[, since, limit, params]) +``` + + + + +### fetchConvertCurrencies{docsify-ignore} +fetches all available currencies that can be converted + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an associative dictionary of currencies + +**See**: https://bybit-exchange.github.io/docs/v5/asset/convert/convert-coin-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountType | string | No | eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract | + + +```javascript +bybit.fetchConvertCurrencies ([params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/convert/apply-quote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountType | string | No | eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract | + + +```javascript +bybit.fetchConvertQuote (fromCode, toCode[, amount, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/convert/confirm-quote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | Yes | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.createConvertTrade (id, fromCode, toCode, amount[, params]) +``` + + + + +### fetchConvertTrade{docsify-ignore} +fetch the data for a conversion trade + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-result + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to fetch | +| code | string | No | the unified currency code of the conversion trade | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountType | string | No | eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract | + + +```javascript +bybit.fetchConvertTrade (id[, code, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/asset/convert/get-convert-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountType | string | No | eb_convert_uta, eb_convert_spot, eb_convert_funding, eb_convert_inverse, or eb_convert_contract | + + +```javascript +bybit.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### fetchLongShortRatioHistory{docsify-ignore} +fetches the long short ratio history for a unified market symbol + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - an array of [long short ratio structures](https://docs.ccxt.com/#/?id=long-short-ratio-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/market/long-short-ratio + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the long short ratio for | +| timeframe | string | No | the period for the ratio, default is 24 hours | +| since | int | No | the earliest time in ms to fetch ratios for | +| limit | int | No | the maximum number of long short ratio structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.fetchLongShortRatioHistory (symbol[, timeframe, since, limit, params]) +``` + + + + +### createOrderWs{docsify-ignore} +create a trade order + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/order/create-order +- https://bybit-exchange.github.io/docs/v5/websocket/trade/guideline#createamendcancel-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | "GTC", "IOC", "FOK" | +| params.postOnly | bool | No | true or false whether the order is post-only | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.positionIdx | string | No | *contracts only* 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode | +| params.isLeverage | boolean | No | *unified spot only* false then spot trading true then margin trading | +| params.tpslMode | string | No | *contract only* 'full' or 'partial' | +| params.mmp | string | No | *option only* market maker protection | +| params.triggerDirection | string | No | *contract only* the direction for trigger orders, 'above' or 'below' | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.trailingAmount | string | No | the quote amount to trail away from the current market price | +| params.trailingTriggerPrice | string | No | the price to trigger a trailing order, default uses the price argument | + + +```javascript +bybit.createOrderWs (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/order/amend-order +- https://bybit-exchange.github.io/docs/v5/websocket/trade/guideline#createamendcancel-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price that a trigger order is triggered at | +| params.stopLossPrice | float | No | The price that a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price that a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.triggerBy | string | No | 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for triggerPrice | +| params.slTriggerBy | string | No | 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for stopLoss | +| params.tpTriggerby | string | No | 'IndexPrice', 'MarkPrice' or 'LastPrice', default is 'LastPrice', required if no initial value for takeProfit | + + +```javascript +bybit.editOrderWs (id, symbol, type, side, amount, price[, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +cancels an open order + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/order/cancel-order +- https://bybit-exchange.github.io/docs/v5/websocket/trade/guideline#createamendcancel-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | *spot only* whether the order is a trigger order | +| params.orderFilter | string | No | *spot only* 'Order' or 'StopOrder' or 'tpslOrder' | + + +```javascript +bybit.cancelOrderWs (id, symbol[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/ticker +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/ticker +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchTickers (symbols[, params]) +``` + + + + +### unWatchTickers{docsify-ignore} +unWatches a price ticker + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/ticker +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.unWatchTickers (symbols[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/ticker +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.unWatchTicker (symbol[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/kline +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/kline +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### unWatchOHLCVForSymbols{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/kline +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.unWatchOHLCVForSymbols (symbolsAndTimeframes[, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/public/kline +- https://bybit-exchange.github.io/docs/v5/websocket/public/etp-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### unWatchOrderBookForSymbols{docsify-ignore} +unsubscribe from the orderbook channel + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | orderbook limit, default is undefined | + + +```javascript +bybit.unWatchOrderBookForSymbols (symbols[, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unsubscribe from the orderbook channel + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | orderbook limit, default is undefined | + + +```javascript +bybit.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +unsubscribe from the trades channel + +**Kind**: instance method of [bybit](#bybit) +**Returns**: any - status of the unwatch request + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.unWatchTradesForSymbols (symbols[, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unsubscribe from the trades channel + +**Kind**: instance method of [bybit](#bybit) +**Returns**: any - status of the unwatch request + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.unWatchTrades (symbol[, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/private/execution +- https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | +| params.executionFast | boolean | No | use fast execution | + + +```javascript +bybit.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### unWatchMyTrades{docsify-ignore} +unWatches information on multiple trades made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://bybit-exchange.github.io/docs/v5/websocket/private/execution +- https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | +| params.executionFast | boolean | No | use fast execution | + + +```javascript +bybit.unWatchMyTrades (symbol[, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/private/position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchPositions ([symbols, since, limit, params]) +``` + + + + +### unWatchPositions{docsify-ignore} +unWatches all open positions + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - status of the unwatch request + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/private/position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.unWatchPositions ([symbols, params]) +``` + + + + +### watchLiquidations{docsify-ignore} +watch the public liquidations of a trading pair + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/public/liquidation + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | +| params.method | string | No | exchange specific method, supported: liquidation, allLiquidation | + + +```javascript +bybit.watchLiquidations (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/private/order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchOrders (symbol[, since, limit, params]) +``` + + + + +### unWatchOrders{docsify-ignore} +unWatches information on multiple orders made by the user + +**Kind**: instance method of [bybit](#bybit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/private/order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | + + +```javascript +bybit.unWatchOrders (symbol[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [bybit](#bybit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://bybit-exchange.github.io/docs/v5/websocket/private/wallet + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +bybit.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/cex.md b/docs/ccxt/wiki/exchanges/cex.md new file mode 100644 index 0000000..7f5290a --- /dev/null +++ b/docs/ccxt/wiki/exchanges/cex.md @@ -0,0 +1,897 @@ + + + +## cex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTime](#fetchtime) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchTradingFees](#fetchtradingfees) +* [fetchBalance](#fetchbalance) +* [fetchOrders](#fetchorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOpenOrder](#fetchopenorder) +* [fetchClosedOrder](#fetchclosedorder) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchLedger](#fetchledger) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [transfer](#transfer) +* [fetchDepositAddress](#fetchdepositaddress) +* [watchBalance](#watchbalance) +* [watchTrades](#watchtrades) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [fetchTickerWs](#fetchtickerws) +* [fetchBalanceWs](#fetchbalancews) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchOrderBook](#watchorderbook) +* [watchOHLCV](#watchohlcv) +* [fetchOrderWs](#fetchorderws) +* [fetchOpenOrdersWs](#fetchopenordersws) +* [createOrderWs](#createorderws) +* [editOrderWs](#editorderws) +* [cancelOrderWs](#cancelorderws) +* [cancelOrdersWs](#cancelordersws) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [cex](#cex) +**Returns**: dict - an associative dictionary of currencies + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-currencies-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | dict | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for ace + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-pairs-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchMarkets ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [cex](#cex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchTime ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest entry | + + +```javascript +cex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cex](#cex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest entry | + + +```javascript +cex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://trade.cex.io/docs/#rest-public-api-calls-candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchTradingFees ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-account-status-v3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | object | No | 'privatePostGetMyWalletBalance' or 'privatePostGetMyAccountStatusV3' | +| params.account | object | No | in case 'privatePostGetMyAccountStatusV3' is chosen, this can specify the account name (default is empty string) | + + +```javascript +cex.fetchBalance ([params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| status | string | Yes | order status to fetch for | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest entry | + + +```javascript +cex.fetchOrders (status, symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrder{docsify-ignore} +fetches information on an open order made by the user + +**Kind**: instance method of [cex](#cex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchOpenOrder (id[, symbol, params]) +``` + + + + +### fetchClosedOrder{docsify-ignore} +fetches information on an closed order made by the user + +**Kind**: instance method of [cex](#cex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchClosedOrder (id[, symbol, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [cex](#cex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountId | string | No | account-id to use (default is empty string) | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | + + +```javascript +cex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [cex](#cex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-cancel-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-transaction-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | + + +```javascript +cex.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-funding-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-internal-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | 'SPOT', 'FUND', or 'CONTRACT' | +| toAccount | string | Yes | 'SPOT', 'FUND', or 'CONTRACT' | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [cex](#cex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://trade.cex.io/docs/#rest-private-api-calls-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountId | string | No | account-id (default to empty string) to refer to (at this moment, only sub-accounts allowed by exchange) | + + +```javascript +cex.fetchDepositAddress (code[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://cex.io/websocket-api#get-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.watchBalance ([params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol. Note: can only watch one symbol at a time. + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://cex.io/websocket-api#old-pair-room + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://cex.io/websocket-api#ticker-subscription + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | public or private | + + +```javascript +cex.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://cex.io/websocket-api#ticker-subscription + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.watchTickers (symbols[, params]) +``` + + + + +### fetchTickerWs{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.cex.io/#ws-api-ticker-deprecated + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +cex.fetchTickerWs (symbol[, params]) +``` + + + + +### fetchBalanceWs{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.cex.io/#ws-api-get-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +cex.fetchBalanceWs ([params]) +``` + + + + +### watchOrders{docsify-ignore} +get the list of orders associated with the user. Note: In CEX.IO system, orders can be present in trade engine or in archive database. There can be time periods (~2 seconds or more), when order is done/canceled, but still not moved to archive database. That means, you cannot see it using calls: archived-orders/open-orders. + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.cex.io/#ws-api-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +get the list of trades associated with the user. Note: In CEX.IO system, orders can be present in trade engine or in archive database. There can be time periods (~2 seconds or more), when order is done/canceled, but still not moved to archive database. That means, you cannot see it using calls: archived-orders/open-orders. + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.cex.io/#ws-api-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cex](#cex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://cex.io/websocket-api#orderbook-subscribe + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market. It will return the last 120 minutes with the selected timeframe and then 1m candle updates after that. + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://cex.io/websocket-api#minute-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents. | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cex.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderWs{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [cex](#cex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cex.io/#ws-api-get-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by cex fetchOrder | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +cex.fetchOrderWs (id, symbol[, params]) +``` + + + + +### fetchOpenOrdersWs{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [cex](#cex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cex.io/#ws-api-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +cex.fetchOpenOrdersWs (symbol[, since, limit, params]) +``` + + + + +### createOrderWs{docsify-ignore} +create a trade order + +**Kind**: instance method of [cex](#cex) +**Returns**: object - an [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See**: https://docs.cex.io/#ws-api-order-placement + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the kraken api endpoint | +| params.maker_only | boolean | No | Optional, maker only places an order only if offers best sell (<= max) or buy(>= max) price for this pair, if not order placement will be rejected with an error - "Order is not maker" | + + +```javascript +cex.createOrderWs (symbol, type, side, amount, price[, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order + +**Kind**: instance method of [cex](#cex) +**Returns**: object - an [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See**: https://docs.cex.io/#ws-api-cancel-replace + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float, undefined | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +cex.editOrderWs (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +cancels an open order + +**Kind**: instance method of [cex](#cex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cex.io/#ws-api-order-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by cex cancelOrder () | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +cex.cancelOrderWs (id, symbol[, params]) +``` + + + + +### cancelOrdersWs{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [cex](#cex) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cex.io/#ws-api-mass-cancel-place + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by cex cancelOrders() | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +cex.cancelOrdersWs (ids, symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinbase.md b/docs/ccxt/wiki/exchanges/coinbase.md new file mode 100644 index 0000000..59f74e3 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinbase.md @@ -0,0 +1,1061 @@ + + + +## coinbase{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchAccounts](#fetchaccounts) +* [fetchPortfolios](#fetchportfolios) +* [createDepositAddress](#createdepositaddress) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchBalance](#fetchbalance) +* [fetchLedger](#fetchledger) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [editOrder](#editorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderBook](#fetchorderbook) +* [fetchBidsAsks](#fetchbidsasks) +* [withdraw](#withdraw) +* [fetchDepositAddress](#fetchdepositaddress) +* [deposit](#deposit) +* [fetchDeposit](#fetchdeposit) +* [fetchDepositMethodIds](#fetchdepositmethodids) +* [fetchDepositMethodId](#fetchdepositmethodid) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTrade](#fetchconverttrade) +* [closePosition](#closeposition) +* [fetchPositions](#fetchpositions) +* [fetchPosition](#fetchposition) +* [fetchTradingFees](#fetchtradingfees) +* [fetchPortfolioDetails](#fetchportfoliodetails) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | 'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime' | + + +```javascript +coinbase.fetchTime ([params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See** + +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getaccounts +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbase.fetchAccounts ([params]) +``` + + + + +### fetchPortfolios{docsify-ignore} +fetch all the portfolios + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getportfolios + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchPortfolios ([params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-addresses#create-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.createDepositAddress (code[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +Fetch all withdrawals made from an account. Won't return crypto withdrawals. Use fetchLedger for those. + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.cdp.coinbase.com/coinbase-app/docs/api-withdrawals#list-withdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.currencyType | string | No | "fiat" or "crypto" | + + +```javascript +coinbase.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +Fetch all fiat deposits made to an account. Won't return crypto deposits or staking rewards. Use fetchLedger for those. + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.cdp.coinbase.com/coinbase-app/docs/api-deposits#list-deposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.currencyType | string | No | "fiat" or "crypto" | + + +```javascript +coinbase.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinbase + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpublicproducts +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.usePrivate | boolean | No | use private endpoint for fetching markets | + + +```javascript +coinbase.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an associative dictionary of currencies + +**See** + +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-currencies#get-fiat-currencies +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchCurrencies ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getproducts +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-exchange-rates#get-exchange-rates + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.usePrivate | boolean | No | use private endpoint for fetching tickers | + + +```javascript +coinbase.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getmarkettrades +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-spot-price +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-buy-price +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-sell-price + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.usePrivate | boolean | No | whether to use the private endpoint for fetching the ticker | + + +```javascript +coinbase.fetchTicker (symbol[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getaccounts +- https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getfcmbalancesummary + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.v3 | boolean | No | default false, set true to use v3 api endpoint | +| params.type | string | No | "spot" (default) or "swap" or "future" | +| params.limit | int | No | default 250, maximum number of accounts to return | + + +```javascript +coinbase.fetchBalance ([params]) +``` + + + + +### fetchLedger{docsify-ignore} +Fetch the history of changes, i.e. actions done by the user or operations that altered the balance. Will return staking rewards, and crypto deposits or withdrawals. + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions#list-transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbase.fetchLedger ([code, since, limit, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_postorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_postorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, quote currency for 'market' 'buy' orders | +| price | float | No | the price to fulfill the order, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stopPrice | float | No | price to trigger stop orders | +| params.triggerPrice | float | No | price to trigger stop orders | +| params.stopLossPrice | float | No | price to trigger stop-loss orders | +| params.takeProfitPrice | float | No | price to trigger take-profit orders | +| params.postOnly | bool | No | true or false | +| params.timeInForce | string | No | 'GTC', 'IOC', 'GTD' or 'PO', 'FOK' | +| params.stop_direction | string | No | 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from | +| params.end_time | string | No | '2023-05-25T17:01:05.092Z' for 'GTD' orders | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.preview | boolean | No | default to false, wether to use the test/preview endpoint or not | +| params.leverage | float | No | default to 1, the leverage to use for the order | +| params.marginMode | string | No | 'cross' or 'isolated' | +| params.retail_portfolio_id | string | No | portfolio uid | +| params.is_max | boolean | No | Used in conjunction with tradable_balance to indicate the user wants to use their entire tradable balance | +| params.tradable_balance | string | No | amount of tradable balance | + + +```javascript +coinbase.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_cancelorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by coinbase cancelOrder() | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_cancelorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by coinbase cancelOrders() | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.cancelOrders (ids, symbol[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_editorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.preview | boolean | No | default to false, wether to use the test/preview endpoint or not | + + +```javascript +coinbase.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified market symbol that the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol that the orders were made in | +| since | int | No | the earliest time in ms to fetch orders | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbase.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on all currently open orders + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the orders | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | the latest time in ms to fetch trades for | + + +```javascript +coinbase.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the orders | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | the maximum number of closed order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | the latest time in ms to fetch trades for | + + +```javascript +coinbase.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_gethistoricalorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the orders | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | the maximum number of canceled order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpubliccandles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch, not used by coinbase | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.usePrivate | boolean | No | default false, when true will use the private endpoint to fetch the candles | + + +```javascript +coinbase.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpublicmarkettrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the trades | +| since | int | No | not used by coinbase fetchTrades | +| limit | int | No | the maximum number of trade structures to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.usePrivate | boolean | No | default false, when true will use the private endpoint to fetch the trades | + + +```javascript +coinbase.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getfills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the trades | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | the maximum number of trade structures to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbase.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpublicproductbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.usePrivate | boolean | No | default false, when true will use the private endpoint to fetch the order book | + + +```javascript +coinbase.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getbestbidask + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchBidsAsks ([symbols, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#send-money + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | No | an optional tag for the withdrawal | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.withdraw (code, amount, address[, tag, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchDepositAddress (code[, params]) +``` + + + + +### deposit{docsify-ignore} +make a deposit + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#deposit-funds + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to deposit | +| id | string | Yes | the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountId | string | No | the id of the account to deposit into | + + +```javascript +coinbase.deposit (code, amount, id[, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch information on a deposit, fiat only, for crypto transactions use fetchLedger + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#show-deposit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | No | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountId | string | No | the id of the account that the funds were deposited into | + + +```javascript +coinbase.fetchDeposit (id[, code, params]) +``` + + + + +### fetchDepositMethodIds{docsify-ignore} +fetch the deposit id for a fiat currency associated with this account + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an array of [deposit id structures](https://docs.ccxt.com/#/?id=deposit-id-structure) + +**See**: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethods + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchDepositMethodIds ([params]) +``` + + + + +### fetchDepositMethodId{docsify-ignore} +fetch the deposit id for a fiat currency associated with this account + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [deposit id structure](https://docs.ccxt.com/#/?id=deposit-id-structure) + +**See**: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getpaymentmethod + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the deposit payment method id | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchDepositMethodId (id[, params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_createconvertquote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trade_incentive_metadata | object | No | an object to fill in user incentive data | +| params.trade_incentive_metadata.user_incentive_id | string | No | the id of the incentive | +| params.trade_incentive_metadata.code_val | string | No | the code value of the incentive | + + +```javascript +coinbase.fetchConvertQuote (fromCode, toCode[, amount, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_commitconverttrade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.createConvertTrade (id, fromCode, toCode[, amount, params]) +``` + + + + +### fetchConvertTrade{docsify-ignore} +fetch the data for a conversion trade + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getconverttrade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to commit | +| code | string | Yes | the unified currency code that was converted from | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.toCode | strng | Yes | the unified currency code that was converted into | + + +```javascript +coinbase.fetchConvertTrade (id, code[, params]) +``` + + + + +### closePosition{docsify-ignore} +*futures only* closes open positions for a market + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cdp.coinbase.com/coinbase-app/trade/reference/retailbrokerageapi_closeposition + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | No | not used by coinbase | +| params | object | No | extra parameters specific to the coinbase api endpoint | +| params.clientOrderId | string | Yes | *mandatory* the client order id of the position to close | +| params.size | float | No | the size of the position to close, optional | + + +```javascript +coinbase.closePosition (symbol[, side, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getfcmpositions +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getintxpositions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolio | string | No | the portfolio UUID to fetch positions for | + + +```javascript +coinbase.fetchPositions ([symbols, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getintxposition +- https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getfcmposition + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.product_id | string | No | *futures only* the product id of the position to fetch, required for futures markets only | +| params.portfolio | string | No | *perpetual/swaps only* the portfolio UUID to fetch the position for, required for perpetual/swaps markets only | + + +```javascript +coinbase.fetchPosition (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/ + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' | + + +```javascript +coinbase.fetchTradingFees ([params]) +``` + + + + +### fetchPortfolioDetails{docsify-ignore} +Fetch details for a specific portfolio by UUID + +**Kind**: instance method of [coinbase](#coinbase) +**Returns**: Array<any> - An account structure + +**See**: https://docs.cloud.coinbase.com/advanced-trade/reference/retailbrokerageapi_getportfolios + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| portfolioUuid | string | Yes | The unique identifier of the portfolio to fetch | +| params | Dict | No | Extra parameters specific to the exchange API endpoint | + + +```javascript +coinbase.fetchPortfolioDetails (portfolioUuid[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinbaseexchange.md b/docs/ccxt/wiki/exchanges/coinbaseexchange.md new file mode 100644 index 0000000..ba58e09 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinbaseexchange.md @@ -0,0 +1,833 @@ + + + +## coinbaseexchange{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchAccounts](#fetchaccounts) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchTime](#fetchtime) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [withdraw](#withdraw) +* [fetchLedger](#fetchledger) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [createDepositAddress](#createdepositaddress) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchMyTradesForSymbols](#watchmytradesforsymbols) +* [watchOrdersForSymbols](#watchordersforsymbols) +* [watchOrders](#watchorders) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchOrderBook](#watchorderbook) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getcurrencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinbaseexchange + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchMarkets ([params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchAccounts ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproduct + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchTicker (symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseexchange.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducttrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproductcandles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseexchange.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchTime ([params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by coinbaseexchange fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch open orders for | + + +```javascript +coinbaseexchange.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch open orders for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseexchange.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch open orders for | + + +```javascript +coinbaseexchange.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_deleteorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.cancelAllOrders (symbol[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawpaymentmethod +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawcoinbaseaccount + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | + + +```javascript +coinbaseexchange.fetchLedger (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.id | string | No | account id, when defined, the endpoint used is '/accounts/{account_id}/transfers/' instead of '/transfers/' | + + +```javascript +coinbaseexchange.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers +- https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.createDepositAddress (code[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +coinbaseexchange.watchTickers ([symbols, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTradesForSymbols{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchMyTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOrdersForSymbols{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch orders for | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchOrdersForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinbaseexchange](#coinbaseexchange) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseexchange.watchOrderBook (symbol[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinbaseinternational.md b/docs/ccxt/wiki/exchanges/coinbaseinternational.md new file mode 100644 index 0000000..d6e5d50 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinbaseinternational.md @@ -0,0 +1,626 @@ + + + +## coinbaseinternational{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchAccounts](#fetchaccounts) +* [fetchOHLCV](#fetchohlcv) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchTransfers](#fetchtransfers) +* [createDepositAddress](#createdepositaddress) +* [setMargin](#setmargin) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchBalance](#fetchbalance) +* [transfer](#transfer) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [editOrder](#editorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [withdraw](#withdraw) + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://docs.cloud.coinbase.com/intx/reference/getportfolios + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchAccounts ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.cdp.coinbase.com/intx/reference/getinstrumentcandles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch, default 100 max 10000 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseinternational.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getinstrumentfunding + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseinternational.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://docs.cdp.coinbase.com/intx/reference/gettransfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.cdp.coinbase.com/intx/reference/gettransfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchTransfers (code[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See** + +- https://docs.cloud.coinbase.com/intx/reference/createaddress +- https://docs.cloud.coinbase.com/intx/reference/createcounterpartyid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network_arn_id | string | No | Identifies the blockchain network (e.g., networks/ethereum-mainnet/assets/313ef8a9-ae5a-5f2f-8a56-572c0e2a4d5a) if not provided will pick default | +| params.network | string | No | unified network code to identify the blockchain network | + + +```javascript +coinbaseinternational.createDepositAddress (code[, params]) +``` + + + + +### setMargin{docsify-ignore} +Either adds or reduces margin in order to set the margin to a specific value + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - A [margin structure](https://github.com/ccxt/ccxt/wiki/Manual#add-margin-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/setportfoliomarginoverride + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to set margin in | +| amount | float | Yes | the amount to set the margin to | +| params | object | No | parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.setMargin (symbol, amount[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getportfolioposition + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getportfoliopositions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchPositions ([symbols, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/gettransfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolios | string | No | Identifies the portfolios by UUID (e.g., 892e8c7c-e979-4cad-b61b-55a197932cf1) or portfolio ID (e.g., 5189861793641175). Can provide single or multiple portfolios to filter by or fetches transfers for all portfolios if none are provided. | +| params.until | int | No | Only find transfers updated before this time. Use timestamp format | +| params.status | string | No | The current status of transfer. Possible values: [PROCESSED, NEW, FAILED, STARTED] | +| params.type | string | No | The type of transfer Possible values: [DEPOSIT, WITHDRAW, REBATE, STIPEND, INTERNAL, FUNDING] | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseinternational.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolios | string | No | Identifies the portfolios by UUID (e.g., 892e8c7c-e979-4cad-b61b-55a197932cf1) or portfolio ID (e.g., 5189861793641175). Can provide single or multiple portfolios to filter by or fetches transfers for all portfolios if none are provided. | +| params.until | int | No | Only find transfers updated before this time. Use timestamp format | +| params.status | string | No | The current status of transfer. Possible values: [PROCESSED, NEW, FAILED, STARTED] | +| params.type | string | No | The type of transfer Possible values: [DEPOSIT, WITHDRAW, REBATE, STIPEND, INTERNAL, FUNDING] | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseinternational.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinbaseinternational + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.cloud.coinbase.com/intx/reference/getinstruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.cloud.coinbase.com/intx/reference/getassets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchCurrencies ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getinstruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getinstrumentquote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchTicker (symbol[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getportfoliobalances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.v3 | boolean | No | default false, set true to use v3 api endpoint | + + +```javascript +coinbaseinternational.fetchBalance ([params]) +``` + + + + +### transfer{docsify-ignore} +Transfer an amount of asset from one portfolio to another. + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a [transfer structure](https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/createportfolioassettransfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/createorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, quote currency for 'market' 'buy' orders | +| price | float | No | the price to fulfill the order, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stopPrice | float | No | alias for triggerPrice | +| params.triggerPrice | float | No | price to trigger stop orders | +| params.stopLossPrice | float | No | price to trigger stop-loss orders | +| params.postOnly | bool | No | true or false | +| params.tif | string | No | 'GTC', 'IOC', 'GTD' default is 'GTC' for limit orders and 'IOC' for market orders | +| params.expire_time | string | No | The expiration time required for orders with the time in force set to GTT. Must not go beyond 30 days of the current time. Uses ISO-8601 format (e.g., 2023-03-16T23:59:53Z) | +| params.stp_mode | string | No | Possible values: [NONE, AGGRESSING, BOTH] Specifies the behavior for self match handling. None disables the functionality, new cancels the newest order, and both cancels both orders. | + + +```javascript +coinbaseinternational.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/cancelorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by coinbaseinternational cancelOrder() | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.cancelAllOrders (symbol[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/modifyorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | Yes | client order id | + + +```javascript +coinbaseinternational.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/modifyorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified market symbol that the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinbaseinternational.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on all currently open orders + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the orders | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.offset | int | No | offset | +| params.event_type | string | No | The most recent type of event that happened to the order. Allowed values: NEW, TRADE, REPLACED | + + +```javascript +coinbaseinternational.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.cloud.coinbase.com/intx/reference/getmultiportfoliofills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the trades | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | the maximum number of trade structures to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +coinbaseinternational.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [coinbaseinternational](#coinbaseinternational) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.cloud.coinbase.com/intx/reference/withdraw +- https://docs.cloud.coinbase.com/intx/reference/counterpartywithdraw + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | No | an optional tag for the withdrawal | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.add_network_fee_to_total | boolean | No | if true, deducts network fee from the portfolio, otherwise deduct fee from the withdrawal | +| params.network_arn_id | string | No | Identifies the blockchain network (e.g., networks/ethereum-mainnet/assets/313ef8a9-ae5a-5f2f-8a56-572c0e2a4d5a) | +| params.nonce | string | No | a unique integer representing the withdrawal request | + + +```javascript +coinbaseinternational.withdraw (code, amount, address[, tag, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coincatch.md b/docs/ccxt/wiki/exchanges/coincatch.md new file mode 100644 index 0000000..61db43f --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coincatch.md @@ -0,0 +1,1535 @@ + + + +## coincatch{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchBalance](#fetchbalance) +* [transfer](#transfer) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [createSpotOrder](#createspotorder) +* [createSwapOrder](#createswaporder) +* [createOrderWithTakeProfitAndStopLoss](#createorderwithtakeprofitandstoploss) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMarginMode](#fetchmarginmode) +* [setMarginMode](#setmarginmode) +* [fetchPositionMode](#fetchpositionmode) +* [setPositionMode](#setpositionmode) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchPosition](#fetchposition) +* [fetchPositionsForSymbol](#fetchpositionsforsymbol) +* [fetchPositions](#fetchpositions) +* [fetchLedger](#fetchledger) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [watchBalance](#watchbalance) +* [watchOrders](#watchorders) +* [watchPositions](#watchpositions) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://coincatch.github.io/github.io/en/spot/#get-server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an associative dictionary of currencies + +**See**: https://coincatch.github.io/github.io/en/spot/#get-coin-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchCurrencies ([params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#get-coin-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string> | No | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchDepositWithdrawFees ([codes, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for the exchange + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-all-tickers +- https://coincatch.github.io/github.io/en/mix/#get-all-symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-single-ticker +- https://coincatch.github.io/github.io/en/mix/#get-single-symbol-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-all-tickers +- https://coincatch.github.io/github.io/en/mix/#get-all-symbol-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' (default 'spot') | +| params.productType | string | No | 'umcbl' or 'dmcbl' (default 'umcbl') - USDT perpetual contract or Universal margin perpetual contract | + + +```javascript +coincatch.fetchTickers ([symbols, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-merged-depth-data +- https://coincatch.github.io/github.io/en/mix/#get-merged-depth-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return (maximum and default value is 100) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.precision | string | No | 'scale0' (default), 'scale1', 'scale2' or 'scale3' - price accuracy, according to the selected accuracy as the step size to return the cumulative depth | + + +```javascript +coincatch.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-candle-data +- https://coincatch.github.io/github.io/en/mix/#get-candle-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch (default 100) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.price | string | No | "mark" for mark price candles | + + +```javascript +coincatch.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-recent-trades +- https://coincatch.github.io/github.io/en/mix/#get-fills + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest entry to fetch | + + +```javascript +coincatch.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#get-current-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#get-history-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of entries to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.pageNo | int | No | the page number to fetch | +| params.nextPage | bool | No | whether to query the next page (default false) | + + +```javascript +coincatch.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#get-account-assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch balance for (default 'spot') | +| params.productType | string | No | *swap only* 'umcbl' or 'dmcbl' (default 'umcbl') | + + +```javascript +coincatch.fetchBalance ([params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | 'spot' or 'swap' or 'mix_usdt' or 'mix_usd' - account to transfer from | +| toAccount | string | Yes | 'spot' or 'swap' or 'mix_usdt' or 'mix_usd' - account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the transfer | + + +```javascript +coincatch.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#get-coin-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | network for fetch deposit address | + + +```javascript +coincatch.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#get-deposit-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (not used by exchange) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | +| params.pageNo | int | No | pageNo default 1 | +| params.pageSize | int | No | pageSize (default 20, max 100) | + + +```javascript +coincatch.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#get-withdraw-list-v2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (default 50, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | +| params.clientOid | string | No | clientOid | +| params.orderId | string | No | The response orderId | +| params.idLessThan | string | No | Requests the content on the page before this ID (older data), the value input should be the orderId of the corresponding interface. | + + +```javascript +coincatch.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | No | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | Yes | network for withdraw (mandatory) | +| params.remark | string | No | remark | +| params.clientOid | string | No | custom id | + + +```javascript +coincatch.withdraw (code, amount, address[, tag, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#place-order +- https://coincatch.github.io/github.io/en/spot/#place-plan-order +- https://coincatch.github.io/github.io/en/mix/#place-order +- https://coincatch.github.io/github.io/en/mix/#place-plan-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' or 'LIMIT_MAKER' for spot, 'market' or 'limit' or 'STOP' for swap | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.hedged | bool | No | *swap markets only* must be set to true if position mode is hedged (default false) | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.triggerPrice | float | No | the price that the order is to be triggered | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'PO' | +| params.clientOrderId | string | No | a unique id for the order - is mandatory for swap | + + +```javascript +coincatch.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createSpotOrder{docsify-ignore} +create a trade order on spot market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#place-order +- https://coincatch.github.io/github.io/en/spot/#place-plan-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *market buy only* the quote quantity that can be used as an alternative for the amount | +| params.triggerPrice | float | No | the price that the order is to be triggered at | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'PO' | +| params.clientOrderId | string | No | a unique id for the order (max length 40) | + + +```javascript +coincatch.createSpotOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createSwapOrder{docsify-ignore} +create a trade order on swap market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/mix/#place-order +- https://coincatch.github.io/github.io/en/mix/#place-plan-order +- https://coincatch.github.io/github.io/en/mix/#place-stop-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.hedged | bool | No | must be set to true if position mode is hedged (default false) | +| params.postOnly | bool | No | *non-trigger orders only* if true, the order will only be posted to the order book and not executed immediately | +| params.reduceOnly | bool | No | true or false whether the order is reduce only | +| params.timeInForce | string | No | *non-trigger orders only* 'GTC', 'FOK', 'IOC' or 'PO' | +| params.clientOrderId | string | No | a unique id for the order | +| params.triggerPrice | float | No | the price that the order is to be triggered at | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | + + +```javascript +coincatch.createSwapOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrderWithTakeProfitAndStopLoss{docsify-ignore} +*swap markets only* create an order with a stop loss or take profit attached (type 3) + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency or the number of contracts | +| price | float | No | the price to fulfill the order, in units of the quote currency, ignored in market orders | +| takeProfit | float | No | the take profit price, in units of the quote currency | +| stopLoss | float | No | the stop loss price, in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.createOrderWithTakeProfitAndStopLoss (symbol, type, side, amount[, price, takeProfit, stopLoss, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders (all orders should be of the same symbol) + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#batch-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params (max 50 entries) | +| params | object | No | extra parameters specific to the api endpoint | + + +```javascript +coincatch.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade trigger, stop-looss or take-profit order + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#modify-plan-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user (non-trigger orders only) + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-order-details +- https://coincatch.github.io/github.io/en/mix/#get-order-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in (is mandatory for swap) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entry for (default 'spot') | +| params.clientOrderId | string | No | a unique id for the order that can be used as an alternative for the id | + + +```javascript +coincatch.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-order-list +- https://coincatch.github.io/github.io/en/spot/#get-current-plan-orders +- https://coincatch.github.io/github.io/en/mix/#get-open-order +- https://coincatch.github.io/github.io/en/mix/#get-all-open-order +- https://coincatch.github.io/github.io/en/mix/#get-plan-order-tpsl-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if fetching trigger orders (default false) | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entries for (default 'spot') | +| params.productType | string | No | *swap only* 'umcbl' or 'dmcbl' - the product type of the market to fetch entries for (default 'umcbl') | +| params.marginCoin | string | No | *swap only* the margin coin of the market to fetch entries for | +| params.isPlan | string | No | *swap trigger only* 'plan' or 'profit_loss' ('plan' (default) for trigger (plan) orders, 'profit_loss' for stop-loss and take-profit orders) | + + +```javascript +coincatch.fetchOpenOrders ([symbol, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple canceled and closed orders made by the user + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-order-list +- https://coincatch.github.io/github.io/en/spot/#get-history-plan-orders +- https://coincatch.github.io/github.io/en/mix/#get-history-orders +- https://coincatch.github.io/github.io/en/mix/#get-producttype-history-orders +- https://coincatch.github.io/github.io/en/mix/#get-history-plan-orders-tpsl + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | *is mandatory* unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.trigger | boolean | No | true if fetching trigger orders (default false) | +| params.isPlan | string | No | *swap only* 'plan' or 'profit_loss' ('plan' (default) for trigger (plan) orders, 'profit_loss' for stop-loss and take-profit orders) | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entries for (default 'spot') | +| params.productType | string | No | *swap only* 'umcbl' or 'dmcbl' - the product type of the market to fetch entries for (default 'umcbl') | + + +```javascript +coincatch.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#cancel-order-v2 +- https://coincatch.github.io/github.io/en/spot/#cancel-plan-order +- https://coincatch.github.io/github.io/en/mix/#cancel-order +- https://coincatch.github.io/github.io/en/mix/#cancel-plan-order-tpsl + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the order that can be used as an alternative for the id | +| params.trigger | bool | No | true for canceling a trigger order (default false) | +| params.stop | bool | No | *swap only* an alternative for trigger param | +| params.planType | string | No | *swap trigger only* the type of the plan order to cancel: 'profit_plan' - profit order, 'loss_plan' - loss order, 'normal_plan' - plan order, 'pos_profit' - position profit, 'pos_loss' - position loss, 'moving_plan' - Trailing TP/SL, 'track_plan' - Trailing Stop | + + +```javascript +coincatch.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancels all open orders + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - response from the exchange + +**See** + +- https://coincatch.github.io/github.io/en/spot/#cancel-all-orders +- https://coincatch.github.io/github.io/en/spot/#batch-cancel-plan-orders +- https://coincatch.github.io/github.io/en/mix/#batch-cancel-order +- https://coincatch.github.io/github.io/en/mix/#cancel-order-by-symbol +- https://coincatch.github.io/github.io/en/mix/#cancel-plan-order-tpsl-by-symbol +- https://coincatch.github.io/github.io/en/mix/#cancel-all-trigger-order-tpsl + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified symbol of the market the orders were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to cancel orders for (default 'spot') | +| params.trigger | bool | No | true for canceling a trigger orders (default false) | +| params.productType | string | No | *swap only (if symbol is not provided* 'umcbl' or 'dmcbl' - the product type of the market to cancel orders for (default 'umcbl') | +| params.marginCoin | string | No | *mandatory for swap non-trigger dmcb (if symbol is not provided)* the margin coin of the market to cancel orders for | +| params.planType | string | No | *swap trigger only* the type of the plan order to cancel: 'profit_plan' - profit order, 'loss_plan' - loss order, 'normal_plan' - plan order, 'pos_profit' - position profit, 'pos_loss' - position loss, 'moving_plan' - Trailing TP/SL, 'track_plan' - Trailing Stop | + + +```javascript +coincatch.cancelAllOrders ([symbol, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple non-trigger orders + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#cancel-order-in-batch-v2-single-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | *is mandatory* unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | client order ids | + + +```javascript +coincatch.cancelOrders (ids, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<Trade> - a list of [trade structures](https://github.com/ccxt/ccxt/wiki/Manual#trade-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-transaction-details +- https://coincatch.github.io/github.io/en/mix/#get-order-fill-detail +- https://coincatch.github.io/github.io/en/mix/#get-producttype-order-fill-detail + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | *is mandatory* unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | *swap markets only* the latest time in ms to fetch trades for, only supports the last 30 days timeframe | +| params.lastEndId | string | No | *swap markets only* query the data after this tradeId | + + +```javascript +coincatch.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#get-transaction-details + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of the trading pair + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#get-single-account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the margin mode for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchMarginMode (symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - response from the exchange + +**See**: https://coincatch.github.io/github.io/en/mix/#change-margin-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See**: https://coincatch.github.io/github.io/en/mix/#get-single-account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch entry for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchPositionMode (symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - response from the exchange + +**See**: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Set%20Position%20Mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | unified symbol of the market to fetch entry for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | 'umcbl' or 'dmcbl' (default 'umcbl' if symbol is not provided) | + + +```javascript +coincatch.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#get-single-account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - response from the exchange + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/change-futures-leverage-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | *for isolated margin mode with hedged position mode only* 'long' or 'short' | + + +```javascript +coincatch.setLeverage (leverage, symbol[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#change-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | *for isolated margin mode with hedged position mode only* 'long' or 'short' | + + +```javascript +coincatch.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#change-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | *for isolated margin mode with hedged position mode only* 'long' or 'short' | + + +```javascript +coincatch.addMargin (symbol, amount[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#get-symbol-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | 'long' or 'short' *for non-hedged position mode only* (default 'long') | + + +```javascript +coincatch.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositionsForSymbol{docsify-ignore} +fetch all open positions for specific symbol + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#get-symbol-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.fetchPositionsForSymbol (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#get-all-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols (all symbols must belong to the same product type) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.productType | string | No | 'umcbl' or 'dmcbl' (default 'umcbl' if symbols are not provided) | +| params.marginCoin | string | No | the settle currency of the positions, needs to match the productType | + + +```javascript +coincatch.fetchPositions ([symbols, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered balance of the user + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#get-bills +- https://coincatch.github.io/github.io/en/mix/#get-business-account-bill + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entrys to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | *swap only* the latest time in ms to fetch entries for | +| params.type | string | No | 'spot' or 'swap' (default 'spot') | +| params.after | string | No | *spot only* billId, return the data less than this billId | +| params.before | string | No | *spot only* billId, return the data greater than or equals to this billId | +| params.groupType | string | No | *spot only* | +| params.bizType | string | No | *spot only* | +| params.productType | string | No | *swap only* 'umcbl' or 'dmcbl' (default 'umcbl' or 'dmcbl' if code is provided and code is not equal to 'USDT') | +| params.business | string | No | *swap only* | +| params.lastEndId | string | No | *swap only* | +| params.next | bool | No | *swap only* | + + +```javascript +coincatch.fetchLedger ([code, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | the type of the instrument to fetch the ticker for, 'SP' for spot markets, 'MC' for futures markets (default is 'SP') | + + +```javascript +coincatch.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unsubscribe from the ticker channel + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: any - status of the unwatch request + +**See**: https://coincatch.github.io/github.io/en/mix/#tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to watch the tickers for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.watchTickers (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://coincatch.github.io/github.io/en/spot/#candlesticks-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch (not including) | +| limit | int | No | the maximum amount of candles to fetch (not including) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.instType | bool | No | the type of the instrument to fetch the OHLCV data for, 'SP' for spot markets, 'MC' for futures markets (default is 'SP') | + + +```javascript +coincatch.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unsubscribe from the ohlcv channel + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the ohlcv for | +| timeframe | | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://coincatch.github.io/github.io/en/spot/#depth-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unsubscribe from the orderbook channel + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://coincatch.github.io/github.io/en/spot/#depth-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | orderbook limit, default is undefined | + + +```javascript +coincatch.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://coincatch.github.io/github.io/en/spot/#depth-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | | Yes | | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://coincatch.github.io/github.io/en/spot/#trades-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://coincatch.github.io/github.io/en/spot/#trades-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | | Yes | | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unsubscribe from the trades channel + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: any - status of the unwatch request + +**See**: https://coincatch.github.io/github.io/en/spot/#trades-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.unWatchTrades (symbol[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#account-channel +- https://coincatch.github.io/github.io/en/mix/#account-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | str | No | 'spot' or 'swap' (default is 'spot') | +| params.instType | string | No | *swap only* 'umcbl' or 'dmcbl' (default is 'umcbl') | + + +```javascript +coincatch.watchBalance ([params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coincatch.github.io/github.io/en/spot/#order-channel +- https://coincatch.github.io/github.io/en/mix/#order-channel +- https://coincatch.github.io/github.io/en/mix/#plan-order-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' | +| params.instType | string | No | *swap only* 'umcbl' or 'dmcbl' (default is 'umcbl') | +| params.trigger | bool | No | *swap only* whether to watch trigger orders (default is false) | + + +```javascript +coincatch.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [coincatch](#coincatch) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://coincatch.github.io/github.io/en/mix/#positions-channel + +| Param | Type | Description | +| --- | --- | --- | +| symbols | Array<string>, undefined | list of unified market symbols | +| since | | | +| limit | | | +| params | object | extra parameters specific to the exchange API endpoint | + + +```javascript +coincatch.watchPositions (symbols, since, limit, params[]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coincheck.md b/docs/ccxt/wiki/exchanges/coincheck.md new file mode 100644 index 0000000..f1ebf21 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coincheck.md @@ -0,0 +1,310 @@ + + + +## coincheck{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchBalance](#fetchbalance) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [watchOrderBook](#watchorderbook) +* [watchTrades](#watchtrades) + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://coincheck.com/documents/exchange/api#order-transactions-pagination + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchBalance ([params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coincheck.com/documents/exchange/api#order-opens + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://coincheck.com/documents/exchange/api#order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://coincheck.com/documents/exchange/api#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchTicker (symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://coincheck.com/documents/exchange/api#order-transactions-pagination + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://coincheck.com/documents/exchange/api#public-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://coincheck.com/documents/exchange/api#account-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchTradingFees ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coincheck.com/documents/exchange/api#order-new + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coincheck.com/documents/exchange/api#order-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by coincheck cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coincheck.com/documents/exchange/api#account-deposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coincheck.com/documents/exchange/api#withdraws + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://coincheck.com/documents/exchange/api#websocket-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [coincheck](#coincheck) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://coincheck.com/documents/exchange/api#websocket-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coincheck.watchTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinex.md b/docs/ccxt/wiki/exchanges/coinex.md new file mode 100644 index 0000000..a356c90 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinex.md @@ -0,0 +1,1631 @@ + + + +## coinex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTime](#fetchtime) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [cancelOrders](#cancelorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrdersByStatus](#fetchordersbystatus) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchMyTrades](#fetchmytrades) +* [fetchPositions](#fetchpositions) +* [fetchPosition](#fetchposition) +* [setMarginMode](#setmarginmode) +* [setLeverage](#setleverage) +* [fetchLeverageTiers](#fetchleveragetiers) +* [addMargin](#addmargin) +* [reduceMargin](#reducemargin) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRates](#fetchfundingrates) +* [withdraw](#withdraw) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchIsolatedBorrowRate](#fetchisolatedborrowrate) +* [fetchBorrowInterest](#fetchborrowinterest) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [repayIsolatedMargin](#repayisolatedmargin) +* [fetchDepositWithdrawFee](#fetchdepositwithdrawfee) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchLeverage](#fetchleverage) +* [fetchPositionHistory](#fetchpositionhistory) +* [closePosition](#closeposition) +* [fetchMarginAdjustmentHistory](#fetchmarginadjustmenthistory) +* [watchBalance](#watchbalance) +* [watchMyTrades](#watchmytrades) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchOrders](#watchorders) +* [watchBidsAsks](#watchbidsasks) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinex + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market +- https://docs.coinex.com/api/v2/futures/market/http/list-market + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker +- https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker +- https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [coinex](#coinex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.coinex.com/api/v2/common/http/time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchTime ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market-depth +- https://docs.coinex.com/api/v2/futures/market/http/list-market-depth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of the most recent trades for a particular symbol + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market-deals +- https://docs.coinex.com/api/v2/futures/market/http/list-market-deals + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market +- https://docs.coinex.com/api/v2/futures/market/http/list-market + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market +- https://docs.coinex.com/api/v2/futures/market/http/list-market + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://docs.coinex.com/api/v2/spot/market/http/list-market-kline +- https://docs.coinex.com/api/v2/futures/market/http/list-market-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.coinex.com/api/v2/assets/balance/http/get-spot-balance // spot +- https://docs.coinex.com/api/v2/assets/balance/http/get-futures-balance // swap +- https://docs.coinex.com/api/v2/assets/balance/http/get-marigin-balance // margin +- https://docs.coinex.com/api/v2/assets/balance/http/get-financial-balance // financial + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'margin', 'swap', 'financial', or 'spot' | + + +```javascript +coinex.fetchBalance ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade003_market_order +- https://docs.coinex.com/api/v2/spot/order/http/put-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/put-order +- https://docs.coinex.com/api/v2/spot/order/http/put-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/put-order +- https://docs.coinex.com/api/v2/futures/order/http/put-stop-order +- https://docs.coinex.com/api/v2/futures/position/http/close-position +- https://docs.coinex.com/api/v2/futures/position/http/set-position-stop-loss +- https://docs.coinex.com/api/v2/futures/position/http/set-position-take-profit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | price to trigger stop orders | +| params.stopLossPrice | float | No | price to trigger stop loss orders | +| params.takeProfitPrice | float | No | price to trigger take profit orders | +| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK', 'PO' | +| params.postOnly | boolean | No | set to true if you wish to make a post only order | +| params.reduceOnly | boolean | No | *contract only* indicates if this order is to reduce the size of a position | + + +```javascript +coinex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders (all orders should be of the same symbol) + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/put-multi-order +- https://docs.coinex.com/api/v2/spot/order/http/put-multi-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/put-multi-order +- https://docs.coinex.com/api/v2/futures/order/http/put-multi-stop-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the api endpoint | + + +```javascript +coinex.createOrders (orders[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/cancel-batch-order +- https://docs.coinex.com/api/v2/spot/order/http/cancel-batch-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/cancel-batch-order +- https://docs.coinex.com/api/v2/futures/order/http/cancel-batch-stop-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for canceling stop orders | + + +```javascript +coinex.cancelOrders (ids, symbol[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/edit-order +- https://docs.coinex.com/api/v2/spot/order/http/edit-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/edit-order +- https://docs.coinex.com/api/v2/futures/order/http/edit-stop-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price to trigger stop orders | + + +```javascript +coinex.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/cancel-order +- https://docs.coinex.com/api/v2/spot/order/http/cancel-stop-order +- https://docs.coinex.com/api/v2/spot/order/http/cancel-order-by-client-id +- https://docs.coinex.com/api/v2/spot/order/http/cancel-stop-order-by-client-id +- https://docs.coinex.com/api/v2/futures/order/http/cancel-order +- https://docs.coinex.com/api/v2/futures/order/http/cancel-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/cancel-order-by-client-id +- https://docs.coinex.com/api/v2/futures/order/http/cancel-stop-order-by-client-id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | client order id, defaults to id if not passed | +| params.trigger | boolean | No | set to true for canceling a trigger order | + + +```javascript +coinex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/cancel-all-order +- https://docs.coinex.com/api/v2/futures/order/http/cancel-all-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' for canceling spot margin orders | + + +```javascript +coinex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/get-order-status +- https://docs.coinex.com/api/v2/futures/order/http/get-order-status + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrdersByStatus{docsify-ignore} +fetch a list of orders + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/list-finished-order +- https://docs.coinex.com/api/v2/spot/order/http/list-finished-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/list-finished-order +- https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| status | string | Yes | order status to fetch for | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.marginMode | string | No | 'cross' or 'isolated' for fetching spot margin orders | + + +```javascript +coinex.fetchOrdersByStatus (status, symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/list-pending-order +- https://docs.coinex.com/api/v2/spot/order/http/list-pending-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/list-pending-order +- https://docs.coinex.com/api/v2/futures/order/http/list-pending-stop-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.marginMode | string | No | 'cross' or 'isolated' for fetching spot margin orders | + + +```javascript +coinex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/http/list-finished-order +- https://docs.coinex.com/api/v2/spot/order/http/list-finished-stop-order +- https://docs.coinex.com/api/v2/futures/order/http/list-finished-order +- https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set to true for fetching trigger orders | +| params.marginMode | string | No | 'cross' or 'isolated' for fetching spot margin orders | + + +```javascript +coinex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/update-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the blockchain network to create a deposit address on | + + +```javascript +coinex.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the blockchain network to create a deposit address on | + + +```javascript +coinex.fetchDepositAddress (code[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/deal/http/list-user-deals +- https://docs.coinex.com/api/v2/futures/deal/http/list-user-deals + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trades | +| params.side | string | No | the side of the trades, either 'buy' or 'sell', required for swap | + + +```javascript +coinex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://docs.coinex.com/api/v2/futures/position/http/list-pending-position +- https://docs.coinex.com/api/v2/futures/position/http/list-finished-position + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | the method to use 'v2PrivateGetFuturesPendingPosition' or 'v2PrivateGetFuturesFinishedPosition' default is 'v2PrivateGetFuturesPendingPosition' | + + +```javascript +coinex.fetchPositions ([symbols, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.coinex.com/api/v2/futures/position/http/list-pending-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchPosition (symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - response from the exchange + +**See**: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.leverage | int | Yes | the rate of leverage | + + +```javascript +coinex.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - response from the exchange + +**See**: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' (default is 'cross') | + + +```javascript +coinex.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See**: https://docs.coinex.com/api/v2/futures/market/http/list-market-position-level + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchLeverageTiers (symbols[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.addMargin (symbol, amount[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.reduceMargin (symbol, amount[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding fee payments paid and received on this account + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://docs.coinex.com/api/v2/futures/position/http/list-position-funding-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rates for multiple markets + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - an array of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchFundingRates (symbols[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | No | memo | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | unified network code | + + +```javascript +coinex.withdraw (code, amount, address[, tag, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | timestamp in ms of the latest funding rate | + + +```javascript +coinex.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.coinex.com/api/v2/assets/transfer/http/transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | unified ccxt symbol, required when either the fromAccount or toAccount is margin | + + +```javascript +coinex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.coinex.com/api/v2/assets/transfer/http/list-transfer-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfer structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' for fetching transfers to and from your margin account | + + +```javascript +coinex.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-withdrawal-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawal structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposit structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchDeposits ([code, since, limit, params]) +``` + + + + +### fetchIsolatedBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [isolated borrow rate structure](https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure) + +**See**: https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-interest-limit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the borrow rate for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.code | string | Yes | unified currency code | + + +```javascript +coinex.fetchIsolatedBorrowRate (symbol[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See**: https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-borrow-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| symbol | string | No | unified market symbol when fetch interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchBorrowInterest ([code, symbol, since, limit, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.coinex.com/api/v2/assets/loan-flat/http/margin-borrow + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for coinex | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.isAutoRenew | boolean | No | whether to renew the margin loan automatically or not, default is false | + + +```javascript +coinex.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### repayIsolatedMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.coinex.com/api/v2/assets/loan-flat/http/margin-repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for coinex | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.borrow_id | string | No | extra parameter that is not required | + + +```javascript +coinex.repayIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### fetchDepositWithdrawFee{docsify-ignore} +fetch the fee for deposits and withdrawals + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/get-deposit-withdrawal-config + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchDepositWithdrawFee (code[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch the fees for deposits and withdrawals + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://docs.coinex.com/api/v2/assets/loan-flat/http/list-margin-interest-limit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.code | string | Yes | unified currency code | + + +```javascript +coinex.fetchLeverage (symbol[, params]) +``` + + + + +### fetchPositionHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.coinex.com/api/v2/futures/position/http/list-finished-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified contract symbol | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum amount of records to fetch, default is 10 | +| params | object | No | extra parameters specific to the exchange api endpoint | +| params.until | int | No | the latest time in ms to fetch positions for | + + +```javascript +coinex.fetchPositionHistory (symbol[, since, limit, params]) +``` + + + + +### closePosition{docsify-ignore} +closes an open position for a market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.coinex.com/api/v2/futures/position/http/close-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| side | string | No | buy or sell, not used by coinex | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | Yes | required by coinex, one of: limit, market, maker_only, ioc or fok, default is *market* | +| params.price | string | No | the price to fulfill the order, ignored in market orders | +| params.amount | string | No | the amount to trade in units of the base currency | +| params.clientOrderId | string | No | the client id of the order | + + +```javascript +coinex.closePosition (symbol[, side, params]) +``` + + + + +### fetchMarginAdjustmentHistory{docsify-ignore} +fetches the history of margin added or reduced from contract isolated positions + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [margin structures](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.coinex.com/api/v2/futures/position/http/list-position-margin-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| type | string | No | not used by coinex fetchMarginAdjustmentHistory | +| since | int | No | timestamp in ms of the earliest change to fetch | +| limit | int | No | the maximum amount of changes to fetch, default is 10 | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | timestamp in ms of the latest change to fetch | +| params.positionId | int | No | the id of the position that you want to retrieve margin adjustment history for | + + +```javascript +coinex.fetchMarginAdjustmentHistory (symbol[, type, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.coinex.com/api/v2/assets/balance/ws/spot_balance +- https://docs.coinex.com/api/v2/assets/balance/ws/futures_balance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchBalance ([params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/deal/ws/user-deals +- https://docs.coinex.com/api/v2/futures/deal/ws/user-deals + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified symbol of the market the trades were made in | +| since | int | No | the earliest time in ms to watch trades | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchMyTrades ([symbol, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/ws/market +- https://docs.coinex.com/api/v2/futures/market/ws/market-state + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/ws/market +- https://docs.coinex.com/api/v2/futures/market/ws/market-state + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchTickers (symbols[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/ws/market-deals +- https://docs.coinex.com/api/v2/futures/market/ws/market-deals + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +watch the most recent trades for a list of symbols + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/ws/market-deals +- https://docs.coinex.com/api/v2/futures/market/ws/market-deals + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbols of the markets to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.coinex.com/api/v2/spot/market/ws/market-depth +- https://docs.coinex.com/api/v2/futures/market/ws/market-depth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.coinex.com/api/v2/spot/market/ws/market-depth +- https://docs.coinex.com/api/v2/futures/market/ws/market-depth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [coinex](#coinex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/order/ws/user-order +- https://docs.coinex.com/api/v2/futures/order/ws/user-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | if the orders to watch are trigger orders or not | + + +```javascript +coinex.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [coinex](#coinex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.coinex.com/api/v2/spot/market/ws/market-bbo +- https://docs.coinex.com/api/v2/futures/market/ws/market-bbo + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinex.watchBidsAsks ([symbols, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinmate.md b/docs/ccxt/wiki/exchanges/coinmate.md new file mode 100644 index 0000000..9a582db --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinmate.md @@ -0,0 +1,373 @@ + + + +## coinmate{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [withdraw](#withdraw) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrders](#fetchorders) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [cancelOrder](#cancelorder) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinmate + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://coinmate.docs.apiary.io/#reference/trading-pairs/get-trading-pairs/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/balance/get-balances/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://coinmate.docs.apiary.io/#reference/order-book/get-order-book/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/ticker/get-ticker/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/ticker/get-ticker-all/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchTickers (symbols[, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/transfers/get-transfer-history/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://coinmate.docs.apiary.io/#reference/bitcoin-withdrawal-and-deposit/withdraw-bitcoins/post +- https://coinmate.docs.apiary.io/#reference/litecoin-withdrawal-and-deposit/withdraw-litecoins/post +- https://coinmate.docs.apiary.io/#reference/ethereum-withdrawal-and-deposit/withdraw-ethereum/post +- https://coinmate.docs.apiary.io/#reference/ripple-withdrawal-and-deposit/withdraw-ripple/post +- https://coinmate.docs.apiary.io/#reference/cardano-withdrawal-and-deposit/withdraw-cardano/post +- https://coinmate.docs.apiary.io/#reference/solana-withdrawal-and-deposit/withdraw-solana/post + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/trade-history/get-trade-history/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://coinmate.docs.apiary.io/#reference/transactions/transactions/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/trader-fees/get-trading-fees/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/order/get-open-orders/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/order/order-history/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coinmate.docs.apiary.io/#reference/order/buy-limit-order/post +- https://coinmate.docs.apiary.io/#reference/order/sell-limit-order/post +- https://coinmate.docs.apiary.io/#reference/order/buy-instant-order/post +- https://coinmate.docs.apiary.io/#reference/order/sell-instant-order/post + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://coinmate.docs.apiary.io/#reference/order/get-order-by-orderid/post +- https://coinmate.docs.apiary.io/#reference/order/get-order-by-clientorderid/post + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.fetchOrder (id, symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinmate](#coinmate) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coinmate.docs.apiary.io/#reference/order/cancel-order/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by coinmate cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmate.cancelOrder (id, symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinmetro.md b/docs/ccxt/wiki/exchanges/coinmetro.md new file mode 100644 index 0000000..04a5472 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinmetro.md @@ -0,0 +1,418 @@ + + + +## coinmetro{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchBalance](#fetchbalance) +* [fetchLedger](#fetchledger) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [closePosition](#closeposition) +* [fetchOpenOrders](#fetchopenorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [fetchOrder](#fetchorder) +* [borrowCrossMargin](#borrowcrossmargin) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - an associative dictionary of currencies + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#d5876d43-a3fe-4479-8c58-24d0f044edfb + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinmetro + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#9fd18008-338e-4863-b07d-722878a46832 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchMarkets ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#13cfb5bc-7bfb-4847-85e1-e0f35dfb3573 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +coinmetro.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#6ee5d698-06da-4570-8c84-914185e05065 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#4d48ae69-8ee2-44d1-a268-71f84e557b7b + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve (default 500, max 1000) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#26ad80d7-8c46-41b5-9208-386f439a8b87 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return (default 100, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#6ecd1cd1-f162-45a3-8b3b-de690332a485 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchTickers ([symbols, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#6ecd1cd1-f162-45a3-8b3b-de690332a485 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchBidsAsks ([symbols, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#741a1dcc-7307-40d0-acca-28d003d1506a + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchBalance ([params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#4e7831f7-a0e7-4c3e-9336-1d0e5dcb15cf + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +coinmetro.fetchLedger ([code, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#a4895a1d-3f50-40ae-8231-6962ef06c771 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | the quote quantity that can be used as an alternative for the amount in market orders | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", "GTD" | +| params.expirationTime | number | No | timestamp in millisecond, for GTD orders only | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | +| params.stopLossPrice | float | No | *margin only* The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | *margin only* The price at which a take profit order is triggered at | +| params.margin | bool | No | true for creating a margin order | +| params.fillStyle | string | No | fill style of the limit order: "sell" fulfills selling quantity "buy" fulfills buying quantity "base" fulfills base currency quantity "quote" fulfills quote currency quantity | +| params.clientOrderId | string | No | client's comment | + + +```javascript +coinmetro.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://documenter.getpostman.com/view/3653795/SVfWN6KS#eaea86da-16ca-4c56-9f00-5b1cb2ad89f8 +- https://documenter.getpostman.com/view/3653795/SVfWN6KS#47f913fb-8cab-49f4-bc78-d980e6ced316 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by coinmetro cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.margin | string | No | true for cancelling a margin order | + + +```javascript +coinmetro.cancelOrder (id, symbol[, params]) +``` + + + + +### closePosition{docsify-ignore} +closes an open position + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#47f913fb-8cab-49f4-bc78-d980e6ced316 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | not used by coinmetro closePosition () | +| side | string | No | not used by coinmetro closePosition () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.orderID | string | No | order id | +| params.fraction | number | No | fraction of order to close, between 0 and 1 (defaults to 1) | + + +```javascript +coinmetro.closePosition (symbol[, side, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#518afd7a-4338-439c-a651-d4fdaa964138 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple canceled and closed orders made by the user + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#4d48ae69-8ee2-44d1-a268-71f84e557b7b + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#95bbed87-db1c-47a7-a03e-aa247e91d5a6 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | int, string | Yes | order id | +| symbol | string | Yes | not used by coinmetro fetchOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.fetchOrder (id, symbol[, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [coinmetro](#coinmetro) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://documenter.getpostman.com/view/3653795/SVfWN6KS#5b90b3b9-e5db-4d07-ac9d-d680a06fd110 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinmetro.borrowCrossMargin (code, amount[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinone.md b/docs/ccxt/wiki/exchanges/coinone.md new file mode 100644 index 0000000..7189ea6 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinone.md @@ -0,0 +1,375 @@ + + + +## coinone{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [cancelOrder](#cancelorder) +* [fetchDepositAddresses](#fetchdepositaddresses) +* [watchOrderBook](#watchorderbook) +* [watchTicker](#watchticker) +* [watchTrades](#watchtrades) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.coinone.co.kr/reference/currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinone + +**Kind**: instance method of [coinone](#coinone) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.coinone.co.kr/v1.0/reference/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.coinone.co.kr/v1.0/reference/v21 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.coinone.co.kr/v1.0/reference/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.coinone.co.kr/v1.0/reference/tickers +- https://docs.coinone.co.kr/v1.0/reference/ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.coinone.co.kr/v1.0/reference/ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinone](#coinone) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.coinone.co.kr/v1.0/reference/recent-completed-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://doc.coinone.co.kr/#tag/Order-V2/operation/v2_order_limit_buy +- https://doc.coinone.co.kr/#tag/Order-V2/operation/v2_order_limit_sell + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | must be 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coinone](#coinone) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinone](#coinone) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchDepositAddresses{docsify-ignore} +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.fetchDepositAddresses (codes[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.coinone.co.kr/reference/public-websocket-orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinone](#coinone) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.coinone.co.kr/reference/public-websocket-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.watchTicker (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [coinone](#coinone) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.coinone.co.kr/reference/public-websocket-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinone.watchTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinsph.md b/docs/ccxt/wiki/exchanges/coinsph.md new file mode 100644 index 0000000..37bb68c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinsph.md @@ -0,0 +1,571 @@ + + + +## coinsph{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderTrades](#fetchordertrades) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [withdraw](#withdraw) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositAddress](#fetchdepositaddress) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.coins.ph/rest-api/#all-coins-information-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchCurrencies ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://coins-docs.github.io/rest-api/#test-connectivity + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://coins-docs.github.io/rest-api/#check-server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for coinsph + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://coins-docs.github.io/rest-api/#exchange-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchMarkets ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://coins-docs.github.io/rest-api/#24hr-ticker-price-change-statistics +- https://coins-docs.github.io/rest-api/#symbol-price-ticker +- https://coins-docs.github.io/rest-api/#symbol-order-book-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://coins-docs.github.io/rest-api/#24hr-ticker-price-change-statistics +- https://coins-docs.github.io/rest-api/#symbol-price-ticker +- https://coins-docs.github.io/rest-api/#symbol-order-book-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://coins-docs.github.io/rest-api/#order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return (default 100, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://coins-docs.github.io/rest-api/#klinecandlestick-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch (default 500, max 1000) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +coinsph.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://coins-docs.github.io/rest-api/#recent-trades-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch (default 500, max 1000) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://coins-docs.github.io/rest-api/#account-trade-list-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve (default 500, max 1000) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://coins-docs.github.io/rest-api/#account-trade-list-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://coins-docs.github.io/rest-api/#accept-the-quote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coins-docs.github.io/rest-api/#new-order--trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit', 'stop_loss', 'take_profit', 'stop_loss_limit', 'take_profit_limit' or 'limit_maker' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | the quote quantity that can be used as an alternative for the amount for market buy orders | +| params.test | bool | No | set to true to test an order, no order will be created but the request will be validated | + + +```javascript +coinsph.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coins-docs.github.io/rest-api/#query-order-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | int, string | Yes | order id | +| symbol | string | Yes | not used by coinsph fetchOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coins-docs.github.io/rest-api/#current-open-orders-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coins-docs.github.io/rest-api/#history-orders-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve (default 500, max 1000) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coins-docs.github.io/rest-api/#cancel-order-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by coinsph cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel open orders of market + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://coins-docs.github.io/rest-api/#cancel-all-open-orders-on-a-symbol-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://coins-docs.github.io/rest-api/#trade-fee-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://coins-docs.github.io/rest-api/#trade-fee-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchTradingFees ([params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal to coins_ph account + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coins-docs.github.io/rest-api/#withdrawuser_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | not used by coinsph withdraw () | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coins-docs.github.io/rest-api/#deposit-history-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://coins-docs.github.io/rest-api/#withdraw-history-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinsph.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [coinsph](#coinsph) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://coins-docs.github.io/rest-api/#deposit-address-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | network for fetch deposit address | + + +```javascript +coinsph.fetchDepositAddress (code[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/coinspot.md b/docs/ccxt/wiki/exchanges/coinspot.md new file mode 100644 index 0000000..08bee6b --- /dev/null +++ b/docs/ccxt/wiki/exchanges/coinspot.md @@ -0,0 +1,196 @@ + + + +## coinspot{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.coinspot.com.au/api#listmybalance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.coinspot.com.au/api#listopenorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.coinspot.com.au/api#latestprices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.coinspot.com.au/api#latestprices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.coinspot.com.au/api#orderhistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.coinspot.com.au/api#rotransaction + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.coinspot.com.au/api#placebuyorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | must be 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [coinspot](#coinspot) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.coinspot.com.au/api#cancelbuyorder +- https://www.coinspot.com.au/api#cancelsellorder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by coinspot cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +coinspot.cancelOrder (id, symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/cryptocom.md b/docs/ccxt/wiki/exchanges/cryptocom.md new file mode 100644 index 0000000..c050e4e --- /dev/null +++ b/docs/ccxt/wiki/exchanges/cryptocom.md @@ -0,0 +1,1381 @@ + + + +## cryptocom{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOrders](#fetchorders) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrderBook](#fetchorderbook) +* [fetchBalance](#fetchbalance) +* [fetchOrder](#fetchorder) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelOrdersForSymbols](#cancelordersforsymbols) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [withdraw](#withdraw) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchLedger](#fetchledger) +* [fetchAccounts](#fetchaccounts) +* [fetchSettlementHistory](#fetchsettlementhistory) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [closePositions](#closepositions) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [unWatchOrderBookForSymbols](#unwatchorderbookforsymbols) +* [watchTrades](#watchtrades) +* [unWatchTrades](#unwatchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [watchMyTrades](#watchmytrades) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [unWatchTickers](#unwatchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOrders](#watchorders) +* [watchPositions](#watchpositions) +* [watchBalance](#watchbalance) +* [createOrderWs](#createorderws) +* [editOrderWs](#editorderws) +* [cancelOrderWs](#cancelorderws) +* [cancelAllOrdersWs](#cancelallordersws) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an associative dictionary of currencies + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for cryptocom + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchMarkets ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers +- https://exchange-docs.crypto.com/derivatives/index.html#public-get-tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for, max date range is one day | +| limit | int | No | the maximum number of order structures to retrieve, default 100 max 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +cryptocom.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get a list of the most recent trades for a particular symbol + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch, maximum date range is one day | +| limit | int | No | the maximum number of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +cryptocom.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-candlestick + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +cryptocom.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the number of order book entries to return, max 50 | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-user-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchBalance ([params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-order-detail + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchOrder (id, symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit', 'stop_loss', 'stop_limit', 'take_profit', 'take_profit_limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'PO' | +| params.ref_price_type | string | No | 'MARK_PRICE', 'INDEX_PRICE', 'LAST_PRICE' which trigger price type to use, default is MARK_PRICE | +| params.triggerPrice | float | No | price to trigger a trigger order | +| params.stopLossPrice | float | No | price to trigger a stop-loss trigger order | +| params.takeProfitPrice | float | No | price to trigger a take-profit trigger order | + + +```javascript +cryptocom.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-list +- https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-oco + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-amend-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol of the order to edit | +| type | string | No | not used by cryptocom editOrder | +| side | string | No | not used by cryptocom editOrder | +| amount | float | Yes | (mandatory) how much of the currency you want to trade in units of the base currency | +| price | float | Yes | (mandatory) the price for the order, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | the original client order id of the order to edit, required if id is not provided | + + +```javascript +cryptocom.editOrder (id, symbol[, type, side, amount, price, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - Returns exchange raw message[https://docs.ccxt.com/#/?id=order-structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the orders to cancel | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id of the order to cancel | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.cancelOrder (id[, symbol, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelOrdersForSymbols{docsify-ignore} +cancel multiple orders for multiple symbols + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array<CancellationRequest> | Yes | each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}] | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.cancelOrdersForSymbols (orders[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for, maximum date range is one day | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +cryptocom.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | + + +```javascript +cryptocom.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-withdrawal-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | + + +```javascript +cryptocom.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | + + +```javascript +cryptocom.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-accounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchAccounts ([params]) +``` + + + + +### fetchSettlementHistory{docsify-ignore} +fetches historical settlement records + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [settlement history objects](https://docs.ccxt.com/#/?id=settlement-history-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-expired-settlement-price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | +| params.type | int | No | 'future', 'option' | + + +```javascript +cryptocom.fetchSettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetches historical funding rates + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-valuations + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rates + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-valuations + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures] to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms for the ending date filter, default is the current time | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +cryptocom.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchPositions (symbols[, params]) +``` + + + + +### closePositions{docsify-ignore} +closes open positions for a market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - [A list of position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-close-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | No | not used by cryptocom.closePositions | +| params | object | No | extra parameters specific to the okx api endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.type | string | No | LIMIT or MARKET | +| params.price | number | No | for limit orders only | + + +```javascript +cryptocom.closePositions (symbol[, side, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-instrument-fee-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-fee-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.fetchTradingFees ([params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#book-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.bookSubscriptionType | string | No | The subscription type. Allowed values: SNAPSHOT full snapshot. This is the default if not specified. SNAPSHOT_AND_UPDATE delta updates | +| params.bookUpdateFrequency | int | No | Book update interval in ms. Allowed values: 100 for snapshot subscription 10 for delta subscription | + + +```javascript +cryptocom.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#book-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.bookSubscriptionType | string | No | The subscription type. Allowed values: SNAPSHOT full snapshot. This is the default if not specified. SNAPSHOT_AND_UPDATE delta updates | +| params.bookUpdateFrequency | int | No | Book update interval in ms. Allowed values: 100 for snapshot subscription 10 for delta subscription | + + +```javascript +cryptocom.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#book-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.bookSubscriptionType | string | No | The subscription type. Allowed values: SNAPSHOT full snapshot. This is the default if not specified. SNAPSHOT_AND_UPDATE delta updates | +| params.bookUpdateFrequency | int | No | Book update interval in ms. Allowed values: 100 for snapshot subscription 10 for delta subscription | + + +```javascript +cryptocom.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### unWatchOrderBookForSymbols{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#book-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | orderbook limit, default is 50 | +| params.bookSubscriptionType | string | No | The subscription type. Allowed values: SNAPSHOT full snapshot. This is the default if not specified. SNAPSHOT_AND_UPDATE delta updates | +| params.bookUpdateFrequency | int | No | Book update interval in ms. Allowed values: 100 for snapshot subscription 10 for delta subscription | + + +```javascript +cryptocom.unWatchOrderBookForSymbols (symbols[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#trade-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchTrades (symbol[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#trade-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.unWatchTrades (symbol[, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#trade-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#trade-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols to unwatch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.unWatchTradesForSymbols ([symbols, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-trade-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#ticker-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#ticker-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#ticker-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchTickers (symbols[, params]) +``` + + + + +### unWatchTickers{docsify-ignore} +unWatches a price ticker + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#ticker-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.unWatchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#ticker-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#candlestick-time_frame-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#candlestick-time_frame-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-order-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-position_balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols to watch positions for | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchPositions ([symbols, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.watchBalance ([params]) +``` + + + + +### createOrderWs{docsify-ignore} +create a trade order + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.createOrderWs (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-amend-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol of the order to edit | +| type | string | No | not used by cryptocom editOrder | +| side | string | No | not used by cryptocom editOrder | +| amount | float | Yes | (mandatory) how much of the currency you want to trade in units of the base currency | +| price | float | Yes | (mandatory) the price for the order, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | the original client order id of the order to edit, required if id is not provided | + + +```javascript +cryptocom.editOrderWs (id, symbol[, type, side, amount, price, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +cancels an open order + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id of the order to cancel | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.cancelOrderWs (id[, symbol, params]) +``` + + + + +### cancelAllOrdersWs{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [cryptocom](#cryptocom) +**Returns**: object - Returns exchange raw message [https://docs.ccxt.com/#/?id=order-structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the orders to cancel | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptocom.cancelAllOrdersWs (symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/cryptomus.md b/docs/ccxt/wiki/exchanges/cryptomus.md new file mode 100644 index 0000000..60eb6b7 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/cryptomus.md @@ -0,0 +1,274 @@ + + + +## cryptomus{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchTradingFees](#fetchtradingfees) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for the exchange + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://doc.cryptomus.com/personal/market-cap/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptomus.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: object - an associative dictionary of currencies + +**See**: https://doc.cryptomus.com/personal/market-cap/assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptomus.fetchCurrencies ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://doc.cryptomus.com/personal/market-cap/tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptomus.fetchTickers ([symbols, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://doc.cryptomus.com/personal/market-cap/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.level | int | No | 0 or 1 or 2 or 3 or 4 or 5 - the level of volume | + + +```javascript +cryptomus.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://doc.cryptomus.com/personal/market-cap/trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch (maximum value is 100) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptomus.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://doc.cryptomus.com/personal/converts/balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptomus.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://doc.cryptomus.com/personal/exchange/market-order-creation +- https://doc.cryptomus.com/personal/exchange/limit-order-creation + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' or for spot | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders (only for limit orders) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *market buy only* the quote quantity that can be used as an alternative for the amount | +| params.clientOrderId | string | No | a unique identifier for the order (optional) | + + +```javascript +cryptomus.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open limit order + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.cryptomus.com/personal/exchange/limit-order-cancellation + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in (not used in cryptomus) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptomus.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.cryptomus.com/personal/exchange/history-of-completed-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in (not used in cryptomus) | +| since | int | No | the earliest time in ms to fetch orders for (not used in cryptomus) | +| limit | int | No | the maximum number of order structures to retrieve (not used in cryptomus) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.direction | string | No | order direction 'buy' or 'sell' | +| params.order_id | string | No | order id | +| params.client_order_id | string | No | client order id | +| params.limit | string | No | A special parameter that sets the maximum number of records the request will return | +| params.offset | string | No | A special parameter that sets the number of records from the beginning of the list | + + +```javascript +cryptomus.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.cryptomus.com/personal/exchange/list-of-active-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for (not used in cryptomus) | +| limit | int | No | the maximum number of open orders structures to retrieve (not used in cryptomus) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.direction | string | No | order direction 'buy' or 'sell' | +| params.order_id | string | No | order id | +| params.client_order_id | string | No | client order id | +| params.limit | string | No | A special parameter that sets the maximum number of records the request will return | +| params.offset | string | No | A special parameter that sets the number of records from the beginning of the list | + + +```javascript +cryptomus.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [cryptomus](#cryptomus) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://trade-docs.coinlist.co/?javascript--nodejs#list-fees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +cryptomus.fetchTradingFees ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/defx.md b/docs/ccxt/wiki/exchanges/defx.md new file mode 100644 index 0000000..fb15ba6 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/defx.md @@ -0,0 +1,1100 @@ + + + +## defx{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderBook](#fetchorderbook) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchFundingRate](#fetchfundingrate) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [closePosition](#closeposition) +* [closeAllPositions](#closeallpositions) +* [fetchLedger](#fetchledger) +* [withdraw](#withdraw) +* [setLeverage](#setleverage) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [unWatchOHLCVForSymbols](#unwatchohlcvforsymbols) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [unWatchTickers](#unwatchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchTrades](#watchtrades) +* [unWatchTrades](#unwatchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [unWatchOrderBookForSymbols](#unwatchorderbookforsymbols) +* [watchBalance](#watchbalance) +* [watchOrders](#watchorders) +* [watchPositions](#watchpositions) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://api-docs.defx.com/#4b03bb3b-a0fa-4dfb-b96c-237bde0ce9e6 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [defx](#defx) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://api-docs.defx.com/#4b03bb3b-a0fa-4dfb-b96c-237bde0ce9e6 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for defx + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://api-docs.defx.com/#73cce0c8-f842-4891-9145-01bb6d61324d +- https://api-docs.defx.com/#24fd4e5b-840e-451e-99e0-7fea47c7f371 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-docs.defx.com/#fe6f81d0-2f3a-4eee-976f-c8fc8f4c5d56 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-docs.defx.com/#8c61cfbd-40d9-410e-b014-f5b36eba51d1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchTickers (symbols[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://api-docs.defx.com/#54b71951-1472-4670-b5af-4c2dc41e73d0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms))) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +defx.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api-docs.defx.com/#5865452f-ea32-4f13-bfbc-03af5f5574fd + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api-docs.defx.com/#06b5b33c-2fc6-48de-896c-fc316f5871a7 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [defx](#defx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api-docs.defx.com/#6c1a2971-8325-4e7d-9962-e0bfcaacf9c4 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.slab | string | No | slab from market.info.depthSlabs | + + +```javascript +defx.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches mark price for the market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-docs.defx.com/#12168192-4e7b-4458-a001-e8b80961f0b7 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +defx.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://api-docs.defx.com/#12168192-4e7b-4458-a001-e8b80961f0b7 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://api-docs.defx.com/#26414338-14f7-40a1-b246-f8ea8571493f + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [defx](#defx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#ba222d88-8856-4d3c-87a9-7cec07bb2622 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.reduceOnly | string | No | for swap and future reduceOnly is a string 'true' or 'false' that cant be sent with close position set to true or in hedge mode. For spot margin and option reduceOnly is a boolean. | + + +```javascript +defx.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [defx](#defx) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#09186f23-f8d1-4993-acf4-9974d8a6ddb0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#db5531da-3692-4a53-841f-6ad6495f823a + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://api-docs.defx.com/#d89dbb86-9aba-4f59-ac5d-a97ff25ea80e + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://api-docs.defx.com/#d89dbb86-9aba-4f59-ac5d-a97ff25ea80e + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchPositions ([symbols, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [defx](#defx) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#44f82dd5-26b3-4e1f-b4aa-88ceddd65237 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#ab200038-8acb-4170-b05e-4fcb4cc13751 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +defx.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#ab200038-8acb-4170-b05e-4fcb4cc13751 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +defx.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#ab200038-8acb-4170-b05e-4fcb4cc13751 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +defx.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#ab200038-8acb-4170-b05e-4fcb4cc13751 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | + + +```javascript +defx.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### closePosition{docsify-ignore} +closes an open position for a market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.defx.com/#b2c08074-c4d9-4e50-b637-0d6c498fa29e + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| side | string | No | one-way mode: 'buy' or 'sell', hedge-mode: 'long' or 'short' | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.positionId | string | No | the position id you want to close | +| params.type | string | No | 'MARKET' or 'LIMIT' | +| params.quantity | string | No | how much of currency you want to trade in units of base currency | +| params.price | string | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | + + +```javascript +defx.closePosition (symbol[, side, params]) +``` + + + + +### closeAllPositions{docsify-ignore} +closes all open positions for a market type + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - A list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://api-docs.defx.com/#d6f63b43-100e-47a9-998c-8b6c0c72d204 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.closeAllPositions ([params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://api-docs.defx.com/#38cc8974-794f-48c0-b959-db045a0ee565 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +defx.fetchLedger ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-docs.defx.com/#2600f503-63ed-4672-b8f6-69ea5f03203b + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.withdraw (code, amount, address, tag[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - response from the exchange + +**See**: https://api-docs.defx.com/#4cb4ecc4-6c61-4194-8353-be67faaf7ca7 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.setLeverage (leverage, symbol[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### unWatchOHLCVForSymbols{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.unWatchOHLCVForSymbols (symbolsAndTimeframes[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +defx.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchTickers ([symbols, params]) +``` + + + + +### unWatchTickers{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.unWatchTickers ([symbols, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchBidsAsks (symbols[, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchTrades (symbol[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unWatches from the stream channel + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.unWatchTrades (symbol[, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +unWatches from the stream channel + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.unWatchTradesForSymbols (symbols[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [defx](#defx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [defx](#defx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [defx](#defx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### unWatchOrderBookForSymbols{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [defx](#defx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.postman.com/defxcode/defx-public-apis/collection/667939a1b5d8069c13d614e9 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.unWatchOrderBookForSymbols (symbols[, params]) +``` + + + + +### watchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [defx](#defx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/ws-raw-request/667939b2f00f79161bb47809 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchBalance ([params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/ws-raw-request/667939b2f00f79161bb47809 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchOrders ([symbol, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [defx](#defx) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://www.postman.com/defxcode/defx-public-apis/ws-raw-request/667939b2f00f79161bb47809 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| since | number | No | since timestamp | +| limit | number | No | limit | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +defx.watchPositions (symbols[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/delta.md b/docs/ccxt/wiki/exchanges/delta.md new file mode 100644 index 0000000..37d01ac --- /dev/null +++ b/docs/ccxt/wiki/exchanges/delta.md @@ -0,0 +1,757 @@ + + + +## delta{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchStatus](#fetchstatus) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchLedger](#fetchledger) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [addMargin](#addmargin) +* [reduceMargin](#reducemargin) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [fetchSettlementHistory](#fetchsettlementhistory) +* [fetchGreeks](#fetchgreeks) +* [closeAllPositions](#closeallpositions) +* [fetchMarginMode](#fetchmarginmode) +* [fetchOption](#fetchoption) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [delta](#delta) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchTime ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchStatus ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [delta](#delta) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.delta.exchange/#get-list-of-all-assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for delta + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.delta.exchange/#get-list-of-products + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.delta.exchange/#get-tickers-for-products + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchTickers (symbols[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [delta](#delta) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.delta.exchange/#get-l2-orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.delta.exchange/#get-public-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.delta.exchange/#delta-exchange-api-v2-historical-ohlc-candles-sparklines + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | string | No | timestamp in ms of the latest candle to fetch | + + +```javascript +delta.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.delta.exchange/#get-wallet-balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchBalance ([params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.delta.exchange/#get-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.delta.exchange/#get-margined-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchPositions (symbols[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [delta](#delta) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.delta.exchange/#place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.reduceOnly | bool | No | *contract only* indicates if this order is to reduce the size of a position | + + +```javascript +delta.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [delta](#delta) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.delta.exchange/#edit-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [delta](#delta) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.delta.exchange/#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.delta.exchange/#cancel-all-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.delta.exchange/#get-active-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.delta.exchange/#get-order-history-cancelled-and-closed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.delta.exchange/#get-user-fills-by-filters + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://docs.delta.exchange/#get-wallet-transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [delta](#delta) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | unified network code | + + +```javascript +delta.fetchDepositAddress (code[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://docs.delta.exchange/#get-tickers-for-products + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchFundingRates (symbols[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://docs.delta.exchange/#add-remove-position-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.addMargin (symbol, amount[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://docs.delta.exchange/#add-remove-position-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.reduceMargin (symbol, amount[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a derivative market + +**Kind**: instance method of [delta](#delta) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +delta.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://docs.delta.exchange/#get-order-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [delta](#delta) +**Returns**: object - response from the exchange + +**See**: https://docs.delta.exchange/#change-order-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchSettlementHistory{docsify-ignore} +fetches historical settlement records + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<object> - a list of [settlement history objects](https://docs.ccxt.com/#/?id=settlement-history-structure) + +**See**: https://docs.delta.exchange/#get-product-settlement-prices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | + + +```javascript +delta.fetchSettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchGreeks{docsify-ignore} +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchGreeks (symbol[, params]) +``` + + + + +### closeAllPositions{docsify-ignore} +closes all open positions for a market type + +**Kind**: instance method of [delta](#delta) +**Returns**: Array<object> - A list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.delta.exchange/#close-all-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user_id | int | No | the users id | + + +```javascript +delta.closeAllPositions ([params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of a trading pair + +**Kind**: instance method of [delta](#delta) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://docs.delta.exchange/#get-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the margin mode for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchMarginMode (symbol[, params]) +``` + + + + +### fetchOption{docsify-ignore} +fetches option data that is commonly found in an option chain + +**Kind**: instance method of [delta](#delta) +**Returns**: object - an [option chain structure](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +delta.fetchOption (symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/deribit.md b/docs/ccxt/wiki/exchanges/deribit.md new file mode 100644 index 0000000..cc39355 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/deribit.md @@ -0,0 +1,1239 @@ + + + +## deribit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchStatus](#fetchstatus) +* [fetchAccounts](#fetchaccounts) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrder](#fetchorder) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchVolatilityHistory](#fetchvolatilityhistory) +* [fetchTransfers](#fetchtransfers) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchLiquidations](#fetchliquidations) +* [fetchMyLiquidations](#fetchmyliquidations) +* [fetchGreeks](#fetchgreeks) +* [fetchOption](#fetchoption) +* [fetchOptionChain](#fetchoptionchain) +* [watchBalance](#watchbalance) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchMyTrades](#watchmytrades) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchOrders](#watchorders) +* [watchOHLCV](#watchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [deribit](#deribit) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.deribit.com/#public-get_time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.deribit.com/#public-get_currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchCurrencies ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://docs.deribit.com/#public-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchStatus ([params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://docs.deribit.com/#private-get_subaccounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchAccounts ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for deribit + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://docs.deribit.com/#public-get_currencies +- https://docs.deribit.com/#public-get_instruments + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.deribit.com/#private-get_account_summary +- https://docs.deribit.com/#private-get_account_summaries + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.code | string | No | unified currency code of the currency for the balance, if defined 'privateGetGetAccountSummary' will be used, otherwise 'privateGetGetAccountSummaries' will be used | + + +```javascript +deribit.fetchBalance ([params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.deribit.com/#private-create_deposit_address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.deribit.com/#private-get_current_deposit_address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchDepositAddress (code[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.deribit.com/#public-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.deribit.com/#public-get_book_summary_by_currency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.code | string | No | *required* the currency code to fetch the tickers for, eg. 'BTC', 'ETH' | + + +```javascript +deribit.fetchTickers ([symbols, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.deribit.com/#public-get_tradingview_chart_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | whether to paginate the results, set to false by default | +| params.until | int | No | the latest time in ms to fetch ohlcv for | + + +```javascript +deribit.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol. + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.deribit.com/#public-get_last_trades_by_instrument +- https://docs.deribit.com/#public-get_last_trades_by_instrument_and_time + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | + + +```javascript +deribit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.deribit.com/#private-get_account_summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchTradingFees ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.deribit.com/#public-get_order_book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.deribit.com/#private-get_order_state + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchOrder (id, symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.deribit.com/#private-buy +- https://docs.deribit.com/#private-sell + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency. For perpetual and inverse futures the amount is in USD units. For options it is in the underlying assets base currency. | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | string | No | the trigger type 'index_price', 'mark_price', or 'last_price', default is 'last_price' | +| params.trailingAmount | float | No | the quote amount to trail away from the current market price | + + +```javascript +deribit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.deribit.com/#private-edit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | edit order id | +| symbol | string | No | unified symbol of the market to edit an order in | +| type | string | No | 'market' or 'limit' | +| side | string | No | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency. For perpetual and inverse futures the amount is in USD units. For options it is in the underlying assets base currency. | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trailingAmount | float | No | the quote amount to trail away from the current market price | + + +```javascript +deribit.editOrder (id[, symbol, type, side, amount, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.deribit.com/#private-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by deribit cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.deribit.com/#private-cancel_all +- https://docs.deribit.com/#private-cancel_all_by_instrument + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.deribit.com/#private-get_open_orders_by_currency +- https://docs.deribit.com/#private-get_open_orders_by_instrument + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.deribit.com/#private-get_order_history_by_currency +- https://docs.deribit.com/#private-get_order_history_by_instrument + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.deribit.com/#private-get_user_trades_by_order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.deribit.com/#private-get_user_trades_by_currency +- https://docs.deribit.com/#private-get_user_trades_by_currency_and_time +- https://docs.deribit.com/#private-get_user_trades_by_instrument +- https://docs.deribit.com/#private-get_user_trades_by_instrument_and_time + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.deribit.com/#private-get_deposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.deribit.com/#private-get_withdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.deribit.com/#private-get_position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.deribit.com/#private-get_positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.currency | string | No | currency code filter for positions | +| params.kind | string | No | market type filter for positions 'future', 'option', 'spot', 'future_combo' or 'option_combo' | +| params.subaccount_id | int | No | the user id for the subaccount | + + +```javascript +deribit.fetchPositions (symbols[, params]) +``` + + + + +### fetchVolatilityHistory{docsify-ignore} +fetch the historical volatility of an option market based on an underlying asset + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [volatility history objects](https://docs.ccxt.com/#/?id=volatility-structure) + +**See**: https://docs.deribit.com/#public-get_historical_volatility + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchVolatilityHistory (code[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.deribit.com/#private-get_transfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchTransfers (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://docs.deribit.com/#private-submit_transfer_to_user +- https://docs.deribit.com/#private-submit_transfer_to_subaccount + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.deribit.com/#private-withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.deribit.com/#public-get_currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.deribit.com/#public-get_funding_rate_value + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.start_timestamp | int | No | fetch funding rate starting from this timestamp | +| params.end_timestamp | int | No | fetch funding rate ending at this timestamp | + + +```javascript +deribit.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.deribit.com/#public-get_funding_rate_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding rate history for | +| limit | int | No | the maximum number of entries to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | fetch funding rate ending at this timestamp | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +deribit.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchLiquidations{docsify-ignore} +retrieves the public liquidations of a trading pair + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://docs.deribit.com/#public-get_last_settlements_by_currency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the deribit api endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +deribit.fetchLiquidations (symbol[, since, limit, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://docs.deribit.com/#private-get_settlement_history_by_instrument + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the deribit api endpoint | + + +```javascript +deribit.fetchMyLiquidations (symbol[, since, limit, params]) +``` + + + + +### fetchGreeks{docsify-ignore} +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://docs.deribit.com/#public-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchGreeks (symbol[, params]) +``` + + + + +### fetchOption{docsify-ignore} +fetches option data that is commonly found in an option chain + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - an [option chain structure](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://docs.deribit.com/#public-get_book_summary_by_instrument + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchOption (symbol[, params]) +``` + + + + +### fetchOptionChain{docsify-ignore} +fetches data for an underlying asset that is commonly found in an option chain + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a list of [option chain structures](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://docs.deribit.com/#public-get_book_summary_by_currency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | base currency to fetch an option chain for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.fetchOptionChain (code[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.deribit.com/#user-portfolio-currency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.watchBalance ([params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information for a specific market. + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.deribit.com/#ticker-instrument_name-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.interval | str | No | specify aggregation and frequency of notifications. Possible values: 100ms, raw | + + +```javascript +deribit.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.deribit.com/#ticker-instrument_name-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.interval | str | No | specify aggregation and frequency of notifications. Possible values: 100ms, raw | + + +```javascript +deribit.watchTickers ([symbols, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.deribit.com/#quote-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.watchBidsAsks ([symbols, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.deribit.com/#trades-instrument_name-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.interval | str | No | specify aggregation and frequency of notifications. Possible values: 100ms, raw | + + +```javascript +deribit.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.deribit.com/#trades-instrument_name-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +get the list of trades associated with the user + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.deribit.com/#user-trades-instrument_name-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for. Use 'any' to watch all trades | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.interval | str | No | specify aggregation and frequency of notifications. Possible values: 100ms, raw | + + +```javascript +deribit.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.deribit.com/#book-instrument_name-group-depth-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.interval | string | No | Frequency of notifications. Events will be aggregated over this interval. Possible values: 100ms, raw | + + +```javascript +deribit.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [deribit](#deribit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.deribit.com/#book-instrument_name-group-depth-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.deribit.com/#user-orders-instrument_name-raw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.deribit.com/#chart-trades-instrument_name-resolution + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [deribit](#deribit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.deribit.com/#chart-trades-instrument_name-resolution + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +deribit.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/derive.md b/docs/ccxt/wiki/exchanges/derive.md new file mode 100644 index 0000000..77c4c6d --- /dev/null +++ b/docs/ccxt/wiki/exchanges/derive.md @@ -0,0 +1,711 @@ + + + +## derive{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingRate](#fetchfundingrate) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchPositions](#fetchpositions) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchBalance](#fetchbalance) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [watchOrderBook](#watchorderbook) +* [watchTicker](#watchticker) +* [unWatchOrderBook](#unwatchorderbook) +* [unWatchTrades](#unwatchtrades) +* [watchTrades](#watchtrades) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [derive](#derive) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.derive.xyz/reference/post_public-get-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [derive](#derive) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.derive.xyz/reference/post_public-get-all-currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bybit + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.derive.xyz/reference/post_public-get-all-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [derive](#derive) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.derive.xyz/reference/post_public-get-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.derive.xyz/reference/post_public-get-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | + + +```javascript +derive.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://docs.derive.xyz/reference/post_public-get-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of funding rate structures to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [derive](#derive) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.derive.xyz/reference/post_public-get-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.fetchFundingRate (symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [derive](#derive) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/post_private-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.max_fee | float | No | *required* the maximum fee you are willing to pay for the order | + + +```javascript +derive.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [derive](#derive) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/post_private-replace + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [derive](#derive) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/post_private-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a trigger/algo order | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [derive](#derive) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.derive.xyz/reference/post_private-cancel-by-instrument +- https://docs.derive.xyz/reference/post_private-cancel-all + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | +| params.trigger | boolean | No | whether the order is a trigger/algo order | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +derive.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +derive.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +derive.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | set to true if you want to fetch trades with pagination | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | not used by kraken fetchPositions () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.fetchPositions ([symbols, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [derive](#derive) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-funding-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +derive.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [derive](#derive) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-all-portfolios + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.fetchBalance ([params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.derive.xyz/reference/post_private-get-withdrawal-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [derive](#derive) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.derive.xyz/reference/orderbook-instrument_name-group-depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [derive](#derive) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.derive.xyz/reference/ticker-instrument_name-interval + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.watchTicker (symbol[, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unsubscribe from the orderbook channel + +**Kind**: instance method of [derive](#derive) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | orderbook limit, default is undefined | + + +```javascript +derive.unWatchOrderBook (symbol[, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unsubscribe from the trades channel + +**Kind**: instance method of [derive](#derive) +**Returns**: any - status of the unwatch request + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to unwatch the trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.unWatchTrades (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.derive.xyz/reference/trades-instrument_name + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +derive.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.derive.xyz/reference/subaccount_id-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [derive](#derive) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.derive.xyz/reference/subaccount_id-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subaccount_id | string | No | *required* the subaccount id | + + +```javascript +derive.watchMyTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/digifinex.md b/docs/ccxt/wiki/exchanges/digifinex.md new file mode 100644 index 0000000..fe21267 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/digifinex.md @@ -0,0 +1,1037 @@ + + + +## digifinex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTime](#fetchtime) +* [fetchStatus](#fetchstatus) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrders](#fetchorders) +* [fetchOrder](#fetchorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchLedger](#fetchledger) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchCrossBorrowRate](#fetchcrossborrowrate) +* [fetchCrossBorrowRates](#fetchcrossborrowrates) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchTradingFee](#fetchtradingfee) +* [fetchPositions](#fetchpositions) +* [fetchPosition](#fetchposition) +* [setLeverage](#setleverage) +* [fetchTransfers](#fetchtransfers) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [addMargin](#addmargin) +* [reduceMargin](#reducemargin) +* [fetchFundingHistory](#fetchfundinghistory) +* [setMarginMode](#setmarginmode) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for digifinex + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-account-assets +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-assets +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#accountbalance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-orderbook +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#orderbook + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#ticker-price +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#ticker-price +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchTime ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchStatus ([params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-recent-trades +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#recenttrades + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-candles-data +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#recentcandle + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +digifinex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-new-order +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#orderplace + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, spot market orders use the quote currency, swap requires the number of contracts | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", or "PO" | +| params.postOnly | bool | No | true or false | +| params.reduceOnly | bool | No | true or false | +| params.marginMode | string | No | 'cross' or 'isolated', for spot margin trading | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | + + +```javascript +digifinex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders (all orders should be of the same symbol) + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-multiple-order +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#batchorder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.createOrders (orders[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#cancel-order +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#cancelorder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by digifinex cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by digifinex cancelOrders () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.cancelOrders (ids, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#current-active-orders +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#openorder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-all-orders-including-history-orders +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#historyorder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-order-status +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#orderinfo + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#customer-39-s-trades +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#historytrade + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-margin-otc-financial-logs +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#bills + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#transfer-assets-among-accounts +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#accounttransfer + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | 'spot', 'swap', 'margin', 'OTC' - account to transfer from | +| toAccount | string | Yes | 'spot', 'swap', 'margin', 'OTC' - account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchCrossBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [borrow rate structure](https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure) + +**See**: https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchCrossBorrowRate (code[, params]) +``` + + + + +### fetchCrossBorrowRates{docsify-ignore} +fetch the borrow interest rates of all currencies + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a list of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchCrossBorrowRates ([params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#currentfundingrate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#currentfundingrate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#tradingfee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-positions +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchPositions (symbols[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-positions +- https://docs.digifinex.com/en-ww/swap/v2/rest.html#positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchPosition (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - response from the exchange + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#setleverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | either 'cross' or 'isolated', default is cross | +| params.side | string | No | either 'long' or 'short', required for isolated markets only | + + +```javascript +digifinex.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch the transfer history, only transfers between spot and swap accounts are supported + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#transferrecord + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, for different trade sizes + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchLeverageTiers (symbols[, params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, for different trade sizes for a single market + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#instrument + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchMarketLeverageTiers (symbol[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-currency-deposit-and-withdrawal-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | not used by fetchDepositWithdrawFees () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin to a position + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=margin-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | Yes | the position side: 'long' or 'short' | + + +```javascript +digifinex.addMargin (symbol, amount[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=margin-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | Yes | the position side: 'long' or 'short' | + + +```javascript +digifinex.reduceMargin (symbol, amount[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#funding-fee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding payment | + + +```javascript +digifinex.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [digifinex](#digifinex) +**Returns**: object - response from the exchange + +**See**: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +digifinex.setMarginMode (marginMode, symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/exmo.md b/docs/ccxt/wiki/exchanges/exmo.md new file mode 100644 index 0000000..9e0ff14 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/exmo.md @@ -0,0 +1,968 @@ + + + +## exmo{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchTradingFees](#fetchtradingfees) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrderBooks](#fetchorderbooks) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [createMarketOrderWithCost](#createmarketorderwithcost) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchOpenOrders](#fetchopenorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [editOrder](#editorder) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchWithdrawal](#fetchwithdrawal) +* [fetchDeposit](#fetchdeposit) +* [fetchDeposits](#fetchdeposits) +* [watchBalance](#watchbalance) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchOrderBook](#watchorderbook) +* [watchOrders](#watchorders) + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#eebf9f25-0289-4946-9482-89872c738449 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#143ef808-79ca-4e49-9e79-a60ea4d8c0e3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.addMargin (symbol, amount[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#90927062-256c-4b03-900f-2b99131f9a54 +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#7de7e75c-5833-45a8-b937-c2276d235aaa + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchTradingFees ([params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFees instead + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a list of [transaction fees structures](https://docs.ccxt.com/#/?id=fees-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#4190035d-24b1-453d-833b-37e0a52f88e2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a list of [transaction fees structures](https://docs.ccxt.com/#/?id=fees-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#4190035d-24b1-453d-833b-37e0a52f88e2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - an associative dictionary of currencies + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#7cdf0ca8-9ff6-4cf3-aa33-bcec83155c49 +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#4190035d-24b1-453d-833b-37e0a52f88e2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for exmo + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#7de7e75c-5833-45a8-b937-c2276d235aaa + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchMarkets ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#65eeb949-74e5-4631-9184-c38387fe53e8 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +exmo.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#59c5160f-27a1-4d9a-8cfb-7979c7ffaac6 +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#c8388df7-1f9f-4d41-81c4-5a387d171dc6 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | *isolated* fetches the isolated margin balance | + + +```javascript +exmo.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#c60c51a8-e683-4f45-a000-820723d37871 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrderBooks{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbol + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#c60c51a8-e683-4f45-a000-820723d37871 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols, all symbols fetched if undefined, default is undefined | +| limit | int | No | max number of entries per orderbook to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchOrderBooks (symbols[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#4c8e6459-3503-4361-b012-c34bb9f7e385 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#4c8e6459-3503-4361-b012-c34bb9f7e385 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#5a5a9c0d-cf17-47f6-9d62-6d4404ebd5ac + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#b8d8d9af-4f46-46a1-939b-ad261d79f452 // spot +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#f4b1aaf8-399f-403b-ab5e-4926d967a106 // margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | a symbol is required but it can be a single string, or a non-empty array | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | *required for margin orders* the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.offset | int | No | last deal offset, default = 0 | + + +```javascript +exmo.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### createMarketOrderWithCost{docsify-ignore} +create a market order by providing the symbol, side and cost + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.createMarketOrderWithCost (symbol, side, cost[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#80daa469-ec59-4d0a-b229-6a311d8dd1cd +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#de6f4321-eeac-468c-87f7-c4ad7062e265 // stop market +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#3561b86c-9ff1-436e-8e68-ac926b7eb523 // margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | +| params.timeInForce | string | No | *spot only* 'fok', 'ioc' or 'post_only' | +| params.postOnly | boolean | No | *spot only* true for post only orders | +| params.cost | float | No | *spot only* *market orders only* the cost of the order in the quote currency for market orders | + + +```javascript +exmo.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#1f710d4b-75bc-4b65-ad68-006f863a3f26 +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#a4d0aae8-28f7-41ac-94fd-c4030130453d // stop market +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#705dfec5-2b35-4667-862b-faf54eca6209 // margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by exmo cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true to cancel a trigger order | +| params.marginMode | string | No | set to 'cross' or 'isolated' to cancel a margin order | + + +```javascript +exmo.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +*spot only* fetches information on an order made by the user + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#cf27781e-28e5-4b39-a52d-3110f5d22459 // spot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by exmo fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#cf27781e-28e5-4b39-a52d-3110f5d22459 // spot +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#00810661-9119-46c5-aec5-55abe9cb42c7 // margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | set to "isolated" to fetch trades for a margin order | + + +```javascript +exmo.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#0e135370-daa4-4689-8acd-b6876dee9ba1 // spot open orders +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#a7cfd4f0-476e-4675-b33f-22a46902f245 // margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | set to "isolated" for margin orders | + + +```javascript +exmo.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#1d2524dd-ae6d-403a-a067-77b50d13fbe5 // margin +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#a51be1d0-af5f-44e4-99d7-f7b04c6067d0 // spot canceled orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | set to "isolated" for margin orders | + + +```javascript +exmo.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### editOrder{docsify-ignore} +*margin only* edit a trade order + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#f27ee040-c75f-4b59-b608-d05bd45b7899 // margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified CCXT market symbol | +| type | string | Yes | not used by exmo editOrder | +| side | string | Yes | not used by exmo editOrder | +| amount | float | No | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | stop price for stop-market and stop-limit orders | +| params.marginMode | string | Yes | must be set to isolated EXCHANGE SPECIFIC PARAMETERS | +| params.distance | int | No | distance for trailing stop orders | +| params.expire | int | No | expiration timestamp in UTC timezone for the order. order will not be expired if expire is 0 | +| params.comment | string | No | optional comment for order. up to 50 latin symbols, whitespaces, underscores | + + +```javascript +exmo.editOrder (id, symbol, type, side[, amount, price, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#c8f9ced9-7ab6-4383-a6a4-bc54469ba60e + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#3ab9c34d-ad58-4f87-9c57-2e2ea88a8325 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#31e69a33-4849-4e6a-b4b4-6d574238f6a7 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#97f1becd-7aad-4e0e-babe-7bbe09e33706 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchWithdrawal{docsify-ignore} +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#97f1becd-7aad-4e0e-babe-7bbe09e33706 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | withdrawal id | +| code | string | Yes | unified currency code of the currency withdrawn, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchWithdrawal (id, code[, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch information on a deposit + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#97f1becd-7aad-4e0e-babe-7bbe09e33706 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | Yes | unified currency code, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchDeposit (id, code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#97f1becd-7aad-4e0e-babe-7bbe09e33706 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.fetchDeposits (code[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.watchBalance ([params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#fd8f47bc-8517-43c0-bb60-1d61a86d4471 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://documenter.getpostman.com/view/10287440/SzYXWKPi#fd8f47bc-8517-43c0-bb60-1d61a86d4471 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.watchTickers ([symbols, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +get the list of trades associated with the user + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [exmo](#exmo) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [exmo](#exmo) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#85f7bc03-b1c9-4cd2-bd22-8fd422272825 +- https://documenter.getpostman.com/view/10287440/SzYXWKPi#95e4ed18-1791-4e6d-83ad-cbfe9be1051c + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +exmo.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/foxbit.md b/docs/ccxt/wiki/exchanges/foxbit.md new file mode 100644 index 0000000..2539aab --- /dev/null +++ b/docs/ccxt/wiki/exchanges/foxbit.md @@ -0,0 +1,600 @@ + + + +## foxbit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchTransactions](#fetchtransactions) +* [fetchStatus](#fetchstatus) +* [editOrder](#editorder) +* [withdraw](#withdraw) +* [fetchLedger](#fetchledger) + + + +### fetchMarkets{docsify-ignore} +Retrieves data on all markets for foxbit. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_index + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +Get last 24 hours ticker information, in real-time, for given market. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +Retrieve the ticker data of all markets. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchTickers (symbols[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Member-Info/operation/MembersController_listTradingFees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchTradingFees ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +Exports a copy of the order book of a specific market. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_findOrderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return, the maximum is 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +Retrieve the trades of a specific market. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_publicTrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +Fetch historical candlestick data containing the open, high, low, and close price, and the volume of a market. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_findCandlesticks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +Query for balance and get the amount of funds available for trading or funds locked in orders. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Account/operation/AccountsController_all + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchBalance ([params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +Fetch all unfilled currently open orders. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_listOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +Fetch all currently closed orders. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_listOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +Create an order with the specified characteristics + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_create + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit', 'stop_market', 'stop_limit', 'instant' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | "GTC", "FOK", "IOC", "PO" | +| params.triggerPrice | float | No | The time in force for the order. One of GTC, FOK, IOC, PO. See .features or foxbit's doc to see more details. | +| params.postOnly | bool | No | true or false whether the order is post-only | +| params.clientOrderId | string | No | a unique identifier for the order | + + +```javascript +foxbit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/createBatch + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.createOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +Cancel open orders. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +Cancel all open orders or all open orders for a specific market. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +Get an order by ID. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_findByOrderId + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | | Yes | | +| symbol | string | Yes | it is not used in the foxbit API | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_listOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.state | string | No | Enum: ACTIVE, CANCELED, FILLED, PARTIALLY_CANCELED, PARTIALLY_FILLED | +| params.side | string | No | Enum: BUY, SELL | + + +```javascript +foxbit.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +Trade history queries will only have data available for the last 3 months, in descending order (most recents trades first). + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/TradesController_all + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +Fetch the deposit address for a currency associated with this account. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Deposit/operation/DepositsController_depositAddress + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.networkCode | string | No | the blockchain network to create a deposit address on | + + +```javascript +foxbit.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +Fetch all deposits made to an account. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Deposit/operation/DepositsController_listOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposit structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchDeposits ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +Fetch all withdrawals made from an account. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Withdrawal/operation/WithdrawalsController_listWithdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawal structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchTransactions{docsify-ignore} +Fetch all transactions (deposits and withdrawals) made from an account. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.foxbit.com.br/rest/v3/#tag/Withdrawal/operation/WithdrawalsController_listWithdrawals +- https://docs.foxbit.com.br/rest/v3/#tag/Deposit/operation/DepositsController_listOrders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawal structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchTransactions ([code, since, limit, params]) +``` + + + + +### fetchStatus{docsify-ignore} +The latest known information on the availability of the exchange API. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://status.foxbit.com/ + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchStatus ([params]) +``` + + + + +### editOrder{docsify-ignore} +Simultaneously cancel an existing order and create a new one. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_cancelReplace + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders, used as stop_price on stop market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### withdraw{docsify-ignore} +Make a withdrawal. + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Withdrawal/operation/WithdrawalsController_createWithdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered balance of the user + +**Kind**: instance method of [foxbit](#foxbit) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger-structure) + +**See**: https://docs.foxbit.com.br/rest/v3/#tag/Account/operation/AccountsController_getTransactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entrys to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +foxbit.fetchLedger (code[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/gate.md b/docs/ccxt/wiki/exchanges/gate.md new file mode 100644 index 0000000..b182206 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/gate.md @@ -0,0 +1,2367 @@ + + + +## gate{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [loadUnifiedStatus](#loadunifiedstatus) +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchBalance](#fetchbalance) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchTrades](#fetchtrades) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [editOrder](#editorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelOrdersForSymbols](#cancelordersforsymbols) +* [cancelAllOrders](#cancelallorders) +* [transfer](#transfer) +* [setLeverage](#setleverage) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [repayMargin](#repaymargin) +* [repayCrossMargin](#repaycrossmargin) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [borrowMargin](#borrowmargin) +* [fetchBorrowInterest](#fetchborrowinterest) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchSettlementHistory](#fetchsettlementhistory) +* [fetchMySettlementHistory](#fetchmysettlementhistory) +* [fetchLedger](#fetchledger) +* [setPositionMode](#setpositionmode) +* [fetchUnderlyingAssets](#fetchunderlyingassets) +* [fetchLiquidations](#fetchliquidations) +* [fetchMyLiquidations](#fetchmyliquidations) +* [fetchGreeks](#fetchgreeks) +* [closePosition](#closeposition) +* [fetchLeverage](#fetchleverage) +* [fetchLeverages](#fetchleverages) +* [fetchOption](#fetchoption) +* [fetchOptionChain](#fetchoptionchain) +* [fetchPositionsHistory](#fetchpositionshistory) +* [createOrderWs](#createorderws) +* [createOrdersWs](#createordersws) +* [cancelAllOrdersWs](#cancelallordersws) +* [cancelOrderWs](#cancelorderws) +* [editOrderWs](#editorderws) +* [fetchOrderWs](#fetchorderws) +* [fetchOpenOrdersWs](#fetchopenordersws) +* [fetchClosedOrdersWs](#fetchclosedordersws) +* [fetchOrdersWs](#fetchordersws) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [watchOHLCV](#watchohlcv) +* [watchMyTrades](#watchmytrades) +* [watchBalance](#watchbalance) +* [watchPositions](#watchpositions) +* [watchOrders](#watchorders) +* [watchMyLiquidations](#watchmyliquidations) +* [watchMyLiquidationsForSymbols](#watchmyliquidationsforsymbols) + + + +### loadUnifiedStatus{docsify-ignore} +returns unifiedAccount so the user can check if the unified account is enabled + +**Kind**: instance method of [gate](#gate) +**Returns**: boolean - true or false if the enabled unified account is enabled or not and sets the unifiedAccount option if it is undefined + +**See**: https://www.gate.io/docs/developers/apiv4/#get-account-detail + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.loadUnifiedStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [gate](#gate) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://www.gate.io/docs/developers/apiv4/en/#get-server-current-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for gate + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-all-currency-pairs-supported // spot +- https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading // margin +- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts // swap +- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2 // future +- https://www.gate.io/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time // option + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchCurrencies ([params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the api endpoint | + + +```javascript +gate.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#generate-currency-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | unified network code (not used directly by gate.io but used by ccxt to filter the response) | + + +```javascript +gate.fetchDepositAddress (code[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#retrieve-personal-trading-fee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://www.gate.io/docs/developers/apiv4/en/#retrieve-personal-trading-fee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchTradingFees ([params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFees instead + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2 +- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [gate](#gate) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#retrieve-order-book +- https://www.gate.io/docs/developers/apiv4/en/#futures-order-book +- https://www.gate.io/docs/developers/apiv4/en/#futures-order-book-2 +- https://www.gate.io/docs/developers/apiv4/en/#options-order-book + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#get-details-of-a-specifc-order +- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers +- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-tickers-of-options-contracts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#get-details-of-a-specifc-order +- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers +- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-tickers-of-options-contracts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchTickers (symbols[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.gate.com/docs/developers/apiv4/en/#margin-account-list +- https://www.gate.com/docs/developers/apiv4/en/#get-unified-account-information +- https://www.gate.com/docs/developers/apiv4/en/#list-spot-trading-accounts +- https://www.gate.com/docs/developers/apiv4/en/#get-futures-account +- https://www.gate.com/docs/developers/apiv4/en/#get-futures-account-2 +- https://www.gate.com/docs/developers/apiv4/en/#query-account-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | exchange specific parameters | +| params.type | string | No | spot, margin, swap or future, if not provided this.options['defaultType'] is used | +| params.settle | string | No | 'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used | +| params.symbol | string | No | margin only - unified ccxt symbol | +| params.unifiedAccount | boolean | No | default false, set to true for fetching the unified account balance | + + +```javascript +gate.fetchBalance ([params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +gate.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades +- https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history +- https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2 +- https://www.gate.io/docs/developers/apiv4/en/#options-trade-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +gate.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3 +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +Fetch personal trading history + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3 +- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used | +| params.type | string | No | 'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used | +| params.until | int | No | The latest timestamp, in ms, that fetched trades were made | +| params.page | int | No | *spot only* Page number | +| params.order_id | string | No | *spot only* Filter trades with specified order ID. symbol is also required if this field is present | +| params.order | string | No | *contract only* Futures order ID, return related data only if specified | +| params.offset | int | No | *contract only* list offset, starting from 0 | +| params.last_id | string | No | *contract only* specify list staring point using the id of last record in previous list-query results | +| params.count_total | int | No | *contract only* whether to return total number matched, default to 0(no return) | +| params.unifiedAccount | bool | No | set to true for fetching trades in a unified account | +| params.paginate | bool | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +gate.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +gate.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +gate.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.withdraw (code, amount, address, tag[, params]) +``` + + + + +### createOrder{docsify-ignore} +Create an order on the exchange + +**Kind**: instance method of [gate](#gate) +**Returns**: object \| undefined - [An order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#create-an-order +- https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order +- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order +- https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2 +- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2 +- https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3 +- https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| type | string | Yes | 'limit' or 'market' *"market" is contract only* | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | the amount of currency to trade | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.timeInForce | string | No | "GTC", "IOC", or "PO" | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used | +| params.iceberg | int | No | Amount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely | +| params.text | string | No | User defined information | +| params.account | string | No | *spot and margin only* "spot", "margin" or "cross_margin" | +| params.auto_borrow | bool | No | *margin only* Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough | +| params.settle | string | No | *contract only* Unified Currency Code for settle currency | +| params.reduceOnly | bool | No | *contract only* Indicates if this order is to reduce the size of a position | +| params.close | bool | No | *contract only* Set as true to close the position, with size set to 0 | +| params.auto_size | bool | No | *contract only* Set side to close dual-mode position, close_long closes the long side, while close_short the short one, size also needs to be set to 0 | +| params.price_type | int | No | *contract only* 0 latest deal price, 1 mark price, 2 index price | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.unifiedAccount | bool | No | set to true for creating an order in the unified account | + + +```javascript +gate.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2 +- https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders +- https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-futures-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.createOrders (orders[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#create-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedAccount | bool | No | set to true for creating a unified account order | + + +```javascript +gate.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order, gate currently only supports the modification of the price or amount fields + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#amend-an-order +- https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedAccount | bool | No | set to true for editing an order in a unified account | + + +```javascript +gate.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +Retrieves information on an order + +**Kind**: instance method of [gate](#gate) +**Returns**: An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order +- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2 +- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-3 +- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-4 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | Order id | +| symbol | string | Yes | Unified market symbol, *required for spot and margin* | +| params | object | No | Parameters specified by the exchange api | +| params.trigger | bool | No | True if the order being fetched is a trigger order | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used | +| params.type | string | No | 'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used | +| params.settle | string | No | 'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol !== undefined, default="usdt" for swap and "btc" for future | +| params.unifiedAccount | bool | No | set to true for fetching a unified account order | + + +```javascript +gate.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders +- https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true for fetching trigger orders | +| params.type | string | No | spot, margin, swap or future, if not provided this.options['defaultType'] is used | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for type='margin', if not provided this.options['defaultMarginMode'] is used | +| params.unifiedAccount | bool | No | set to true for fetching unified account orders | + + +```javascript +gate.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-orders +- https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list +- https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders +- https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders +- https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-options-orders +- https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-by-time-range + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true for fetching trigger orders | +| params.type | string | No | spot, swap or future, if not provided this.options['defaultType'] is used | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used | +| params.historical | boolean | No | *swap only* true for using historical endpoint | +| params.unifiedAccount | bool | No | set to true for fetching unified account orders | + + +```javascript +gate.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +Cancels an open order + +**Kind**: instance method of [gate](#gate) +**Returns**: An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order +- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2 +- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3 +- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | Order id | +| symbol | string | Yes | Unified market symbol | +| params | object | No | Parameters specified by the exchange api | +| params.trigger | bool | No | True if the order to be cancelled is a trigger order | +| params.unifiedAccount | bool | No | set to true for canceling unified account orders | + + +```javascript +gate.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list +- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedAccount | bool | No | set to true for canceling unified account orders | + + +```javascript +gate.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelOrdersForSymbols{docsify-ignore} +cancel multiple orders for multiple symbols + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array<CancellationRequest> | Yes | list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}] | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | client order ids | +| params.unifiedAccount | bool | No | set to true for canceling unified account orders | + + +```javascript +gate.cancelOrdersForSymbols (orders[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair +- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched +- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2 +- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedAccount | bool | No | set to true for canceling unified account orders | + + +```javascript +gate.cancelAllOrders (symbol[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [gate](#gate) +**Returns**: A [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#transfer-between-trading-accounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code for currency being transferred | +| amount | float | Yes | the amount of currency to transfer | +| fromAccount | string | Yes | the account to transfer currency from | +| toAccount | string | Yes | the account to transfer currency to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | Unified market symbol *required for type == margin* | + + +```javascript +gate.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [gate](#gate) +**Returns**: object - response from the exchange + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage +- https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open contract position + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#get-single-position +- https://www.gate.io/docs/developers/apiv4/en/#get-single-position-2 +- https://www.gate.io/docs/developers/apiv4/en/#get-specified-contract-position + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-all-positions-of-a-user +- https://www.gate.io/docs/developers/apiv4/en/#list-all-positions-of-a-user-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-user-s-positions-of-specified-underlying + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | Not used by gate, but parsed internally by CCXT | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.settle | string | No | 'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future | +| params.type | string | No | swap, future or option, if not provided this.options['defaultType'] is used | + + +```javascript +gate.fetchPositions (symbols[, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts +- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchLeverageTiers ([symbols, params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-risk-limit-tiers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchMarketLeverageTiers (symbol[, params]) +``` + + + + +### repayMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.gate.io/docs/apiv4/en/#repay-a-loan + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.mode | string | No | 'all' or 'partial' payment mode, extra parameter required for isolated margin | +| params.id | string | No | '34267567' loan id, extra parameter required for isolated margin | + + +```javascript +gate.repayMargin (symbol, code, amount[, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay cross margin borrowed margin and interest + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#cross-margin-repayments +- https://www.gate.io/docs/developers/apiv4/en/#borrow-or-repay + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.mode | string | No | 'all' or 'partial' payment mode, extra parameter required for isolated margin | +| params.id | string | No | '34267567' loan id, extra parameter required for isolated margin | +| params.unifiedAccount | boolean | No | set to true for repaying in the unified account | + + +```javascript +gate.repayCrossMargin (code, amount[, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#marginuni + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for isolated margin | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.rate | string | No | '0.0002' or '0.002' extra parameter required for isolated margin | + + +```javascript +gate.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### borrowMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan +- https://www.gate.io/docs/developers/apiv4/en/#borrow-or-repay + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.rate | string | No | '0.0002' or '0.002' extra parameter required for isolated margin | +| params.unifiedAccount | boolean | No | set to true for borrowing in the unified account | + + +```javascript +gate.borrowMargin (code, amount[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-interest-records +- https://www.gate.io/docs/developers/apiv4/en/#interest-records-for-the-cross-margin-account +- https://www.gate.io/docs/developers/apiv4/en/#list-interest-records-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| symbol | string | No | unified market symbol when fetching interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedAccount | boolean | No | set to true for fetching borrow interest in the unified account | + + +```javascript +gate.fetchBorrowInterest ([code, symbol, since, limit, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin +- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin +- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.addMargin (symbol, amount[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +Retrieves the open interest of a currency + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#futures-stats + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| timeframe | string | Yes | "5m", "15m", "30m", "1h", "4h", "1d" | +| since | int | No | the time(ms) of the earliest record to retrieve as a unix timestamp | +| limit | int | No | default 30 | +| params | object | No | exchange specific parameters | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +gate.fetchOpenInterest (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchSettlementHistory{docsify-ignore} +fetches historical settlement records + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [settlement history objects](https://docs.ccxt.com/#/?id=settlement-history-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-settlement-history-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history, required on gate | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | + + +```javascript +gate.fetchSettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchMySettlementHistory{docsify-ignore} +fetches historical settlement records of the user + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [settlement history objects] + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-my-options-settlements + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the settlement history | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | + + +```javascript +gate.fetchMySettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#query-account-book +- https://www.gate.io/docs/developers/apiv4/en/#list-margin-account-balance-change-history +- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2 +- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3 +- https://www.gate.io/docs/developers/apiv4/en/#list-account-changing-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +gate.fetchLedger ([code, since, limit, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set dual/hedged mode to true or false for a swap market, make sure all positions are closed and no orders are open before setting dual mode + +**Kind**: instance method of [gate](#gate) +**Returns**: object - response from the exchange + +**See**: https://www.gate.io/docs/developers/apiv4/en/#enable-or-disable-dual-mode + +| Param | Type | Description | +| --- | --- | --- | +| hedged | bool | set to true to enable dual mode | +| symbol | string, undefined | if passed, dual mode is set for all markets with the same settle currency | +| params | object | extra parameters specific to the exchange API endpoint | +| params.settle | string | settle currency | + + +```javascript +gate.setPositionMode (hedged, symbol, params[]) +``` + + + + +### fetchUnderlyingAssets{docsify-ignore} +fetches the market ids of underlying assets for a specific contract market type + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [underlying assets](https://docs.ccxt.com/#/?id=underlying-assets-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | exchange specific params | +| params.type | string | No | the contract market type, 'option', 'swap' or 'future', the default is 'option' | + + +```javascript +gate.fetchUnderlyingAssets ([params]) +``` + + + + +### fetchLiquidations{docsify-ignore} +retrieves the public liquidations of a trading pair + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#retrieve-liquidation-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | + + +```javascript +gate.fetchLiquidations (symbol[, since, limit, params]) +``` + + + + +### fetchMyLiquidations{docsify-ignore} +retrieves the users liquidated positions + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-liquidation-history +- https://www.gate.io/docs/developers/apiv4/en/#list-liquidation-history-2 +- https://www.gate.io/docs/developers/apiv4/en/#list-user-s-liquidation-history-of-specified-underlying + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the exchange API endpoint | + + +```javascript +gate.fetchMyLiquidations (symbol[, since, limit, params]) +``` + + + + +### fetchGreeks{docsify-ignore} +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-tickers-of-options-contracts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchGreeks (symbol[, params]) +``` + + + + +### closePosition{docsify-ignore} +closes open positions for a market + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - [A list of position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order +- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2 +- https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | Yes | 'buy' or 'sell' | +| params | object | No | extra parameters specific to the okx api endpoint | + + +```javascript +gate.closePosition (symbol, side[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#get-unified-account-information +- https://www.gate.io/docs/developers/apiv4/en/#get-detail-of-lending-market +- https://www.gate.io/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unified | boolean | No | default false, set to true for fetching the unified accounts leverage | + + +```javascript +gate.fetchLeverage (symbol[, params]) +``` + + + + +### fetchLeverages{docsify-ignore} +fetch the set leverage for all leverage markets, only spot margin is supported on gate + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/en/#list-lending-markets +- https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unified | boolean | No | default false, set to true for fetching unified account leverages | + + +```javascript +gate.fetchLeverages (symbols[, params]) +``` + + + + +### fetchOption{docsify-ignore} +fetches option data that is commonly found in an option chain + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an [option chain structure](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#query-specified-contract-detail + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchOption (symbol[, params]) +``` + + + + +### fetchOptionChain{docsify-ignore} +fetches data for an underlying asset that is commonly found in an option chain + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a list of [option chain structures](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | base currency to fetch an option chain for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.underlying | string | No | the underlying asset, can be obtained from fetchUnderlyingAssets () | +| params.expiration | int | No | unix timestamp of the expiration time | + + +```javascript +gate.fetchOptionChain (code[, params]) +``` + + + + +### fetchPositionsHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/#list-position-close-history +- https://www.gate.io/docs/developers/apiv4/#list-position-close-history-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified conract symbols, must all have the same settle currency and the same market type | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum amount of records to fetch, default=1000 | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.until | int | No | the latest time in ms to fetch positions for EXCHANGE SPECIFIC PARAMETERS | +| params.offset | int | No | list offset, starting from 0 | +| params.side | string | No | long or short | +| params.pnl | string | No | query profit or loss | + + +```javascript +gate.fetchPositionsHistory (symbols[, since, limit, params]) +``` + + + + +### createOrderWs{docsify-ignore} +Create an order on the exchange + +**Kind**: instance method of [gate](#gate) +**Returns**: object \| undefined - [An order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/ws/en/#order-place +- https://www.gate.io/docs/developers/futures/ws/en/#order-place + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| type | string | Yes | 'limit' or 'market' *"market" is contract only* | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | the amount of currency to trade | +| price | float | No | *ignored in "market" orders* the price at which the order is to be fulfilled at in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stopPrice | float | No | The price at which a trigger order is triggered at | +| params.timeInForce | string | No | "GTC", "IOC", or "PO" | +| params.stopLossPrice | float | No | The price at which a stop loss order is triggered at | +| params.takeProfitPrice | float | No | The price at which a take profit order is triggered at | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used | +| params.iceberg | int | No | Amount to display for the iceberg order, Null or 0 for normal orders, Set to -1 to hide the order completely | +| params.text | string | No | User defined information | +| params.account | string | No | *spot and margin only* "spot", "margin" or "cross_margin" | +| params.auto_borrow | bool | No | *margin only* Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough | +| params.settle | string | No | *contract only* Unified Currency Code for settle currency | +| params.reduceOnly | bool | No | *contract only* Indicates if this order is to reduce the size of a position | +| params.close | bool | No | *contract only* Set as true to close the position, with size set to 0 | +| params.auto_size | bool | No | *contract only* Set side to close dual-mode position, close_long closes the long side, while close_short the short one, size also needs to be set to 0 | +| params.price_type | int | No | *contract only* 0 latest deal price, 1 mark price, 2 index price | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | + + +```javascript +gate.createOrderWs (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrdersWs{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.gate.io/docs/developers/futures/ws/en/#order-batch-place + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.createOrdersWs (orders[, params]) +``` + + + + +### cancelAllOrdersWs{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/futures/ws/en/#cancel-all-open-orders-matched +- https://www.gate.io/docs/developers/apiv4/ws/en/#order-cancel-all-with-specified-currency-pair + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to use, defaults to spot.order_cancel_cp or futures.order_cancel_cp | + + +```javascript +gate.cancelAllOrdersWs (symbol[, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +Cancels an open order + +**Kind**: instance method of [gate](#gate) +**Returns**: An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/ws/en/#order-cancel +- https://www.gate.io/docs/developers/futures/ws/en/#order-cancel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | Order id | +| symbol | string | Yes | Unified market symbol | +| params | object | No | Parameters specified by the exchange api | +| params.trigger | bool | No | True if the order to be cancelled is a trigger order | + + +```javascript +gate.cancelOrderWs (id, symbol[, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order, gate currently only supports the modification of the price or amount fields + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/ws/en/#order-amend +- https://www.gate.io/docs/developers/futures/ws/en/#order-amend + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.editOrderWs (id, symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrderWs{docsify-ignore} +Retrieves information on an order + +**Kind**: instance method of [gate](#gate) +**Returns**: An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/ws/en/#order-status +- https://www.gate.io/docs/developers/futures/ws/en/#order-status + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | Order id | +| symbol | string | Yes | Unified market symbol, *required for spot and margin* | +| params | object | No | Parameters specified by the exchange api | +| params.trigger | bool | No | True if the order being fetched is a trigger order | +| params.marginMode | string | No | 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used | +| params.type | string | No | 'spot', 'swap', or 'future', if not provided this.options['defaultMarginMode'] is used | +| params.settle | string | No | 'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol !== undefined, default="usdt" for swap and "btc" for future | + + +```javascript +gate.fetchOrderWs (id, symbol[, params]) +``` + + + + +### fetchOpenOrdersWs{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.gate.io/docs/developers/futures/ws/en/#order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchOpenOrdersWs (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrdersWs{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.gate.io/docs/developers/futures/ws/en/#order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.fetchClosedOrdersWs (symbol[, since, limit, params]) +``` + + + + +### fetchOrdersWs{docsify-ignore} +fetches information on multiple orders made by the user by status + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.gate.io/docs/developers/futures/ws/en/#order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| status | string | Yes | requested order status | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int, undefined | No | the earliest time in ms to fetch orders for | +| limit | int, undefined | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.orderId | int | No | order id to begin at | +| params.limit | int | No | the maximum number of order structures to retrieve | + + +```javascript +gate.fetchOrdersWs (status, symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [gate](#gate) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-channel +- https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-v2-api +- https://www.gate.com/docs/developers/futures/ws/en/#order-book-api +- https://www.gate.com/docs/developers/futures/ws/en/#order-book-v2-api +- https://www.gate.com/docs/developers/delivery/ws/en/#order-book-api + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [gate](#gate) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.gate.io/docs/developers/apiv4/ws/en/#best-bid-or-ask-price +- https://www.gate.io/docs/developers/apiv4/ws/en/#order-book-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchBidsAsks (symbols[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.unWatchTradesForSymbols (symbols[, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.unWatchTrades (symbol[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [gate](#gate) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchBalance ([params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See** + +- https://www.gate.io/docs/developers/futures/ws/en/#positions-subscription +- https://www.gate.io/docs/developers/delivery/ws/en/#positions-subscription +- https://www.gate.io/docs/developers/options/ws/en/#positions-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols to watch positions for | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +gate.watchPositions ([symbols, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [gate](#gate) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | spot, margin, swap, future, or option. Required if listening to all symbols. | +| params.isInverse | boolean | No | if future, listen to inverse or linear contracts | + + +```javascript +gate.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyLiquidations{docsify-ignore} +watch the public liquidations of a trading pair + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + +**See** + +- https://www.gate.io/docs/developers/futures/ws/en/#liquidates-api +- https://www.gate.io/docs/developers/delivery/ws/en/#liquidates-api +- https://www.gate.io/docs/developers/options/ws/en/#liquidates-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the bitmex api endpoint | + + +```javascript +gate.watchMyLiquidations (symbol[, since, limit, params]) +``` + + + + +### watchMyLiquidationsForSymbols{docsify-ignore} +watch the private liquidations of a trading pair + +**Kind**: instance method of [gate](#gate) +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + +**See** + +- https://www.gate.io/docs/developers/futures/ws/en/#liquidates-api +- https://www.gate.io/docs/developers/delivery/ws/en/#liquidates-api +- https://www.gate.io/docs/developers/options/ws/en/#liquidates-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified CCXT market symbols | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the gate api endpoint | + + +```javascript +gate.watchMyLiquidationsForSymbols (symbols[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/gemini.md b/docs/ccxt/wiki/exchanges/gemini.md new file mode 100644 index 0000000..3b940d7 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/gemini.md @@ -0,0 +1,613 @@ + + + +## gemini{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchBalance](#fetchbalance) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchMyTrades](#fetchmytrades) +* [withdraw](#withdraw) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [createDepositAddress](#createdepositaddress) +* [fetchOHLCV](#fetchohlcv) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchBidsAsks](#watchbidsasks) +* [fetchOrders](#fetchorders) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the endpoint | + + +```javascript +gemini.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for gemini + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.gemini.com/rest-api/#symbols + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.gemini.com/rest-api/#current-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.gemini.com/rest-api/#ticker +- https://docs.gemini.com/rest-api/#ticker-v2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.fetchTickerMethod | object | No | 'fetchTickerV2', 'fetchTickerV1' or 'fetchTickerV1AndV2' - 'fetchTickerV1' for original ccxt.gemini.fetchTicker - 'fetchTickerV1AndV2' for 2 api calls to get the result of both fetchTicker methods - default = 'fetchTickerV1' | + + +```javascript +gemini.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.gemini.com/rest-api/#price-feed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.gemini.com/rest-api/#trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.gemini.com/rest-api/#get-notional-volume + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchTradingFees ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.gemini.com/rest-api/#get-available-balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchBalance ([params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.gemini.com/rest-api/#order-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.gemini.com/rest-api/#get-active-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.gemini.com/rest-api/#new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | must be 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.gemini.com/rest-api/#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.gemini.com/rest-api/#get-past-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.gemini.com/rest-api/#withdraw-crypto-funds + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.gemini.com/rest-api/#transfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.gemini.com/rest-api/#get-deposit-addresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the endpoint | +| params.network | string | No | *required* The chain of currency | + + +```javascript +gemini.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + +**See**: https://docs.gemini.com/rest-api/#get-deposit-addresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | *required* The chain of currency | + + +```javascript +gemini.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.gemini.com/rest-api/#new-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.createDepositAddress (code[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.gemini.com/rest-api/#candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +watch the list of most recent trades for a particular symbol + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.gemini.com/websocket-api/#market-data-version-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.gemini.com/websocket-api/#multi-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.gemini.com/websocket-api/#candles-data-feed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.gemini.com/websocket-api/#market-data-version-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.gemini.com/websocket-api/#multi-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [gemini](#gemini) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.gemini.com/websocket-api/#multi-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.watchBidsAsks (symbols[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [gemini](#gemini) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.gemini.com/websocket-api/#order-events + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +gemini.fetchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/hashkey.md b/docs/ccxt/wiki/exchanges/hashkey.md new file mode 100644 index 0000000..5d23729 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/hashkey.md @@ -0,0 +1,1209 @@ + + + +## hashkey{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchStatus](#fetchstatus) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchLastPrices](#fetchlastprices) +* [fetchBalance](#fetchbalance) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [transfer](#transfer) +* [fetchAccounts](#fetchaccounts) +* [fetchLedger](#fetchledger) +* [createOrder](#createorder) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createSpotOrder](#createspotorder) +* [createSwapOrder](#createswaporder) +* [createOrders](#createorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchPositions](#fetchpositions) +* [fetchPositionsForSymbol](#fetchpositionsforsymbol) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [watchOHLCV](#watchohlcv) +* [watchTrades](#watchtrades) +* [watchOrderBook](#watchorderbook) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchPositions](#watchpositions) +* [watchBalance](#watchbalance) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/check-server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchTime ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/test-connectivity + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchStatus ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for the exchange + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/exchangeinfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | the id of the market to fetch | + + +```javascript +hashkey.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an associative dictionary of currencies + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/exchangeinfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchCurrencies ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return (maximum value is 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-recent-trade-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch (maximum value is 100) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<Trade> - a list of [trade structures](https://github.com/ccxt/ccxt/wiki/Manual#trade-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/get-account-trade-list +- https://hashkeyglobal-apidoc.readme.io/reference/query-futures-trades +- https://hashkeyglobal-apidoc.readme.io/reference/get-sub-account-user + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | *is mandatory for swap markets* unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum amount of trades to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch trades for (default 'spot') | +| params.until | int | No | the latest time in ms to fetch trades for, only supports the last 30 days timeframe | +| params.fromId | string | No | srarting trade id | +| params.toId | string | No | ending trade id | +| params.clientOrderId | string | No | *spot markets only* filter trades by orderId | +| params.accountId | string | No | account id to fetch the orders from | + + +```javascript +hashkey.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-kline + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +hashkey.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-24hr-ticker-price-change + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-24hr-ticker-price-change + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchTickers ([symbols, params]) +``` + + + + +### fetchLastPrices{docsify-ignore} +fetches the last price for multiple markets + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a dictionary of lastprices structures + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-symbol-price-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the last prices | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | the id of the market to fetch last price for | + + +```javascript +hashkey.fetchLastPrices ([symbols, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-account-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountId | string | No | account ID, for Master Key only | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch balance for (default 'spot') | + + +```javascript +hashkey.fetchBalance ([params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code (default is 'USDT') | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | network for fetch deposit address (default is 'ETH') | + + +```javascript +hashkey.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (default 50, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | +| params.fromId | int | No | starting ID (To be released) | + + +```javascript +hashkey.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/withdrawal-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (default 50, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | + + +```javascript +hashkey.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | network for withdraw | +| params.clientOrderId | string | No | client order id | +| params.platform | string | No | the platform to withdraw to (hashkey, HashKey HK) | + + +```javascript +hashkey.withdraw (code, amount, address, tag[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/new-account-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account id to transfer from | +| toAccount | string | Yes | account id to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the transfer | +| params.remark | string | No | a note for the transfer | + + +```javascript +hashkey.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/query-sub-account + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchAccounts ([params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-account-transaction-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined (not used) | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.flowType | int | No | trade, fee, transfer, deposit, withdrawal | +| params.accountType | int | No | spot, swap, custody | + + +```javascript +hashkey.fetchLedger ([code, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/test-new-order +- https://hashkeyglobal-apidoc.readme.io/reference/create-order +- https://hashkeyglobal-apidoc.readme.io/reference/create-new-futures-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' or 'LIMIT_MAKER' for spot, 'market' or 'limit' or 'STOP' for swap | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.test | boolean | No | *spot markets only* whether to use the test endpoint or not, default is false | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.timeInForce | string | No | "GTC" or "IOC" or "PO" for spot, 'GTC' or 'FOK' or 'IOC' or 'LIMIT_MAKER' or 'PO' for swap | +| params.clientOrderId | string | No | a unique id for the order - is mandatory for swap | +| params.triggerPrice | float | No | *swap markets only* The price at which a trigger order is triggered at | + + +```javascript +hashkey.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createSpotOrder{docsify-ignore} +create a trade order on spot market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/test-new-order +- https://hashkeyglobal-apidoc.readme.io/reference/create-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' or 'LIMIT_MAKER' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *market buy only* the quote quantity that can be used as an alternative for the amount | +| params.test | bool | No | whether to use the test endpoint or not, default is false | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.timeInForce | string | No | 'GTC', 'IOC', or 'PO' | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +hashkey.createSpotOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createSwapOrder{docsify-ignore} +create a trade order on swap market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/create-new-futures-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' or 'STOP' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of you want to trade in units of the base currency | +| price | float | No | the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.reduceOnly | bool | No | true or false whether the order is reduce only | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.timeInForce | string | No | 'GTC', 'FOK', 'IOC', 'LIMIT_MAKER' or 'PO' | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +hashkey.createSwapOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders (all orders should be of the same symbol) + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/create-multiple-orders +- https://hashkeyglobal-apidoc.readme.io/reference/batch-create-new-futures-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the api endpoint | + + +```javascript +hashkey.createOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/cancel-order +- https://hashkeyglobal-apidoc.readme.io/reference/cancel-futures-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entry for (default 'spot') | +| params.clientOrderId | string | No | a unique id for the order that can be used as an alternative for the id | +| params.trigger | bool | No | *swap markets only* true for canceling a trigger order (default false) | +| params.stop | bool | No | *swap markets only* an alternative for trigger param | + + +```javascript +hashkey.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - response from exchange + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/cancel-all-open-orders +- https://hashkeyglobal-apidoc.readme.io/reference/batch-cancel-futures-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | 'buy' or 'sell' | + + +```javascript +hashkey.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/cancel-multiple-orders +- https://hashkeyglobal-apidoc.readme.io/reference/batch-cancel-futures-order-by-order-id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol (not used by hashkey) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entry for (default 'spot') | + + +```javascript +hashkey.cancelOrders (ids[, symbol, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/query-order +- https://hashkeyglobal-apidoc.readme.io/reference/get-futures-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entry for (default 'spot') | +| params.clientOrderId | string | No | a unique id for the order that can be used as an alternative for the id | +| params.accountId | string | No | *spot markets only* account id to fetch the order from | +| params.trigger | bool | No | *swap markets only* true for fetching a trigger order (default false) | +| params.stop | bool | No | *swap markets only* an alternative for trigger param | + + +```javascript +hashkey.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/get-current-open-orders +- https://hashkeyglobal-apidoc.readme.io/reference/get-sub-account-open-orders +- https://hashkeyglobal-apidoc.readme.io/reference/sub +- https://hashkeyglobal-apidoc.readme.io/reference/query-open-futures-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in - is mandatory for swap markets | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve - default 500, maximum 1000 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entries for (default 'spot') | +| params.orderId | string | No | *spot markets only* the id of the order to fetch | +| params.side | string | No | *spot markets only* 'buy' or 'sell' - the side of the orders to fetch | +| params.fromOrderId | string | No | *swap markets only* the id of the order to start from | +| params.trigger | bool | No | *swap markets only* true for fetching trigger orders (default false) | +| params.stop | bool | No | *swap markets only* an alternative for trigger param | +| params.accountId | string | No | account id to fetch the orders from | + + +```javascript +hashkey.fetchOpenOrders ([symbol, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetches information on multiple canceled and closed orders made by the user + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hashkeyglobal-apidoc.readme.io/reference/get-all-orders +- https://hashkeyglobal-apidoc.readme.io/reference/query-futures-history-orders +- https://hashkeyglobal-apidoc.readme.io/reference/get-sub-account-history-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | *is mandatory for swap markets* unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve - default 500, maximum 1000 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for - only supports the last 90 days timeframe | +| params.type | string | No | 'spot' or 'swap' - the type of the market to fetch entries for (default 'spot') | +| params.orderId | string | No | *spot markets only* the id of the order to fetch | +| params.side | string | No | *spot markets only* 'buy' or 'sell' - the side of the orders to fetch | +| params.fromOrderId | string | No | *swap markets only* the id of the order to start from | +| params.trigger | bool | No | *swap markets only* the id of the order to start from true for fetching trigger orders (default false) | +| params.stop | bool | No | *swap markets only* the id of the order to start from an alternative for trigger param | +| params.accountId | string | No | account id to fetch the orders from | + + +```javascript +hashkey.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-futures-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-futures-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-futures-history-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.fromId | int | No | the id of the entry to start from | +| params.endId | int | No | the id of the entry to end with | + + +```javascript +hashkey.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-futures-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | 'LONG' or 'SHORT' - the direction of the position (if not provided, positions for both sides will be returned) | + + +```javascript +hashkey.fetchPositions (symbols[, params]) +``` + + + + +### fetchPositionsForSymbol{docsify-ignore} +fetch all open positions for specific symbol + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/get-futures-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | 'LONG' or 'SHORT' - the direction of the position (if not provided, positions for both sides will be returned) | + + +```javascript +hashkey.fetchPositionsForSymbol (symbol[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/query-futures-leverage-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - response from the exchange + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/change-futures-leverage-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/exchangeinfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchLeverageTiers (symbols[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://developers.binance.com/docs/wallet/asset/trade-fee // spot +- https://hashkeyglobal-apidoc.readme.io/reference/get-futures-commission-rate-request-weight // swap + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +*for spot markets only* fetch the trading fees for multiple markets + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://developers.binance.com/docs/wallet/asset/trade-fee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.fetchTradingFees ([params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#public-stream + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.binary | bool | No | true or false - default false | + + +```javascript +hashkey.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#public-stream + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.binary | bool | No | true or false - default false | + + +```javascript +hashkey.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#public-stream + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#private-stream + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#private-stream + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#private-stream + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols to watch positions for | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +hashkey.watchPositions ([symbols, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [hashkey](#hashkey) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#private-stream + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap' - the type of the market to watch balance for (default 'spot') | + + +```javascript +hashkey.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/hibachi.md b/docs/ccxt/wiki/exchanges/hibachi.md new file mode 100644 index 0000000..1e1d6e8 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/hibachi.md @@ -0,0 +1,650 @@ + + + +## hibachi{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchBalance](#fetchbalance) +* [fetchTrades](#fetchtrades) +* [fetchTicker](#fetchticker) +* [fetchOrder](#fetchorder) +* [fetchTradingFees](#fetchtradingfees) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [editOrders](#editorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [withdraw](#withdraw) +* [fetchOrderBook](#fetchorderbook) +* [fetchMyTrades](#fetchmytrades) +* [fetchOpenOrders](#fetchopenorders) +* [fetchPositions](#fetchpositions) +* [fetchLedger](#fetchledger) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchTime](#fetchtime) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the close, high, low, open prices, interval and the volumeNotional + +**Kind**: instance property of [hibachi](#hibachi) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://api-doc.hibachi.xyz/#4f0eacec-c61e-4d51-afb3-23c51c2c6bac + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +hibachi.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for hibachi + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://api-doc.hibachi.xyz/#183981da-8df5-40a0-a155-da15015dd536 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an associative dictionary of currencies + +**See**: https://api-doc.hibachi.xyz/#183981da-8df5-40a0-a155-da15015dd536 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchCurrencies ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://api-doc.hibachi.xyz/#69aafedb-8274-4e21-bbaf-91dace8b8f31 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchBalance ([params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<object> - a list of recent [trade structures] + +**See**: https://api-doc.hibachi.xyz/#86a53bc1-d3bb-4b93-8a11-7034d4698caa + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch (maximum value is 100) | +| params | object | No | extra parameters specific to the hibachi api endpoint | + + +```javascript +hibachi.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker and the related information for the past 24h + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api-doc.hibachi.xyz/#4abb30c4-e5c7-4b0f-9ade-790111dbfa47 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market | +| params | object | No | extra parameters specific to the hibachi api endpoint | + + +```javascript +hibachi.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#096a8854-b918-4de8-8731-b2a28d26b96d + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fee + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - a map of market symbols to [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Description | +| --- | --- | +| params | extra parameters | + + +```javascript +hibachi.fetchTradingFees (params, [undefined]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#00f6d5ad-5275-41cb-a1a8-19ed5d142124 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +*contract only* create a list of trade orders + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#c2840b9b-f02c-44ed-937d-dc2819f135b4 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a limit order that is not matched + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#94d2cdaf-1c71-440f-a981-da1112824810 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | must be 'limit' | +| side | string | Yes | 'buy' or 'sell', should stay the same with original side | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### editOrders{docsify-ignore} +edit a list of trade orders + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#c2840b9b-f02c-44ed-937d-dc2819f135b4 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to edit, each object should contain the parameters required by editOrder, namely id, symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.editOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#e99c4f48-e610-4b7c-b7f6-1b4bb7af0271 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | is unused | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#c2840b9b-f02c-44ed-937d-dc2819f135b4 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol, unused | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.cancelOrders (ids[, symbol, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#8ed24695-016e-49b2-a72d-7511ca921fee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.cancelAllOrders (symbol[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-doc.hibachi.xyz/#6421625d-3e45-45fa-be9b-d2a0e780c090 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code, only support USDT | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches the state of the open orders on the orderbook + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - A dictionary containg [orderbook information](https://docs.ccxt.com/#/?id=order-book-structure) + +**See**: https://api-doc.hibachi.xyz/#4abb30c4-e5c7-4b0f-9ade-790111dbfa47 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market | +| limit | int | No | currently unused | +| params | object | No | extra parameters to be passed -- see documentation link above | + + +```javascript +hibachi.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://api-doc.hibachi.xyz/#0adbf143-189f-40e0-afdc-88af4cba3c79 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches all current open orders + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-doc.hibachi.xyz/#3243f8a0-086c-44c5-ab8a-71bbb7bab403 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol to filter by | +| since | int | No | milisecond timestamp of the earliest order | +| limit | int | No | the maximum number of open orders to return | +| params | object | No | extra parameters | + + +```javascript +hibachi.fetchOpenOrders ([symbol, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://api-doc.hibachi.xyz/#69aafedb-8274-4e21-bbaf-91dace8b8f31 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchPositions ([symbols, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://api-doc.hibachi.xyz/#35125e3f-d154-4bfd-8276-a48bb1c62020 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch deposit address for given currency and chain. currently, we have a single EVM address across multiple EVM chains. Note: This method is currently only supported for trustless accounts + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters for API | +| params.publicKey | string | No | your public key, you can get it from UI after creating API key | + + +```javascript +hibachi.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch deposits made to account + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-doc.hibachi.xyz/#35125e3f-d154-4bfd-8276-a48bb1c62020 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | filter by earliest timestamp (ms) | +| limit | int | No | maximum number of deposits to be returned | +| params | object | No | extra parameters to be passed to API | + + +```javascript +hibachi.fetchDeposits ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch withdrawals made from account + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-doc.hibachi.xyz/#35125e3f-d154-4bfd-8276-a48bb1c62020 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | filter by earliest timestamp (ms) | +| limit | int | No | maximum number of deposits to be returned | +| params | object | No | extra parameters to be passed to API | + + +```javascript +hibachi.fetchWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: http://api-doc.hibachi.xyz/#b5c6a3bc-243d-4d35-b6d4-a74c92495434 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchTime ([params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://api-doc.hibachi.xyz/#bc34e8ae-e094-4802-8d56-3efe3a7bad49 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +hibachi.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://api-doc.hibachi.xyz/#bca696ca-b9b2-4072-8864-5d6b8c09807e + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [hibachi](#hibachi) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://api-doc.hibachi.xyz/#4abb30c4-e5c7-4b0f-9ade-790111dbfa47 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hibachi.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/hitbtc.md b/docs/ccxt/wiki/exchanges/hitbtc.md new file mode 100644 index 0000000..66c3876 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/hitbtc.md @@ -0,0 +1,1071 @@ + + + +## hitbtc{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchBalance](#fetchbalance) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchOrderBooks](#fetchorderbooks) +* [fetchOrderBook](#fetchorderbook) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOpenOrder](#fetchopenorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrder](#cancelorder) +* [createOrder](#createorder) +* [fetchMarginModes](#fetchmarginmodes) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchPositions](#fetchpositions) +* [fetchPosition](#fetchposition) +* [fetchOpenInterests](#fetchopeninterests) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchFundingRate](#fetchfundingrate) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [closePosition](#closeposition) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for hitbtc + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://api.hitbtc.com/#symbols + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - an associative dictionary of currencies + +**See**: https://api.hitbtc.com/#currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchCurrencies ([params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://api.hitbtc.com/#generate-deposit-crypto-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://api.hitbtc.com/#get-deposit-crypto-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchDepositAddress (code[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://api.hitbtc.com/#wallet-balance +- https://api.hitbtc.com/#get-spot-trading-balance +- https://api.hitbtc.com/#get-trading-balance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchBalance ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.hitbtc.com/#tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.hitbtc.com/#tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api.hitbtc.com/#trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://api.hitbtc.com/#spot-trades-history +- https://api.hitbtc.com/#futures-trades-history +- https://api.hitbtc.com/#margin-trades-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for fetching margin trades | + + +```javascript +hitbtc.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.hitbtc.com/#get-transactions-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.hitbtc.com/#get-transactions-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.hitbtc.com/#get-transactions-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchOrderBooks{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbol + +**See**: https://api.hitbtc.com/#order-books + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols, all symbols fetched if undefined, default is undefined | +| limit | int | No | max number of entries per orderbook to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchOrderBooks ([symbols, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api.hitbtc.com/#order-books + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://api.hitbtc.com/#get-trading-commission +- https://api.hitbtc.com/#get-trading-commission-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See** + +- https://api.hitbtc.com/#get-all-trading-commissions +- https://api.hitbtc.com/#get-all-trading-commissions-2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://api.hitbtc.com/#candles +- https://api.hitbtc.com/#futures-index-price-candles +- https://api.hitbtc.com/#futures-mark-price-candles +- https://api.hitbtc.com/#futures-premium-index-candles + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +hitbtc.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.hitbtc.com/#spot-orders-history +- https://api.hitbtc.com/#futures-orders-history +- https://api.hitbtc.com/#margin-orders-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for fetching margin orders | + + +```javascript +hitbtc.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.hitbtc.com/#spot-orders-history +- https://api.hitbtc.com/#futures-orders-history +- https://api.hitbtc.com/#margin-orders-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for fetching a margin order | + + +```javascript +hitbtc.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://api.hitbtc.com/#spot-trades-history +- https://api.hitbtc.com/#futures-trades-history +- https://api.hitbtc.com/#margin-trades-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for fetching margin trades | + + +```javascript +hitbtc.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.hitbtc.com/#get-all-active-spot-orders +- https://api.hitbtc.com/#get-active-futures-orders +- https://api.hitbtc.com/#get-active-margin-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for fetching open margin orders | + + +```javascript +hitbtc.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrder{docsify-ignore} +fetch an open order by it's id + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.hitbtc.com/#get-active-spot-order +- https://api.hitbtc.com/#get-active-futures-order +- https://api.hitbtc.com/#get-active-margin-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for fetching an open margin order | + + +```javascript +hitbtc.fetchOpenOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.hitbtc.com/#cancel-all-spot-orders +- https://api.hitbtc.com/#cancel-futures-orders +- https://api.hitbtc.com/#cancel-all-margin-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for canceling margin orders | + + +```javascript +hitbtc.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.hitbtc.com/#cancel-spot-order +- https://api.hitbtc.com/#cancel-futures-order +- https://api.hitbtc.com/#cancel-margin-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported | +| params.margin | bool | No | true for canceling a margin order | + + +```javascript +hitbtc.cancelOrder (id, symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.hitbtc.com/#create-new-spot-order +- https://api.hitbtc.com/#create-margin-order +- https://api.hitbtc.com/#create-futures-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both, default is 'cross' | +| params.margin | bool | No | true for creating a margin order | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.timeInForce | string | No | "GTC", "IOC", "FOK", "Day", "GTD" | + + +```javascript +hitbtc.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchMarginModes{docsify-ignore} +fetches margin mode of the user + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a list of [margin mode structures](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See** + +- https://api.hitbtc.com/#get-margin-position-parameters +- https://api.hitbtc.com/#get-futures-position-parameters + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchMarginModes (symbols[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://api.hitbtc.com/#transfer-between-wallet-and-exchange + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.hitbtc.com/#withdraw-crypto + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetches funding rates for multiple markets + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://api.hitbtc.com/#futures-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://api.hitbtc.com/#funding-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +hitbtc.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://api.hitbtc.com/#get-futures-margin-accounts +- https://api.hitbtc.com/#get-all-margin-accounts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | not used by hitbtc fetchPositions () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set | +| params.margin | bool | No | true for fetching spot-margin positions | + + +```javascript +hitbtc.fetchPositions (symbols[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://api.hitbtc.com/#get-futures-margin-account +- https://api.hitbtc.com/#get-isolated-margin-account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if this is set | +| params.margin | bool | No | true for fetching a spot-margin position | + + +```javascript +hitbtc.fetchPosition (symbol[, params]) +``` + + + + +### fetchOpenInterests{docsify-ignore} +Retrieves the open interest for a list of symbols + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://api.hitbtc.com/#futures-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified CCXT market symbols | +| params | object | No | exchange specific parameters | + + +```javascript +hitbtc.fetchOpenInterests ([symbols, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +Retrieves the open interest of a derivative trading pair + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=interest-history-structure](https://docs.ccxt.com/#/?id=interest-history-structure) + +**See**: https://api.hitbtc.com/#futures-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +hitbtc.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://api.hitbtc.com/#futures-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchFundingRate (symbol[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See** + +- https://api.hitbtc.com/#create-update-margin-account-2 +- https://api.hitbtc.com/#create-update-margin-account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if this is set | +| params.margin | bool | No | true for reducing spot-margin | + + +```javascript +hitbtc.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See** + +- https://api.hitbtc.com/#create-update-margin-account-2 +- https://api.hitbtc.com/#create-update-margin-account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if this is set | +| params.margin | bool | No | true for adding spot-margin | + + +```javascript +hitbtc.addMargin (symbol, amount[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See** + +- https://api.hitbtc.com/#get-futures-margin-account +- https://api.hitbtc.com/#get-isolated-margin-account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if this is set | +| params.margin | bool | No | true for fetching spot-margin leverage | + + +```javascript +hitbtc.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - response from the exchange + +**See**: https://api.hitbtc.com/#create-update-margin-account-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: Array<object> - a list of [fees structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://api.hitbtc.com/#currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hitbtc.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### closePosition{docsify-ignore} +closes open positions for a market + +**Kind**: instance method of [hitbtc](#hitbtc) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.hitbtc.com/#close-all-futures-margin-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified ccxt market symbol | +| side | string | Yes | 'buy' or 'sell' | +| params | object | No | extra parameters specific to the okx api endpoint | +| params.symbol | string | No | *required* unified market symbol | +| params.marginMode | string | No | 'cross' or 'isolated', default is 'cross' | + + +```javascript +hitbtc.closePosition (symbol, side[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/hollaex.md b/docs/ccxt/wiki/exchanges/hollaex.md new file mode 100644 index 0000000..197f6f7 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/hollaex.md @@ -0,0 +1,702 @@ + + + +## hollaex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchOrderBooks](#fetchorderbooks) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [fetchOpenOrder](#fetchopenorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddresses](#fetchdepositaddresses) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawal](#fetchwithdrawal) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [watchOrderBook](#watchorderbook) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchOrders](#watchorders) +* [watchBalance](#watchbalance) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for hollaex + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://apidocs.hollaex.com/#constants + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - an associative dictionary of currencies + +**See**: https://apidocs.hollaex.com/#constants + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchCurrencies ([params]) +``` + + + + +### fetchOrderBooks{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbol + +**See**: https://apidocs.hollaex.com/#orderbooks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | not used by hollaex fetchOrderBooks () | +| limit | int | No | not used by hollaex fetchOrderBooks () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchOrderBooks (symbols[, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://apidocs.hollaex.com/#orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://apidocs.hollaex.com/#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://apidocs.hollaex.com/#tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://apidocs.hollaex.com/#trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://apidocs.hollaex.com/#tiers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +hollaex has large gaps between candles, so it's recommended to specify since + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://apidocs.hollaex.com/#chart + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch (max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +hollaex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://apidocs.hollaex.com/#get-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchBalance ([params]) +``` + + + + +### fetchOpenOrder{docsify-ignore} +fetch an open order by it's id + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#get-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by hollaex fetchOpenOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchOpenOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#get-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#get-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#get-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#get-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | + + +```javascript +hollaex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#cancel-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://apidocs.hollaex.com/#get-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddresses{docsify-ignore} +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://apidocs.hollaex.com/#get-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchDepositAddresses (codes[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://apidocs.hollaex.com/#get-deposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawal{docsify-ignore} +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://apidocs.hollaex.com/#get-withdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | withdrawal id | +| code | string | Yes | unified currency code of the currency withdrawn, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchWithdrawal (id, code[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://apidocs.hollaex.com/#get-withdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://apidocs.hollaex.com/#withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://apidocs.hollaex.com/#constants + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://apidocs.hollaex.com/#sending-receiving-messages + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://apidocs.hollaex.com/#sending-receiving-messages + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://apidocs.hollaex.com/#sending-receiving-messages + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidocs.hollaex.com/#sending-receiving-messages + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [hollaex](#hollaex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://apidocs.hollaex.com/#sending-receiving-messages + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hollaex.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/htx.md b/docs/ccxt/wiki/exchanges/htx.md new file mode 100644 index 0000000..db0e1a8 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/htx.md @@ -0,0 +1,1796 @@ + + + +## htx{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchTradingFee](#fetchtradingfee) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchLastPrices](#fetchlastprices) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchAccounts](#fetchaccounts) +* [fetchAccountIdByType](#fetchaccountidbytype) +* [fetchCurrencies](#fetchcurrencies) +* [fetchBalance](#fetchbalance) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOpenOrders](#fetchopenorders) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createTrailingPercentOrder](#createtrailingpercentorder) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [transfer](#transfer) +* [fetchIsolatedBorrowRates](#fetchisolatedborrowrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchBorrowInterest](#fetchborrowinterest) +* [fetchFundingHistory](#fetchfundinghistory) +* [setLeverage](#setleverage) +* [fetchPositions](#fetchpositions) +* [fetchPosition](#fetchposition) +* [fetchLedger](#fetchledger) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchOpenInterestHistory](#fetchopeninteresthistory) +* [fetchOpenInterests](#fetchopeninterests) +* [fetchOpenInterest](#fetchopeninterest) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [borrowCrossMargin](#borrowcrossmargin) +* [repayIsolatedMargin](#repayisolatedmargin) +* [repayCrossMargin](#repaycrossmargin) +* [fetchSettlementHistory](#fetchsettlementhistory) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchLiquidations](#fetchliquidations) +* [closePositions](#closepositions) +* [setPositionMode](#setpositionmode) +* [watchTicker](#watchticker) +* [watchTrades](#watchtrades) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchMyTrades](#watchmytrades) +* [watchOrders](#watchorders) +* [watchPositions](#watchpositions) +* [watchBalance](#watchbalance) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-system-status +- https://huobiapi.github.io/docs/dm/v1/en/#get-system-status +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-system-status +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#get-system-status +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#query-whether-the-system-is-available // contractPublicGetHeartbeat + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [htx](#htx) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-current-timestamp +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-current-system-timestamp + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchTime ([params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#get-current-fee-rate-applied-to-the-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for huobi + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-trading-symbol-v1-deprecated +- https://huobiapi.github.io/docs/dm/v1/en/#get-contract-info +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-swap-info +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-swap-info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-latest-aggregated-ticker +- https://huobiapi.github.io/docs/dm/v1/en/#get-market-data-overview +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-data-overview +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-data-overview + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-latest-tickers-for-all-pairs +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-a-batch-of-market-data-overview +- https://huobiapi.github.io/docs/dm/v1/en/#get-a-batch-of-market-data-overview +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-a-batch-of-market-data-overview-v2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchTickers ([symbols, params]) +``` + + + + +### fetchLastPrices{docsify-ignore} +fetches the last price for multiple markets + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a dictionary of lastprices structures + +**See** + +- https://www.htx.com/en-us/opend/newApiPages/?id=8cb81024-77b5-11ed-9966-0242ac110003 linear swap & linear future +- https://www.htx.com/en-us/opend/newApiPages/?id=28c2e8fc-77ae-11ed-9966-0242ac110003 inverse future +- https://www.htx.com/en-us/opend/newApiPages/?id=5d517ef5-77b6-11ed-9966-0242ac110003 inverse swap + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the last prices | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchLastPrices ([symbols, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [htx](#htx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-market-depth +- https://huobiapi.github.io/docs/dm/v1/en/#get-market-depth +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-market-depth +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-market-depth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#get-the-match-result-of-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-match-results-via-multiple-fields-new +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-match-results-via-multiple-fields-new +- https://huobiapi.github.io/docs/spot/v1/en/#search-match-results + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +htx.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-the-most-recent-trades +- https://huobiapi.github.io/docs/dm/v1/en/#query-a-batch-of-trade-records-of-a-contract +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-trade-records-of-a-contract +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-trade-records-of-a-contract + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-klines-candles +- https://huobiapi.github.io/docs/dm/v1/en/#get-kline-data +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-kline-data +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-kline-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.useHistoricalEndpointForSpot | string | No | true/false - whether use the historical candles endpoint for spot markets or default klines endpoint | + + +```javascript +htx.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchAccounts ([params]) +``` + + + + +### fetchAccountIdByType{docsify-ignore} +fetch all the accounts by a type and marginModeassociated with a profile + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| type | string | Yes | 'spot', 'swap' or 'future | +| marginMode | string | No | 'cross' or 'isolated' | +| symbol | string | No | unified ccxt market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchAccountIdByType (type[, marginMode, symbol, params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an associative dictionary of currencies + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#apiv2-currency-amp-chains + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchCurrencies ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-account-balance-of-a-specific-account +- https://www.htx.com/en-us/opend/newApiPages/?id=7ec4b429-7773-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=10000074-77b7-11ed-9966-0242ac110003 +- https://huobiapi.github.io/docs/dm/v1/en/#query-asset-valuation +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-user-s-account-information +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-query-user-s-account-information +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-query-user-39-s-account-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unified | bool | No | provide this parameter if you have a recent account with unified cross+isolated margin account | + + +```javascript +htx.fetchBalance ([params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [htx](#htx) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order-based-on-client-order-id +- https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-information-of-an-order +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-information-of-order +- https://huobiapi.github.io/docs/dm/v1/en/#get-information-of-an-order +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-information-of-an-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders +- https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | *contract only* if the orders are trigger trigger orders or not | +| params.stopLossTakeProfit | bool | No | *contract only* if the orders are stop-loss or take-profit orders | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.trailing | boolean | No | *contract only* set to true if you want to fetch trailing stop orders | + + +```javascript +htx.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#search-past-orders +- https://huobiapi.github.io/docs/spot/v1/en/#search-historical-orders-within-48-hours +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-get-history-orders-new +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-get-history-orders-new +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-history-orders-new +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-history-orders-via-multiple-fields-new + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +htx.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#get-all-open-orders +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-current-unfilled-order-acquisition +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-current-unfilled-order-acquisition + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | *contract only* if the orders are trigger trigger orders or not | +| params.stopLossTakeProfit | bool | No | *contract only* if the orders are stop-loss or take-profit orders | +| params.trailing | boolean | No | *contract only* set to true if you want to fetch trailing stop orders | + + +```javascript +htx.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4ee16-7773-11ed-9966-0242ac110003 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createTrailingPercentOrder{docsify-ignore} +create a trailing order by providing the symbol, type, side, amount, price and trailingPercent + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, or number of contracts | +| price | float | No | the price for the order to be filled at, in units of the quote currency, ignored in market orders | +| trailingPercent | float | Yes | the percent to trail away from the current market price | +| trailingTriggerPrice | float | Yes | the price to activate a trailing order, default uses the price argument | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.createTrailingPercentOrder (symbol, type, side, amount[, price, trailingPercent, trailingTriggerPrice, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#place-a-new-order // spot, margin +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-an-order // coin-m swap +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-trigger-order // coin-m swap trigger +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-an-order // usdt-m swap cross +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-trigger-order // usdt-m swap cross trigger +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-an-order // usdt-m swap isolated +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-trigger-order // usdt-m swap isolated trigger +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-set-a-take-profit-and-stop-loss-order-for-an-existing-position +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-set-a-take-profit-and-stop-loss-order-for-an-existing-position +- https://huobiapi.github.io/docs/dm/v1/en/#place-an-order // coin-m futures +- https://huobiapi.github.io/docs/dm/v1/en/#place-trigger-order // coin-m futures contract trigger + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price a trigger order is triggered at | +| params.triggerType | string | No | *contract trigger orders only* ge: greater than or equal to, le: less than or equal to | +| params.stopLossPrice | float | No | *contract only* the price a stop-loss order is triggered at | +| params.takeProfitPrice | float | No | *contract only* the price a take-profit order is triggered at | +| params.operator | string | No | *spot and margin only* gte or lte, trigger price condition | +| params.offset | string | No | *contract only* 'both' (linear only), 'open', or 'close', required in hedge mode and for inverse markets | +| params.postOnly | bool | No | *contract only* true or false | +| params.leverRate | int | No | *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement | +| params.timeInForce | string | No | supports 'IOC' and 'FOK' | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.trailingPercent | float | No | *contract only* the percent to trail away from the current market price | +| params.trailingTriggerPrice | float | No | *contract only* the price to trigger a trailing order, default uses the price argument | +| params.hedged | bool | No | *contract only* true for hedged mode, false for one way mode, default is false | + + +```javascript +htx.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#place-a-batch-of-orders +- https://huobiapi.github.io/docs/dm/v1/en/#place-a-batch-of-orders +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-a-batch-of-orders +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-a-batch-of-orders +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-a-batch-of-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.createOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [htx](#htx) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | *contract only* if the order is a trigger trigger order or not | +| params.stopLossTakeProfit | boolean | No | *contract only* if the order is a stop-loss or take-profit order | +| params.trailing | boolean | No | *contract only* set to true if you want to cancel a trailing order | + + +```javascript +htx.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | *contract only* if the orders are trigger trigger orders or not | +| params.stopLossTakeProfit | bool | No | *contract only* if the orders are stop-loss or take-profit orders | + + +```javascript +htx.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | *contract only* if the orders are trigger trigger orders or not | +| params.stopLossTakeProfit | boolean | No | *contract only* if the orders are stop-loss or take-profit orders | +| params.trailing | boolean | No | *contract only* set to true if you want to cancel all trailing orders | + + +```javascript +htx.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [htx](#htx) +**Returns**: object - the api result + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#dead-man-s-switch + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + +**See**: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.htx.com/en-us/opend/newApiPages/?id=7ec50029-7773-11ed-9966-0242ac110003 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4f050-7773-11ed-9966-0242ac110003 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#search-for-existed-withdraws-and-deposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.htx.com/en-us/opend/newApiPages/?id=7ec4cc41-7773-11ed-9966-0242ac110003 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.withdraw (code, amount, address, tag[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://huobiapi.github.io/docs/dm/v1/en/#transfer-margin-between-spot-account-and-future-account +- https://huobiapi.github.io/docs/spot/v1/en/#transfer-fund-between-spot-account-and-future-contract-account +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-transfer-margin-between-spot-account-and-usdt-margined-contracts-account +- https://huobiapi.github.io/docs/spot/v1/en/#transfer-asset-from-spot-trading-account-to-cross-margin-account-cross +- https://huobiapi.github.io/docs/spot/v1/en/#transfer-asset-from-spot-trading-account-to-isolated-margin-account-isolated +- https://huobiapi.github.io/docs/spot/v1/en/#transfer-asset-from-cross-margin-account-to-spot-trading-account-cross +- https://huobiapi.github.io/docs/spot/v1/en/#transfer-asset-from-isolated-margin-account-to-spot-trading-account-isolated + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from 'spot', 'future', 'swap' | +| toAccount | string | Yes | account to transfer to 'spot', 'future', 'swap' | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | used for isolated margin transfer | +| params.subType | string | No | 'linear' or 'inverse', only used when transfering to/from swap accounts | + + +```javascript +htx.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchIsolatedBorrowRates{docsify-ignore} +fetch the borrow interest rates of all currencies + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a list of [isolated borrow rate structures](https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#get-loan-interest-rate-and-quota-isolated + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchIsolatedBorrowRates ([params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-funding-rate +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-funding-rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | not used by huobi, but filtered internally by ccxt | +| limit | int | No | not used by huobi, but filtered internally by ccxt | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +htx.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See** + +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-funding-rate +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-funding-rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-a-batch-of-funding-rate +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-a-batch-of-funding-rate + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#search-past-margin-orders-cross +- https://huobiapi.github.io/docs/spot/v1/en/#search-past-margin-orders-isolated + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| symbol | string | Yes | unified market symbol when fetch interest in isolated markets | +| since | int | No | the earliest time in ms to fetch borrrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchBorrowInterest (code, symbol[, since, limit, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-account-financial-records-via-multiple-fields-new // linear swaps +- https://huobiapi.github.io/docs/dm/v1/en/#query-financial-records-via-multiple-fields-new // coin-m futures +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-financial-records-via-multiple-fields-new // coin-m swaps + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [htx](#htx) +**Returns**: object - response from the exchange + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-switch-leverage +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-switch-leverage +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#switch-leverage +- https://huobiapi.github.io/docs/dm/v1/en/#switch-leverage // Coin-m futures + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-query-user-39-s-position-information +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-query-user-s-position-information +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-user-s-position-information +- https://huobiapi.github.io/docs/dm/v1/en/#query-user-s-position-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subType | string | No | 'linear' or 'inverse' | +| params.type | string | No | *inverse only* 'future', or 'swap' | +| params.marginMode | string | No | *linear only* 'cross' or 'isolated' | + + +```javascript +htx.fetchPositions ([symbols, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-query-assets-and-positions +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-query-assets-and-positions +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-assets-and-positions +- https://huobiapi.github.io/docs/dm/v1/en/#query-assets-and-positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchPosition (symbol[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#get-account-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +htx.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchLeverageTiers (symbols[, params]) +``` + + + + +### fetchOpenInterestHistory{docsify-ignore} +Retrieves the open interest history of a currency + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an array of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://huobiapi.github.io/docs/dm/v1/en/#query-information-on-open-interest +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-information-on-open-interest +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-information-on-open-interest + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| timeframe | string | Yes | '1h', '4h', '12h', or '1d' | +| since | int | No | Not used by huobi api, but response parsed by CCXT | +| limit | int | No | Default:48,Data Range [1,200] | +| params | object | No | Exchange specific parameters | +| params.amount_type | int | No | *required* Open interest unit. 1-cont,2-cryptocurrency | +| params.pair | int | No | eg BTC-USDT *Only for USDT-M* | + + +```javascript +htx.fetchOpenInterestHistory (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOpenInterests{docsify-ignore} +Retrieves the open interest for a list of symbols + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://huobiapi.github.io/docs/dm/v1/en/#get-contract-open-interest-information +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-swap-open-interest-information +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-swap-open-interest-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified CCXT market symbols | +| params | object | No | exchange specific parameters | + + +```javascript +htx.fetchOpenInterests ([symbols, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +Retrieves the open interest of a currency + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://huobiapi.github.io/docs/dm/v1/en/#get-contract-open-interest-information +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-swap-open-interest-information +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-get-swap-open-interest-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +htx.fetchOpenInterest (symbol[, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-isolated +- https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-cross + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for isolated margin | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-isolated +- https://huobiapi.github.io/docs/spot/v1/en/#request-a-margin-loan-cross + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.borrowCrossMargin (code, amount[, params]) +``` + + + + +### repayIsolatedMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#repay-margin-loan-cross-isolated + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.repayIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#repay-margin-loan-cross-isolated + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.repayCrossMargin (code, amount[, params]) +``` + + + + +### fetchSettlementHistory{docsify-ignore} +Fetches historical settlement records + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [settlement history objects](https://docs.ccxt.com/#/?id=settlement-history-structure) + +**See** + +- https://huobiapi.github.io/docs/dm/v1/en/#query-historical-settlement-records-of-the-platform-interface +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-settlement-records-of-the-platform-interface +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-settlement-records-of-the-platform-interface + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the settlement history for | +| since | int | No | timestamp in ms, value range = current time - 90 days,default = current time - 90 days | +| limit | int | No | page items, default 20, shall not exceed 50 | +| params | object | No | exchange specific params | +| params.until | int | No | timestamp in ms, value range = start_time -> current time,default = current time | +| params.page_index | int | No | page index, default page 1 if not filled | +| params.code | int | No | unified currency code, can be used when symbol is undefined | + + +```javascript +htx.fetchSettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [fees structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://huobiapi.github.io/docs/spot/v1/en/#get-all-supported-currencies-v2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchLiquidations{docsify-ignore} +retrieves the public liquidations of a trading pair + +**Kind**: instance method of [htx](#htx) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-liquidation-orders-new +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-liquidation-orders-new +- https://huobiapi.github.io/docs/dm/v1/en/#query-liquidation-order-information-new + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the huobi api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | +| params.tradeType | int | No | default 0, linear swap 0: all liquidated orders, 5: liquidated longs; 6: liquidated shorts, inverse swap and future 0: filled liquidated orders, 5: liquidated close orders, 6: liquidated open orders | + + +```javascript +htx.fetchLiquidations (symbol[, since, limit, params]) +``` + + + + +### closePositions{docsify-ignore} +closes open positions for a contract market, requires 'amount' in params, unlike other exchanges + +**Kind**: instance method of [htx](#htx) +**Returns**: object - [an order structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-lightning-close-order // USDT-M (isolated) +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-lightning-close-position // USDT-M (cross) +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-lightning-close-order // Coin-M swap +- https://huobiapi.github.io/docs/dm/v1/en/#place-flash-close-order // Coin-M futures + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| side | string | Yes | 'buy' or 'sell', the side of the closing order, opposite side as position side | +| params | object | No | extra parameters specific to the okx api endpoint | +| params.clientOrderId | string | No | client needs to provide unique API and have to maintain the API themselves afterwards. [1, 9223372036854775807] | +| params.marginMode | object | No | 'cross' or 'isolated', required for linear markets EXCHANGE SPECIFIC PARAMETERS | +| params.amount | number | No | order quantity | +| params.order_price_type | string | No | 'lightning' by default, 'lightning_fok': lightning fok type, 'lightning_ioc': lightning ioc type 'market' by default, 'market': market order type, 'lightning_fok': lightning | + + +```javascript +htx.closePositions (symbol, side[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false + +**Kind**: instance method of [htx](#htx) +**Returns**: object - response from the exchange + +**See** + +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-switch-position-mode +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-switch-position-mode + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to for hedged mode, must be set separately for each market in isolated margin mode, only valid for linear markets | +| symbol | string | No | unified market symbol, required for isolated margin mode | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | "cross" (default) or "isolated" | + + +```javascript +htx.setPositionMode (hedged[, symbol, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.htx.com/en-us/opend/newApiPages/?id=7ec53561-7773-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=28c33ab2-77ae-11ed-9966-0242ac110003 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchTicker (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.htx.com/en-us/opend/newApiPages/?id=7ec53b69-7773-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=28c33c21-77ae-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=28c33cfe-77ae-11ed-9966-0242ac110003 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.htx.com/en-us/opend/newApiPages/?id=7ec53241-7773-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=28c3346a-77ae-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=28c33563-77ae-11ed-9966-0242ac110003 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [htx](#htx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://huobiapi.github.io/docs/dm/v1/en/#subscribe-market-depth-data +- https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#subscribe-incremental-market-depth-data +- https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-subscribe-incremental-market-depth-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.htx.com/en-us/opend/newApiPages/?id=7ec53dd5-7773-11ed-9966-0242ac110003 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.htx.com/en-us/opend/newApiPages/?id=7ec53c8f-7773-11ed-9966-0242ac110003 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions. Note: huobi has one channel for each marginMode and type + +**Kind**: instance method of [htx](#htx) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See** + +- https://www.huobi.com/en-in/opend/newApiPages/?id=8cb7de1c-77b5-11ed-9966-0242ac110003 +- https://www.huobi.com/en-in/opend/newApiPages/?id=8cb7df0f-77b5-11ed-9966-0242ac110003 +- https://www.huobi.com/en-in/opend/newApiPages/?id=28c34a7d-77ae-11ed-9966-0242ac110003 +- https://www.huobi.com/en-in/opend/newApiPages/?id=5d5156b5-77b6-11ed-9966-0242ac110003 + + +| Param | Type | Description | +| --- | --- | --- | +| symbols | Array<string>, undefined | list of unified market symbols | +| since | | | +| limit | | | +| params | object | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchPositions (symbols, since, limit, params[]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [htx](#htx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.htx.com/en-us/opend/newApiPages/?id=7ec52e28-7773-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=10000084-77b7-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=8cb7dcca-77b5-11ed-9966-0242ac110003 +- https://www.htx.com/en-us/opend/newApiPages/?id=28c34995-77ae-11ed-9966-0242ac110003 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +htx.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/hyperliquid.md b/docs/ccxt/wiki/exchanges/hyperliquid.md new file mode 100644 index 0000000..1e8804d --- /dev/null +++ b/docs/ccxt/wiki/exchanges/hyperliquid.md @@ -0,0 +1,1530 @@ + + + +## hyperliquid{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchSwapMarkets](#fetchswapmarkets) +* [calculatePricePrecision](#calculatepriceprecision) +* [fetchSpotMarkets](#fetchspotmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchFundingRates](#fetchfundingrates) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [createOrdersRequest](#createordersrequest) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelOrdersRequest](#cancelordersrequest) +* [cancelOrdersForSymbols](#cancelordersforsymbols) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [editOrder](#editorder) +* [editOrders](#editorders) +* [createVault](#createvault) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchCanceledAndClosedOrders](#fetchcanceledandclosedorders) +* [fetchOrders](#fetchorders) +* [fetchOrder](#fetchorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [setMarginMode](#setmarginmode) +* [setLeverage](#setleverage) +* [addMargin](#addmargin) +* [reduceMargin](#reducemargin) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchTradingFee](#fetchtradingfee) +* [fetchLedger](#fetchledger) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchOpenInterests](#fetchopeninterests) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchFundingHistory](#fetchfundinghistory) +* [reserveRequestWeight](#reserverequestweight) +* [createOrdersWs](#createordersws) +* [createOrderWs](#createorderws) +* [editOrderWs](#editorderws) +* [cancelOrdersWs](#cancelordersws) +* [cancelOrderWs](#cancelorderws) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [unWatchTickers](#unwatchtickers) +* [watchMyTrades](#watchmytrades) +* [unWatchTrades](#unwatchtrades) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOrders](#watchorders) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an associative dictionary of currencies + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for hyperliquid + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.fetchMarkets ([params]) +``` + + + + +### fetchSwapMarkets{docsify-ignore} +retrieves data on all swap markets for hyperliquid + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.fetchSwapMarkets ([params]) +``` + + + + +### calculatePricePrecision{docsify-ignore} +Helper function to calculate the Hyperliquid DECIMAL_PLACES price precision + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: int - The calculated price precision + + +| Param | Type | Description | +| --- | --- | --- | +| price | float | the price to use in the calculation | +| amountPrecision | int | the amountPrecision to use in the calculation | +| maxDecimals | int | the maxDecimals to use in the calculation | + + +```javascript +hyperliquid.calculatePricePrecision (price, amountPrecision, maxDecimals[]) +``` + + + + +### fetchSpotMarkets{docsify-ignore} +retrieves data on all spot markets for hyperliquid + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.fetchSpotMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | +| params.type | string | No | wallet type, ['spot', 'swap'], defaults to swap | +| params.marginMode | string | No | 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'spot' or 'swap', by default fetches both | + + +```javascript +hyperliquid.fetchTickers ([symbols, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +retrieves data on all swap markets for hyperliquid + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.fetchFundingRates ([symbols, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents, support '1m', '15m', '1h', '1d' | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +hyperliquid.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade | +| params.address | string | No | wallet address that made trades | +| params.user | string | No | wallet address that made trades | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | +| params.postOnly | bool | No | true or false whether the order is post-only | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | +| params.slippage | string | No | the slippage for market order | +| params.vaultAddress | string | No | the vault address for order | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.createOrders (orders[, params]) +``` + + + + +### createOrdersRequest{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order + +| Param | Type | Description | +| --- | --- | --- | +| orders | Array | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | + + +```javascript +hyperliquid.createOrdersRequest (orders, [undefined]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | +| params.vaultAddress | string | No | the vault address for order | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string, Array<string> | No | client order ids, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | +| params.vaultAddress | string | No | the vault address | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.cancelOrders (ids[, symbol, params]) +``` + + + + +### cancelOrdersRequest{docsify-ignore} +build the request payload for cancelling multiple orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - the raw request object to be sent to the exchange + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | | + + +```javascript +hyperliquid.cancelOrdersRequest (ids, symbol[, params]) +``` + + + + +### cancelOrdersForSymbols{docsify-ignore} +cancel multiple orders for multiple symbols + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array<CancellationRequest> | Yes | each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}] | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.vaultAddress | string | No | the vault address | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.cancelOrdersForSymbols (orders[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - the api result + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.vaultAddress | string | No | the vault address | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | +| params.postOnly | bool | No | true or false whether the order is post-only | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | +| params.vaultAddress | string | No | the vault address for order | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### editOrders{docsify-ignore} +edit a list of trade orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.editOrders (orders[, params]) +``` + + + + +### createVault{docsify-ignore} +creates a value + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - the api result + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| name | string | Yes | The name of the vault | +| description | string | Yes | The description of the vault | +| initialUsd | number | Yes | The initialUsd of the vault | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.createVault (name, description, initialUsd[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | + + +```javascript +hyperliquid.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | +| params.method | string | No | 'openOrders' or 'frontendOpenOrders' default is 'frontendOpenOrders' | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetch all unfilled currently closed orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | + + +```javascript +hyperliquid.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetch all canceled orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | + + +```javascript +hyperliquid.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledAndClosedOrders{docsify-ignore} +fetch all closed and canceled orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | + + +```javascript +hyperliquid.fetchCanceledAndClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetch all orders + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | +| params.user | string | No | user address, will default to this.walletAddress if not provided | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | + + +```javascript +hyperliquid.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchPositions ([symbols, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode (symbol) + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - response from the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | margin mode must be either [isolated, cross] | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.leverage | string | No | the rate of leverage, is required if setting trade mode (symbol) | +| params.vaultAddress | string | No | the vault address | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - response from the exchange + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | margin mode must be either [isolated, cross], default is cross | + + +```javascript +hyperliquid.setLeverage (leverage, symbol[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.vaultAddress | string | No | the vault address | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.addMargin (symbol, amount[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.vaultAddress | string | No | the vault address | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.reduceMargin (symbol, amount[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from *spot, swap* | +| toAccount | string | Yes | account to transfer to *swap, spot or address* | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.vaultAddress | string | No | the vault address for order | + + +```javascript +hyperliquid.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal (only support USDC) + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request +- https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.vaultAddress | string | No | vault address withdraw from | + + +```javascript +hyperliquid.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch withdrawals for | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch withdrawals for | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchOpenInterests{docsify-ignore} +Retrieves the open interest for a list of symbols + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | Unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +hyperliquid.fetchOpenInterests ([symbols, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [open interest structure](https://docs.ccxt.com/#/?id=open-interest-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +hyperliquid.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subAccountAddress | string | No | sub account user address | + + +```javascript +hyperliquid.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### reserveRequestWeight{docsify-ignore} +Instead of trading to increase the address based rate limits, this action allows reserving additional actions for 0.0005 USDC per request. The cost is paid from the Perps balance. + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a response object + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| weight | number | Yes | the weight to reserve, 1 weight = 1 action, 0.0005 USDC per action | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.reserveRequestWeight (weight[, params]) +``` + + + + +### createOrdersWs{docsify-ignore} +create a list of trade orders using WebSocket post request + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.createOrdersWs (orders[, params]) +``` + + + + +### createOrderWs{docsify-ignore} +create a trade order using WebSocket post request + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | +| params.postOnly | bool | No | true or false whether the order is post-only | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | +| params.slippage | string | No | the slippage for market order | +| params.vaultAddress | string | No | the vault address for order | + + +```javascript +hyperliquid.createOrderWs (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timeInForce | string | No | 'Gtc', 'Ioc', 'Alo' | +| params.postOnly | bool | No | true or false whether the order is post-only | +| params.reduceOnly | bool | No | true or false whether the order is reduce-only | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.clientOrderId | string | No | client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef) | +| params.vaultAddress | string | No | the vault address for order | + + +```javascript +hyperliquid.editOrderWs (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrdersWs{docsify-ignore} +cancel multiple orders using WebSocket post request + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | list of order ids to cancel | +| symbol | string | Yes | unified symbol of the market the orders were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | Array<string> | No | list of client order ids to cancel instead of order ids | +| params.vaultAddress | string | No | the vault address for order cancellation | + + +```javascript +hyperliquid.cancelOrdersWs (ids, symbol[, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +cancel a single order using WebSocket post request + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/post-requests + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id to cancel | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | client order id to cancel instead of order id | +| params.vaultAddress | string | No | the vault address for order cancellation | + + +```javascript +hyperliquid.cancelOrderWs (id, symbol[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.watchTickers (symbols[, params]) +``` + + + + +### unWatchTickers{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.unWatchTickers (symbols[, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | + + +```javascript +hyperliquid.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unWatches information on multiple trades made in a market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.unWatchTrades (symbol[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, close price, and the volume of a market + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +hyperliquid.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [hyperliquid](#hyperliquid) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.user | string | No | user address, will default to this.walletAddress if not provided | + + +```javascript +hyperliquid.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/independentreserve.md b/docs/ccxt/wiki/exchanges/independentreserve.md new file mode 100644 index 0000000..40a60a5 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/independentreserve.md @@ -0,0 +1,365 @@ + + + +## independentreserve{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [watchTrades](#watchtrades) +* [watchOrderBook](#watchorderbook) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for independentreserve + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchTradingFees ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.independentreserve.com/features/api#CancelOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.independentreserve.com/features/api#GetDigitalCurrencyDepositAddress + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.independentreserve.com/features/api#WithdrawDigitalCurrency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.comment | object | No | withdrawal comment, should not exceed 500 characters | + + +```javascript +independentreserve.withdraw (code, amount, address, tag[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [independentreserve](#independentreserve) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +independentreserve.watchOrderBook (symbol[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/indodax.md b/docs/ccxt/wiki/exchanges/indodax.md new file mode 100644 index 0000000..44880d4 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/indodax.md @@ -0,0 +1,399 @@ + + + +## indodax{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchTransactionFee](#fetchtransactionfee) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [withdraw](#withdraw) +* [fetchDepositAddresses](#fetchdepositaddresses) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [indodax](#indodax) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for indodax + +**Kind**: instance method of [indodax](#indodax) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#pairs + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#get-info-endpoint + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#ticker-all + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [indodax](#indodax) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Public-RestAPI.md#trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [indodax](#indodax) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +indodax.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#get-order-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [indodax](#indodax) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#open-orders-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [indodax](#indodax) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#trade-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#cancel-order-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchTransactionFee{docsify-ignore} +fetch the fee for a transaction + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#withdraw-fee-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchTransactionFee (code[, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#transaction-history-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#withdraw-coin-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositAddresses{docsify-ignore} +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance method of [indodax](#indodax) +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://github.com/btcid/indodax-official-api-docs/blob/master/Private-RestAPI.md#general-information-on-endpoints + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string> | No | list of unified currency codes, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +indodax.fetchDepositAddresses ([codes, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/kraken().md b/docs/ccxt/wiki/exchanges/kraken().md new file mode 100644 index 0000000..063a9a4 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/kraken().md @@ -0,0 +1,864 @@ + + + +## kraken{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchStatus](#fetchstatus) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTradingFee](#fetchtradingfee) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOHLCV](#fetchohlcv) +* [fetchLedger](#fetchledger) +* [fetchTrades](#fetchtrades) +* [fetchBalance](#fetchbalance) +* [createMarketOrderWithCost](#createmarketorderwithcost) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchOrdersByIds](#fetchordersbyids) +* [fetchMyTrades](#fetchmytrades) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchDeposits](#fetchdeposits) +* [fetchTime](#fetchtime) +* [fetchWithdrawals](#fetchwithdrawals) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositMethods](#fetchdepositmethods) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [fetchPositions](#fetchpositions) +* [transferOut](#transferout) +* [transfer](#transfer) + + + +### kraken{docsify-ignore} +Set rateLimit to 1000 if fully verified + + + +```javascript +kraken.kraken () +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for kraken + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTradableAssetPairs + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchMarkets ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://docs.kraken.com/api/docs/rest-api/get-system-status/ + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchStatus ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getAssetInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchCurrencies ([params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradeVolume + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getOrderBook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTickerInformation + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getTickerInformation + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchTicker (symbol[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.kraken.com/api/docs/rest-api/get-ohlc-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kraken.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://docs.kraken.com/rest/#tag/Account-Data/operation/getLedgers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ledger entry | +| params.end | int | No | timestamp in seconds of the latest ledger entry | + + +```javascript +kraken.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getRecentTrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.kraken.com/rest/#tag/Account-Data/operation/getExtendedBalance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchBalance ([params]) +``` + + + + +### createMarketOrderWithCost{docsify-ignore} +create a market order by providing the symbol, side and cost + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in (only USD markets are supported) | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.createMarketOrderWithCost (symbol, side, cost[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol, side and cost + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/addOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/rest-api/add-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.postOnly | bool | No | if true, the order will only be posted to the order book and not executed immediately | +| params.reduceOnly | bool | No | *margin only* indicates if this order is to reduce the size of a position | +| params.stopLossPrice | float | No | *margin only* the price that a stop loss order is triggered at | +| params.takeProfitPrice | float | No | *margin only* the price that a take profit order is triggered at | +| params.trailingAmount | string | No | *margin only* the quote amount to trail away from the current market price | +| params.trailingPercent | string | No | *margin only* the percent to trail away from the current market price | +| params.trailingLimitAmount | string | No | *margin only* the quote amount away from the trailingAmount | +| params.trailingLimitPercent | string | No | *margin only* the percent away from the trailingAmount | +| params.offset | string | No | *margin only* '+' or '-' whether you want the trailingLimitAmount value to be positive or negative, default is negative '-' | +| params.trigger | string | No | *margin only* the activation price type, 'last' or 'index', default is 'last' | + + +```javascript +kraken.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/rest-api/amend-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | No | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stopLossPrice | float | No | the price that a stop loss order is triggered at | +| params.takeProfitPrice | float | No | the price that a take profit order is triggered at | +| params.trailingAmount | string | No | the quote amount to trail away from the current market price | +| params.trailingPercent | string | No | the percent to trail away from the current market price | +| params.trailingLimitAmount | string | No | the quote amount away from the trailingAmount | +| params.trailingLimitPercent | string | No | the percent away from the trailingAmount | +| params.offset | string | No | '+' or '-' whether you want the trailingLimitAmount value to be positive or negative | +| params.postOnly | boolean | No | if true, the order will only be posted to the order book and not executed immediately | +| params.clientOrderId | string | No | the orders client order id | + + +```javascript +kraken.editOrder (id, symbol, type, side[, amount, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/rest/#tag/Account-Data/operation/getOrdersInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by kraken fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.kraken.com/rest/#tag/Account-Data/operation/getTradesInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchOrdersByIds{docsify-ignore} +fetch orders by the list of order id + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<object> - a list of [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | No | list of order id | +| symbol | string | No | unified ccxt market symbol | +| params | object | No | extra parameters specific to the kraken api endpoint | + + +```javascript +kraken.fetchOrdersByIds ([ids, symbol, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.kraken.com/api/docs/rest-api/get-trade-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade entry | +| params.end | int | No | timestamp in seconds of the latest trade entry | + + +```javascript +kraken.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/rest-api/cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | the orders client order id | +| params.userref | int | No | the orders user reference id | + + +```javascript +kraken.cancelOrder (id[, symbol, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrderBatch + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | open orders transaction ID (txid) or user reference (userref) | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, not used by kraken cancelAllOrders (all open orders are cancelled) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - the api result + +**See**: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrdersAfter + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/rest-api/get-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | the orders client order id | +| params.userref | int | No | the orders user reference id | + + +```javascript +kraken.fetchOpenOrders ([symbol, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/rest-api/get-closed-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest entry | +| params.clientOrderId | string | No | the orders client order id | +| params.userref | int | No | the orders user reference id | + + +```javascript +kraken.fetchClosedOrders ([symbol, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentDeposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest transaction entry | +| params.end | int | No | timestamp in seconds of the latest transaction entry | + + +```javascript +kraken.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [kraken](#kraken) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.kraken.com/rest/#tag/Spot-Market-Data/operation/getServerTime + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchTime ([params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.kraken.com/rest/#tag/Funding/operation/getStatusRecentWithdrawals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest transaction entry | +| params.end | int | No | timestamp in seconds of the latest transaction entry | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +kraken.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.kraken.com/rest/#tag/Funding/operation/getDepositAddresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositMethods{docsify-ignore} +fetch deposit methods for a currency associated with this account + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - of deposit methods + +**See**: https://docs.kraken.com/rest/#tag/Funding/operation/getDepositMethods + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the kraken api endpoint | + + +```javascript +kraken.fetchDepositMethods (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.kraken.com/rest/#tag/Funding/operation/getDepositAddresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [kraken](#kraken) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.kraken.com/rest/#tag/Funding/operation/withdrawFunds + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to, not required can be '' or undefined/none/null | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [kraken](#kraken) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.kraken.com/rest/#tag/Account-Data/operation/getOpenPositions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | not used by kraken fetchPositions () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kraken.fetchPositions ([symbols, params]) +``` + + + + +### transferOut{docsify-ignore} +transfer from spot wallet to futures wallet + +**Kind**: instance method of [kraken](#kraken) +**Returns**: a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.kraken.com/rest/#tag/User-Funding/operation/walletTransfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | str | Yes | Unified currency code | +| amount | float | Yes | Size of the transfer | +| params | dict | No | Exchange specific parameters | + + +```javascript +kraken.transferOut (code, amount[, params]) +``` + + + + +### transfer{docsify-ignore} +transfers currencies between sub-accounts (only spot->swap direction is supported) + +**Kind**: instance method of [kraken](#kraken) +**Returns**: a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.kraken.com/rest/#tag/User-Funding/operation/walletTransfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | Unified currency code | +| amount | float | Yes | Size of the transfer | +| fromAccount | string | Yes | 'spot' or 'Spot Wallet' | +| toAccount | string | Yes | 'swap' or 'Futures Wallet' | +| params | object | No | Exchange specific parameters | + + +```javascript +kraken.transfer (code, amount, fromAccount, toAccount[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/krakenfutures.md b/docs/ccxt/wiki/exchanges/krakenfutures.md new file mode 100644 index 0000000..adb8733 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/krakenfutures.md @@ -0,0 +1,631 @@ + + + +## krakenfutures{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchBalance](#fetchbalance) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchPositions](#fetchpositions) +* [fetchLeverageTiers](#fetchleveragetiers) +* [transferOut](#transferout) +* [transfer](#transfer) +* [setLeverage](#setleverage) +* [fetchLeverages](#fetchleverages) +* [fetchLeverage](#fetchleverage) + + + +### fetchMarkets{docsify-ignore} +Fetches the available trading markets from the exchange, Multi-collateral markets are returned as linear markets, but can be settled in multiple currencies + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An array of market structures + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | exchange specific params | + + +```javascript +krakenfutures.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +Fetches a list of open orders in a market + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An [order book structure](https://docs.ccxt.com/#/?id=order-book-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified market symbol | +| limit | int | No | Not used by krakenfutures | +| params | object | No | exchange specific params | + + +```javascript +krakenfutures.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - an array of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.fetchTickers (symbols[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.kraken.com/api/docs/futures-api/charts/candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +krakenfutures.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +Fetch a history of filled trades that this account has made + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An array of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.kraken.com/api/docs/futures-api/trading/get-history +- https://docs.kraken.com/api/docs/futures-api/history/get-public-execution-events + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| since | int | No | Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until | +| limit | int | No | Total number of trades, cannot exceed 100 | +| params | object | No | Exchange specific params | +| params.until | int | No | Timestamp in ms of latest trade | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.method | string | No | The method to use to fetch trades. Can be 'historyGetMarketSymbolExecutions' or 'publicGetHistory' default is 'historyGetMarketSymbolExecutions' | + + +```javascript +krakenfutures.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +Create an order on the exchange + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/send-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| type | string | Yes | 'limit' or 'market' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | number of contracts | +| price | float | No | limit order price | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.reduceOnly | bool | No | set as true if you wish the order to only reduce an existing position, any order which increases an existing position will be rejected, default is false | +| params.postOnly | bool | No | set as true if you wish to make a postOnly order, default is false | +| params.clientOrderId | string | No | UUID The order identity that is specified from the user, It must be globally unique | +| params.triggerPrice | float | No | the price that a stop order is triggered at | +| params.stopLossPrice | float | No | the price that a stop loss order is triggered at | +| params.takeProfitPrice | float | No | the price that a take profit order is triggered at | +| params.triggerSignal | string | No | for triggerPrice, stopLossPrice and takeProfitPrice orders, the trigger price type, 'last', 'mark' or 'index', default is 'last' | + + +```javascript +krakenfutures.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/send-batch-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +Edit an open order on the exchange + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/edit-order-spring + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | Not used by Krakenfutures | +| type | string | Yes | Not used by Krakenfutures | +| side | string | Yes | Not used by Krakenfutures | +| amount | float | Yes | Order size | +| price | float | No | Price to fill order at | +| params | object | No | Exchange specific params | + + +```javascript +krakenfutures.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +Cancel an open order on the exchange + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | Order id | +| symbol | string | Yes | Not used by Krakenfutures | +| params | object | No | Exchange specific params | + + +```javascript +krakenfutures.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/send-batch-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.clientOrderIds | Array<string> | No | max length 10 e.g. ["my_id_1","my_id_2"] | + + +```javascript +krakenfutures.cancelOrders (ids[, symbol, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +Cancels all orders on the exchange, including trigger orders + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: Response from exchange api + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/cancel-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | str | Yes | Unified market symbol | +| params | dict | No | Exchange specific params | + + +```javascript +krakenfutures.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - the api result + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/cancel-all-orders-after + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +Gets all open orders, including trigger orders, for an account from the exchange api + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An array of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified market symbol | +| since | int | No | Timestamp (ms) of earliest order. (Not used by kraken api but filtered internally by CCXT) | +| limit | int | No | How many orders to return. (Not used by kraken api but filtered internally by CCXT) | +| params | object | No | Exchange specific parameters | + + +```javascript +krakenfutures.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +Gets all closed orders, including trigger orders, for an account from the exchange api + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An array of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified market symbol | +| since | int | No | Timestamp (ms) of earliest order. | +| limit | int | No | How many orders to return. | +| params | object | No | Exchange specific parameters | + + +```javascript +krakenfutures.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +Gets all canceled orders, including trigger orders, for an account from the exchange api + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: An array of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/history/get-order-events + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified market symbol | +| since | int | No | Timestamp (ms) of earliest order. | +| limit | int | No | How many orders to return. | +| params | object | No | Exchange specific parameters | + + +```javascript +krakenfutures.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-fills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | *not used by the api* the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +krakenfutures.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: A [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-accounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | Exchange specific parameters | +| params.type | string | No | The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'flex' * | +| params.symbol | string | No | A unified market symbol, when assigned the balance for a trading market that matches the symbol is returned | + + +```javascript +krakenfutures.fetchBalance ([params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rates for multiple markets + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: Array<Order> - an array of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/historical-funding-rates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the api endpoint | + + +```javascript +krakenfutures.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +Fetches current contract trading positions + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: Parsed exchange response for positions + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-open-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | List of unified symbols | +| params | object | No | Not used by krakenfutures | + + +```javascript +krakenfutures.fetchPositions (symbols[, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.fetchLeverageTiers (symbols[, params]) +``` + + + + +### transferOut{docsify-ignore} +transfer from futures wallet to spot wallet + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | str | Yes | Unified currency code | +| amount | float | Yes | Size of the transfer | +| params | dict | No | Exchange specific parameters | + + +```javascript +krakenfutures.transferOut (code, amount[, params]) +``` + + + + +### transfer{docsify-ignore} +transfers currencies between sub-accounts + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://docs.kraken.com/api/docs/futures-api/trading/transfer +- https://docs.kraken.com/api/docs/futures-api/trading/sub-account-transfer + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | Unified currency code | +| amount | float | Yes | Size of the transfer | +| fromAccount | string | Yes | 'main'/'funding'/'future', 'flex', or a unified market symbol | +| toAccount | string | Yes | 'main'/'funding', 'flex', 'spot' or a unified market symbol | +| params | object | No | Exchange specific parameters | + + +```javascript +krakenfutures.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - response from the exchange + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/set-leverage-setting + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchLeverages{docsify-ignore} +fetch the set leverage for all contract and margin markets + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - a list of [leverage structures](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-leverage-setting + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | a list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.fetchLeverages ([symbols, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [krakenfutures](#krakenfutures) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://docs.kraken.com/api/docs/futures-api/trading/get-leverage-setting + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +krakenfutures.fetchLeverage (symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/kucoin.md b/docs/ccxt/wiki/exchanges/kucoin.md new file mode 100644 index 0000000..b0c3868 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/kucoin.md @@ -0,0 +1,1715 @@ + + + +## kucoin{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchStatus](#fetchstatus) +* [fetchMarkets](#fetchmarkets) +* [loadMigrationStatus](#loadmigrationstatus) +* [fetchCurrencies](#fetchcurrencies) +* [fetchAccounts](#fetchaccounts) +* [fetchTransactionFee](#fetchtransactionfee) +* [fetchDepositWithdrawFee](#fetchdepositwithdrawfee) +* [fetchTickers](#fetchtickers) +* [fetchMarkPrices](#fetchmarkprices) +* [fetchTicker](#fetchticker) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchOHLCV](#fetchohlcv) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [fetchOrderBook](#fetchorderbook) +* [createOrder](#createorder) +* [createMarketOrderWithCost](#createmarketorderwithcost) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrdersByStatus](#fetchordersbystatus) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [withdraw](#withdraw) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchBalance](#fetchbalance) +* [transfer](#transfer) +* [fetchLedger](#fetchledger) +* [fetchBorrowInterest](#fetchborrowinterest) +* [fetchBorrowRateHistories](#fetchborrowratehistories) +* [fetchBorrowRateHistory](#fetchborrowratehistory) +* [borrowCrossMargin](#borrowcrossmargin) +* [borrowIsolatedMargin](#borrowisolatedmargin) +* [repayCrossMargin](#repaycrossmargin) +* [repayIsolatedMargin](#repayisolatedmargin) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [setLeverage](#setleverage) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [watchOrderBook](#watchorderbook) +* [unWatchOrderBook](#unwatchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [unWatchOrderBookForSymbols](#unwatchorderbookforsymbols) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchBalance](#watchbalance) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.kucoin.com/#server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchTime ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://docs.kucoin.com/#service-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchStatus ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for kucoin + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://docs.kucoin.com/#get-symbols-list-deprecated +- https://docs.kucoin.com/#get-all-tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchMarkets ([params]) +``` + + + + +### loadMigrationStatus{docsify-ignore} +loads the migration status for the account (hf or not) + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: any - ignore + +**See**: https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-user-type + +| Param | Type | Description | +| --- | --- | --- | +| force | boolean | load account state for non hf | + + +```javascript +kucoin.loadMigrationStatus (force, [undefined]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.kucoin.com/#get-currencies + +| Param | Type | Description | +| --- | --- | --- | +| params | object | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchCurrencies (params, [undefined]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://docs.kucoin.com/#list-accounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchAccounts ([params]) +``` + + + + +### fetchTransactionFee{docsify-ignore} +*DEPRECATED* please use fetchDepositWithdrawFee instead + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.kucoin.com/#get-withdrawal-quotas + +| Param | Type | Description | +| --- | --- | --- | +| code | string | unified currency code | +| params | object | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchTransactionFee (code, params[]) +``` + + + + +### fetchDepositWithdrawFee{docsify-ignore} +fetch the fee for deposits and withdrawals + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.kucoin.com/#get-withdrawal-quotas + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency; you can query the chain through the response of the GET /api/v2/currencies/{currency} interface | + + +```javascript +kucoin.fetchDepositWithdrawFee (code[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.kucoin.com/#get-all-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchTickers (symbols[, params]) +``` + + + + +### fetchMarkPrices{docsify-ignore} +fetches the mark price for multiple markets + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchMarkPrices ([symbols, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.kucoin.com/#get-24hr-stats + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchTicker (symbol[, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches the mark price for a specific market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-mark-price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.kucoin.com/#get-klines + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoin.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.kucoin.com/docs/rest/funding/deposit/create-deposit-address-v3- + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the blockchain network name | + + +```javascript +kucoin.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.kucoin.com/#get-deposit-addresses-v2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the blockchain network name | + + +```javascript +kucoin.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an array of [address structures](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.kucoin.com/#get-deposit-addresses-v2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.kucoin.com/docs/rest/spot-trading/market-data/get-part-order-book-aggregated- +- https://www.kucoin.com/docs/rest/spot-trading/market-data/get-full-order-book-aggregated- + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +Create an order on the exchange + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.kucoin.com/spot#place-a-new-order +- https://docs.kucoin.com/spot#place-a-new-order-2 +- https://docs.kucoin.com/spot#place-a-margin-order +- https://docs.kucoin.com/spot-hf/#place-hf-order +- https://www.kucoin.com/docs/rest/spot-trading/orders/place-order-test +- https://www.kucoin.com/docs/rest/margin-trading/orders/place-margin-order-test +- https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-place-hf-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| type | string | Yes | 'limit' or 'market' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | the amount of currency to trade | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.marginMode | string | No | 'cross', // cross (cross mode) and isolated (isolated mode), set to cross by default, the isolated mode will be released soon, stay tuned | +| params.timeInForce | string | No | GTC, GTT, IOC, or FOK, default is GTC, limit orders only | +| params.postOnly | string | No | Post only flag, invalid when timeInForce is IOC or FOK EXCHANGE SPECIFIC PARAMETERS | +| params.clientOid | string | No | client order id, defaults to uuid if not passed | +| params.remark | string | No | remark for the order, length cannot exceed 100 utf8 characters | +| params.tradeType | string | No | 'TRADE', // TRADE, MARGIN_TRADE // not used with margin orders limit orders --------------------------------------------------- | +| params.cancelAfter | float | No | long, // cancel after n seconds, requires timeInForce to be GTT | +| params.hidden | bool | No | false, // Order will not be displayed in the order book | +| params.iceberg | bool | No | false, // Only a portion of the order is displayed in the order book | +| params.visibleSize | string | No | this.amountToPrecision (symbol, visibleSize), // The maximum visible size of an iceberg order market orders -------------------------------------------------- | +| params.funds | string | No | // Amount of quote currency to use stop orders ---------------------------------------------------- | +| params.stop | string | No | Either loss or entry, the default is loss. Requires triggerPrice to be defined margin orders -------------------------------------------------- | +| params.leverage | float | No | Leverage size of the order | +| params.stp | string | No | '', // self trade prevention, CN, CO, CB or DC | +| params.autoBorrow | bool | No | false, // The system will first borrow you funds at the optimal interest rate and then place an order for you | +| params.hf | bool | No | false, // true for hf order | +| params.test | bool | No | set to true to test an order, no order will be created but the request will be validated | +| params.sync | bool | No | set to true to use the hf sync call | + + +```javascript +kucoin.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createMarketOrderWithCost{docsify-ignore} +create a market order by providing the symbol, side and cost + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.createMarketOrderWithCost (symbol, side, cost[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.kucoin.com/docs/rest/spot-trading/orders/place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.kucoin.com/docs/rest/spot-trading/orders/place-multiple-orders +- https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/place-multiple-hf-orders +- https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-place-multiple-hf-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.hf | bool | No | false, // true for hf orders | +| params.sync | bool | No | false, // true to use the hf sync call | + + +```javascript +kucoin.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit an order, kucoin currently only supports the modification of HF orders + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kucoin.com/spot-hf/#modify-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | not used | +| side | string | Yes | not used | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | client order id, defaults to id if not passed | + + +```javascript +kucoin.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Response from the exchange + +**See** + +- https://docs.kucoin.com/spot#cancel-an-order +- https://docs.kucoin.com/spot#cancel-an-order-2 +- https://docs.kucoin.com/spot#cancel-single-order-by-clientoid +- https://docs.kucoin.com/spot#cancel-single-order-by-clientoid-2 +- https://docs.kucoin.com/spot-hf/#cancel-orders-by-orderid +- https://docs.kucoin.com/spot-hf/#cancel-order-by-clientoid +- https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-cancel-hf-order-by-orderid +- https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/sync-cancel-hf-order-by-clientoid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if cancelling a stop order | +| params.hf | bool | No | false, // true for hf order | +| params.sync | bool | No | false, // true to use the hf sync call | + + +```javascript +kucoin.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Response from the exchange + +**See** + +- https://docs.kucoin.com/spot#cancel-all-orders +- https://docs.kucoin.com/spot#cancel-orders +- https://docs.kucoin.com/spot-hf/#cancel-all-hf-orders-by-symbol + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | *invalid for isolated margin* true if cancelling all stop orders | +| params.marginMode | string | No | 'cross' or 'isolated' | +| params.orderIds | string | No | *stop orders only* Comma seperated order IDs | +| params.hf | bool | No | false, // true for hf order | + + +```javascript +kucoin.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrdersByStatus{docsify-ignore} +fetch a list of orders + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: An [array of order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.kucoin.com/spot#list-orders +- https://docs.kucoin.com/spot#list-stop-orders +- https://docs.kucoin.com/spot-hf/#obtain-list-of-active-hf-orders +- https://docs.kucoin.com/spot-hf/#obtain-list-of-filled-hf-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| status | string | Yes | *not used for stop orders* 'open' or 'closed' | +| symbol | string | Yes | unified market symbol | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | max number of orders to return | +| params | object | No | exchange specific params | +| params.until | int | No | end time in ms | +| params.side | string | No | buy or sell | +| params.type | string | No | limit, market, limit_stop or market_stop | +| params.tradeType | string | No | TRADE for spot trading, MARGIN_TRADE for Margin Trading | +| params.currentPage | int | No | *trigger orders only* current page | +| params.orderIds | string | No | *trigger orders only* comma seperated order ID list | +| params.trigger | bool | No | True if fetching a trigger order | +| params.hf | bool | No | false, // true for hf order | + + +```javascript +kucoin.fetchOrdersByStatus (status, symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.kucoin.com/spot#list-orders +- https://docs.kucoin.com/spot#list-stop-orders +- https://docs.kucoin.com/spot-hf/#obtain-list-of-active-hf-orders +- https://docs.kucoin.com/spot-hf/#obtain-list-of-filled-hf-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.side | string | No | buy or sell | +| params.type | string | No | limit, market, limit_stop or market_stop | +| params.tradeType | string | No | TRADE for spot trading, MARGIN_TRADE for Margin Trading | +| params.trigger | bool | No | True if fetching a trigger order | +| params.hf | bool | No | false, // true for hf order | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoin.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.kucoin.com/spot#list-orders +- https://docs.kucoin.com/spot#list-stop-orders +- https://docs.kucoin.com/spot-hf/#obtain-list-of-active-hf-orders +- https://docs.kucoin.com/spot-hf/#obtain-list-of-filled-hf-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.trigger | bool | No | true if fetching trigger orders | +| params.side | string | No | buy or sell | +| params.type | string | No | limit, market, limit_stop or market_stop | +| params.tradeType | string | No | TRADE for spot trading, MARGIN_TRADE for Margin Trading | +| params.currentPage | int | No | *trigger orders only* current page | +| params.orderIds | string | No | *trigger orders only* comma seperated order ID list | +| params.hf | bool | No | false, // true for hf order | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoin.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetch an order + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.kucoin.com/spot#get-an-order +- https://docs.kucoin.com/spot#get-single-active-order-by-clientoid +- https://docs.kucoin.com/spot#get-single-order-info +- https://docs.kucoin.com/spot#get-single-order-by-clientoid +- https://docs.kucoin.com/spot-hf/#details-of-a-single-hf-order +- https://docs.kucoin.com/spot-hf/#obtain-details-of-a-single-hf-order-using-clientoid + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | Order id | +| symbol | string | Yes | not sent to exchange except for trigger orders with clientOid, but used internally by CCXT to filter | +| params | object | No | exchange specific parameters | +| params.trigger | bool | No | true if fetching a trigger order | +| params.hf | bool | No | false, // true for hf order | +| params.clientOid | bool | No | unique order id created by users to identify their orders | + + +```javascript +kucoin.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.kucoin.com/#list-fills +- https://docs.kucoin.com/spot-hf/#transaction-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.kucoin.com/#list-fills +- https://docs.kucoin.com/spot-hf/#transaction-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.hf | bool | No | false, // true for hf order | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoin.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.kucoin.com/docs/rest/spot-trading/market-data/get-trade-histories + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.kucoin.com/docs/rest/funding/trade-fee/trading-pair-actual-fee-spot-margin-trade_hf + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchTradingFee (symbol[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.kucoin.com/docs/rest/funding/withdrawals/apply-withdraw-v3- + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-list +- https://www.kucoin.com/docs/rest/funding/deposit/get-v1-historical-deposits-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoin.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://www.kucoin.com/docs/rest/funding/withdrawals/get-withdrawals-list +- https://www.kucoin.com/docs/rest/funding/withdrawals/get-v1-historical-withdrawals-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoin.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.kucoin.com/docs/rest/account/basic-info/get-account-list-spot-margin-trade_hf +- https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-margin +- https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-isolated-margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | object | No | 'cross' or 'isolated', margin type for fetching margin balance | +| params.type | object | No | extra parameters specific to the exchange API endpoint | +| params.hf | object | No | *default if false* if true, the result includes the balance of the high frequency account | + + +```javascript +kucoin.fetchBalance ([params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://www.kucoin.com/docs/rest/funding/transfer/inner-transfer +- https://docs.kucoin.com/futures/#transfer-funds-to-kucoin-main-account-2 +- https://docs.kucoin.com/spot-hf/#internal-funds-transfers-in-high-frequency-trading-accounts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-spot-margin +- https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-trade_hf +- https://www.kucoin.com/docs/rest/account/basic-info/get-account-ledgers-margin_hf + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.hf | boolean | No | default false, when true will fetch ledger entries for the high frequency trading account | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoin.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See** + +- https://docs.kucoin.com/#get-repay-record +- https://docs.kucoin.com/#query-isolated-margin-account-info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| symbol | string | No | unified market symbol, required for isolated margin | +| since | int | No | the earliest time in ms to fetch borrrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' default is 'cross' | + + +```javascript +kucoin.fetchBorrowInterest ([code, symbol, since, limit, params]) +``` + + + + +### fetchBorrowRateHistories{docsify-ignore} +retrieves a history of a multiple currencies borrow interest rate at specific time slots, returns all currencies if no symbols passed, default is undefined + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a dictionary of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) indexed by the market symbol + +**See**: https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-cross-isolated-margin-interest-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| since | int | No | timestamp in ms of the earliest borrowRate, default is undefined | +| limit | int | No | max number of borrow rate prices to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' default is 'cross' | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +kucoin.fetchBorrowRateHistories (codes[, since, limit, params]) +``` + + + + +### fetchBorrowRateHistory{docsify-ignore} +retrieves a history of a currencies borrow interest rate at specific time slots + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - an array of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-cross-isolated-margin-interest-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | timestamp for the earliest borrow rate | +| limit | int | No | the maximum number of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' default is 'cross' | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +kucoin.fetchBorrowRateHistory (code[, since, limit, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.kucoin.com/#1-margin-borrowing + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoints | +| params.timeInForce | string | No | either IOC or FOK | + + +```javascript +kucoin.borrowCrossMargin (code, amount[, params]) +``` + + + + +### borrowIsolatedMargin{docsify-ignore} +create a loan to borrow margin + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.kucoin.com/#1-margin-borrowing + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, required for isolated margin | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoints | +| params.timeInForce | string | No | either IOC or FOK | + + +```javascript +kucoin.borrowIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.kucoin.com/#2-repayment + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoints | + + +```javascript +kucoin.repayCrossMargin (code, amount[, params]) +``` + + + + +### repayIsolatedMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.kucoin.com/#2-repayment + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoints | + + +```javascript +kucoin.repayIsolatedMargin (symbol, code, amount[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees - *IMPORTANT* use fetchDepositWithdrawFee to get more in-depth info + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.kucoin.com/#get-currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - response from the exchange + +**See**: https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/modify-leverage-multiplier + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | int | No | New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user's current debt leverage or greater than the system's maximum leverage | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.setLeverage ([leverage, symbol, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/market-snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/market-snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/snapshot' or '/market/ticker' default is '/market/ticker' | + + +```javascript +kucoin.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/klines + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/klines + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +unWatches trades stream + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.unWatchTradesForSymbols (symbols[, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unWatches trades stream + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.unWatchTrades (symbol[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2' | + + +```javascript +kucoin.watchOrderBook (symbol[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2' | + + +```javascript +kucoin.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2' | + + +```javascript +kucoin.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### unWatchOrderBookForSymbols{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders +- https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2' | + + +```javascript +kucoin.unWatchOrderBookForSymbols (symbols[, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.kucoin.com/docs/websocket/spot-trading/private-channels/private-order-change +- https://www.kucoin.com/docs/websocket/spot-trading/private-channels/stop-order-event + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | trigger orders are watched if true | + + +```javascript +kucoin.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/private-channels/private-order-change + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | '/spotMarket/tradeOrders' or '/spot/tradeFills' default is '/spotMarket/tradeOrders' | + + +```javascript +kucoin.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [kucoin](#kucoin) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.kucoin.com/docs/websocket/spot-trading/private-channels/account-balance-change + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoin.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/kucoinfutures.md b/docs/ccxt/wiki/exchanges/kucoinfutures.md new file mode 100644 index 0000000..319f84a --- /dev/null +++ b/docs/ccxt/wiki/exchanges/kucoinfutures.md @@ -0,0 +1,1351 @@ + + + +## kucoinfutures{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchMarkets](#fetchmarkets) +* [fetchTime](#fetchtime) +* [fetchOHLCV](#fetchohlcv) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchTickers](#fetchtickers) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchPositionsHistory](#fetchpositionshistory) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [addMargin](#addmargin) +* [fetchOrdersByStatus](#fetchordersbystatus) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrder](#fetchorder) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchBalance](#fetchbalance) +* [transfer](#transfer) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [closePosition](#closeposition) +* [fetchTradingFee](#fetchtradingfee) +* [fetchMarginMode](#fetchmarginmode) +* [setMarginMode](#setmarginmode) +* [setPositionMode](#setpositionmode) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchPosition](#watchposition) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [unWatchOrderBook](#unwatchorderbook) +* [unWatchOrderBookForSymbols](#unwatchorderbookforsymbols) +* [watchOrders](#watchorders) +* [watchBalance](#watchbalance) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-service-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchStatus ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for kucoinfutures + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange api endpoint | + + +```javascript +kucoinfutures.fetchMarkets ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchTime ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-klines + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoinfutures.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.kucoin.com/docs/rest/funding/deposit/get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchDepositAddress (code[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-part-order-book-level-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchTicker (symbol[, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-current-mark-price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | the method to use, futuresPublicGetAllTickers or futuresPublicGetContractsActive | + + +```javascript +kucoinfutures.fetchTickers ([symbols, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchBidsAsks ([symbols, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-funding-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.kucoin.com/futures/#get-position-details + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.kucoin.com/futures/#get-position-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchPositions (symbols[, params]) +``` + + + + +### fetchPositionsHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/positions/get-positions-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch position history for | +| limit | int | No | the maximum number of entries to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | closing end time | +| params.pageId | int | No | page id | + + +```javascript +kucoinfutures.fetchPositionsHistory ([symbols, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +Create an order on the exchange + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.kucoin.com/docs/rest/futures-trading/orders/place-order +- https://www.kucoin.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| type | string | Yes | 'limit' or 'market' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | the amount of currency to trade | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered and the triggerPriceType | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered and the triggerPriceType | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.stopLossPrice | float | No | price to trigger stop-loss orders | +| params.takeProfitPrice | float | No | price to trigger take-profit orders | +| params.reduceOnly | bool | No | A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true. | +| params.timeInForce | string | No | GTC, GTT, IOC, or FOK, default is GTC, limit orders only | +| params.postOnly | string | No | Post only flag, invalid when timeInForce is IOC or FOK | +| params.cost | float | No | the cost of the order in units of USDT | +| params.marginMode | string | No | 'cross' or 'isolated', default is 'isolated' | +| params.hedged | bool | No | *swap and future only* true for hedged mode, false for one way mode, default is false ----------------- Exchange Specific Parameters ----------------- | +| params.leverage | float | No | Leverage size of the order (mandatory param in request, default is 1) | +| params.clientOid | string | No | client order id, defaults to uuid if not passed | +| params.remark | string | No | remark for the order, length cannot exceed 100 utf8 characters | +| params.stop | string | No | 'up' or 'down', the direction the triggerPrice is triggered from, requires triggerPrice. down: Triggers when the price reaches or goes below the triggerPrice. up: Triggers when the price reaches or goes above the triggerPrice. | +| params.triggerPriceType | string | No | "last", "mark", "index" - defaults to "mark" | +| params.stopPriceType | string | No | exchange-specific alternative for triggerPriceType: TP, IP or MP | +| params.closeOrder | bool | No | set to true to close position | +| params.test | bool | No | set to true to use the test order endpoint (does not submit order, use to validate params) | +| params.forceHold | bool | No | A mark to forcely hold the funds for an order, even though it's an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default.\ | +| params.positionSide | string | No | *swap and future only* hedged two-way position side, LONG or SHORT | + + +```javascript +kucoinfutures.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/orders/place-multiple-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.createOrders (orders[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-futures-order-by-orderid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | cancel order by client order id | + + +```javascript +kucoinfutures.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/orders/batch-cancel-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderIds | Array<string> | No | client order ids | + + +```javascript +kucoinfutures.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Response from the exchange + +**See** + +- https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-limit-orders +- https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-multiple-futures-stop-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | object | No | When true, all the trigger orders will be cancelled | + + +```javascript +kucoinfutures.cancelAllOrders (symbol[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/positions/add-margin-manually + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.addMargin (symbol, amount[, params]) +``` + + + + +### fetchOrdersByStatus{docsify-ignore} +fetches a list of orders placed on the exchange + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: An [array of order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.kucoin.com/futures/#get-order-list +- https://docs.kucoin.com/futures/#get-untriggered-stop-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| status | string | Yes | 'active' or 'closed', only 'active' is valid for stop orders | +| symbol | string | Yes | unified symbol for the market to retrieve orders from | +| since | int | No | timestamp in ms of the earliest order to retrieve | +| limit | int | No | The maximum number of orders to retrieve | +| params | object | No | exchange specific parameters | +| params.trigger | bool | No | set to true to retrieve untriggered stop orders | +| params.until | int | No | End time in ms | +| params.side | string | No | buy or sell | +| params.type | string | No | limit or market | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoinfutures.fetchOrdersByStatus (status, symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kucoin.com/futures/#get-order-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.side | string | No | buy or sell | +| params.type | string | No | limit, or market | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoinfutures.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple open orders made by the user + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.kucoin.com/futures/#get-order-list +- https://docs.kucoin.com/futures/#get-untriggered-stop-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | +| params.side | string | No | buy or sell | +| params.type | string | No | limit, or market | +| params.trigger | boolean | No | set to true to retrieve untriggered stop orders | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoinfutures.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kucoin.com/futures/#get-details-of-a-single-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-futures + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.code | object | No | the unified currency code to fetch the balance for, if not provided, the default .options['fetchBalance']['code'] will be used | + + +```javascript +kucoinfutures.fetchBalance ([params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-main-or-trade-account +- https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-futures-account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.kucoin.com/futures/#get-fills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | End time in ms | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +kucoinfutures.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-transaction-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/risk-limit/get-futures-risk-limit-level + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchMarketLeverageTiers (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-public-funding-history#request-url + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | not used by kucuoinfutures | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | + + +```javascript +kucoinfutures.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### closePosition{docsify-ignore} +closes open positions for a market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - [A list of position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/orders/place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | Yes | not used by kucoinfutures closePositions | +| params | object | No | extra parameters specific to the okx api endpoint | +| params.clientOrderId | string | No | client order id of the order | + + +```javascript +kucoinfutures.closePosition (symbol, side[, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.kucoin.com/docs/rest/funding/trade-fee/trading-pair-actual-fee-futures + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of a trading pair + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/positions/get-margin-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the margin mode for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchMarginMode (symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - response from the exchange + +**See**: https://www.kucoin.com/docs/rest/futures-trading/positions/modify-margin-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a response from the exchange + +**See**: https://www.kucoin.com/docs-new/3475097e0 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use two way position | +| symbol | string | No | not used by bybit setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.setPositionMode (hedged[, symbol, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://www.kucoin.com/docs/rest/futures-trading/positions/get-cross-margin-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - response from the exchange + +**See**: https://www.kucoin.com/docs/rest/futures-trading/positions/modify-cross-margin-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.setLeverage (leverage, symbol[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/websocket/futures-trading/public-channels/get-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.kucoin.com/docs/websocket/futures-trading/public-channels/get-ticker-v2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchBidsAsks (symbols[, params]) +``` + + + + +### watchPosition{docsify-ignore} +watch open positions for a specific symbol + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://docs.kucoin.com/futures/#position-change-events + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string, undefined | unified market symbol | +| params | object | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchPosition (symbol, params[]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.kucoin.com/futures/#execution-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unWatches trades stream + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.kucoin.com/futures/#execution-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.unWatchTrades (symbol[, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.unWatchTradesForSymbols (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.kucoin.com/docs/websocket/futures-trading/public-channels/klines + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + 1. After receiving the websocket Level 2 data flow, cache the data. + 2. Initiate a REST request to get the snapshot data of Level 2 order book. + 3. Playback the cached Level 2 data flow. + 4. Apply the new Level 2 data flow to the local snapshot to ensure that the sequence of the new Level 2 update lines up with the sequence of the previous Level 2 data. Discard all the message prior to that sequence, and then playback the change to snapshot. + 5. Update the level2 full data based on sequence according to the size. If the price is 0, ignore the messages and update the sequence. If the size=0, update the sequence and remove the price of which the size is 0 out of level 2. For other cases, please update the price. + 6. If the sequence of the newly pushed message does not line up to the sequence of the last message, you could pull through REST Level 2 message request to get the updated messages. Please note that the difference between the start and end parameters cannot exceed 500. + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.kucoin.com/futures/#level-2-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.kucoin.com/futures/#level-2-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.kucoin.com/futures/#level-2-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.unWatchOrderBook (symbol[, params]) +``` + + + + +### unWatchOrderBookForSymbols{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.unWatchOrderBookForSymbols (symbols[, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.kucoin.com/futures/#trade-orders-according-to-the-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [kucoinfutures](#kucoinfutures) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.kucoin.com/futures/#account-balance-events + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +kucoinfutures.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/latoken.md b/docs/ccxt/wiki/exchanges/latoken.md new file mode 100644 index 0000000..c4e7236 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/latoken.md @@ -0,0 +1,491 @@ + + + +## latoken{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchMyTrades](#fetchmytrades) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrders](#fetchorders) +* [fetchOrder](#fetchorder) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchTransactions](#fetchtransactions) +* [fetchTransfers](#fetchtransfers) +* [transfer](#transfer) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [latoken](#latoken) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://api.latoken.com/doc/v2/#tag/Time/operation/currentTime + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for latoken + +**Kind**: instance method of [latoken](#latoken) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://api.latoken.com/doc/v2/#tag/Pair/operation/getActivePairs + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchCurrencies ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://api.latoken.com/doc/v2/#tag/Account/operation/getBalancesByUser + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api.latoken.com/doc/v2/#tag/Order-Book/operation/getOrderBook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.latoken.com/doc/v2/#tag/Ticker/operation/getTicker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.latoken.com/doc/v2/#tag/Ticker/operation/getAllTickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [latoken](#latoken) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByPair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Trade/operation/getFeeByPair +- https://api.latoken.com/doc/v2/#tag/Trade/operation/getAuthFeeByPair + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [latoken](#latoken) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByTrader +- https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByAssetAndTrader + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [latoken](#latoken) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrdersByPair +- https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyActiveStopOrdersByPair // stop + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if fetching trigger orders | + + +```javascript +latoken.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [latoken](#latoken) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrders +- https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrdersByPair +- https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrders // stop +- https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrdersByPair // stop + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if fetching trigger orders | + + +```javascript +latoken.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Order/operation/getOrderById +- https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getStopOrderById + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | not used by latoken fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if fetching a trigger order | + + +```javascript +latoken.fetchOrder (id[, symbol, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Order/operation/placeOrder +- https://api.latoken.com/doc/v2/#tag/StopOrder/operation/placeStopOrder // stop + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at EXCHANGE SPECIFIC PARAMETERS | +| params.condition | string | No | "GTC", "IOC", or "FOK" | +| params.clientOrderId | string | No | [ 0 .. 50 ] characters, client's custom order id (free field for your convenience) | + + +```javascript +latoken.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Order/operation/cancelOrder +- https://api.latoken.com/doc/v2/#tag/StopOrder/operation/cancelStopOrder // stop + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by latoken cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if cancelling a trigger order | + + +```javascript +latoken.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [latoken](#latoken) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrders +- https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrdersByPair + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if cancelling trigger orders | + + +```javascript +latoken.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchTransactions{docsify-ignore} +`DEPRECATED` + +use fetchDepositsWithdrawals instead + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api.latoken.com/doc/v2/#tag/Transaction/operation/getUserTransactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code for the currency of the transactions, default is undefined | +| since | int | No | timestamp in ms of the earliest transaction, default is undefined | +| limit | int | No | max number of transactions to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchTransactions (code[, since, limit, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [latoken](#latoken) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://api.latoken.com/doc/v2/#tag/Transfer/operation/getUsersTransfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.fetchTransfers (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [latoken](#latoken) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferByEmail +- https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferById +- https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferByPhone + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +latoken.transfer (code, amount, fromAccount, toAccount[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/lbank.md b/docs/ccxt/wiki/exchanges/lbank.md new file mode 100644 index 0000000..2b58a0c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/lbank.md @@ -0,0 +1,900 @@ + + + +## lbank{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchBalance](#fetchbalance) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchOHLCVWs](#fetchohlcvws) +* [watchOHLCV](#watchohlcv) +* [fetchTickerWs](#fetchtickerws) +* [watchTicker](#watchticker) +* [fetchTradesWs](#fetchtradesws) +* [watchTrades](#watchtrades) +* [watchOrders](#watchorders) +* [watchBalance](#watchbalance) +* [fetchOrderBookWs](#fetchorderbookws) +* [watchOrderBook](#watchorderbook) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [lbank](#lbank) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See** + +- https://www.lbank.com/en-US/docs/index.html#get-timestamp +- https://www.lbank.com/en-US/docs/contract.html#get-the-current-time + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [lbank](#lbank) +**Returns**: dict - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | dict | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for lbank + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://www.lbank.com/en-US/docs/index.html#trading-pairs +- https://www.lbank.com/en-US/docs/contract.html#query-contract-information-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new +- https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTickers (symbols[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.lbank.com/en-US/docs/index.html#query-market-depth +- https://www.lbank.com/en-US/docs/contract.html#get-handicap + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#query-historical-transactions +- https://www.lbank.com/en-US/docs/index.html#recent-transactions-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.lbank.com/en-US/docs/index.html#query-k-bar-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a dictionary of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#asset-information +- https://www.lbank.com/en-US/docs/index.html#account-information +- https://www.lbank.com/en-US/docs/index.html#get-all-coins-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchBalance ([params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTradingFees ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#place-order +- https://www.lbank.com/en-US/docs/index.html#place-an-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#place-order +- https://www.lbank.com/en-US/docs/index.html#place-an-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#query-order +- https://www.lbank.com/en-US/docs/index.html#query-order-new + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#past-transaction-details + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#query-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#current-pending-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#cancel-order-new + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#cancel-all-pending-orders-for-a-single-trading-pair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#get-deposit-address +- https://www.lbank.com/en-US/docs/index.html#the-user-obtains-the-deposit-address + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#get-recharge-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#get-withdrawal-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFees instead + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | not used by lbank fetchTransactionFees () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +when using private endpoint, only returns information for currencies with non-zero balance, use public method by specifying this.options['fetchDepositWithdrawFees']['method'] = 'fetchPublicDepositWithdrawFees' + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://www.lbank.com/en-US/docs/index.html#get-all-coins-information +- https://www.lbank.com/en-US/docs/index.html#withdrawal-configurations + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string> | No | array of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchDepositWithdrawFees ([codes, params]) +``` + + + + +### fetchOHLCVWs{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.lbank.com/en-US/docs/index.html#request-amp-subscription-instruction + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchOHLCVWs (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.lbank.com/en-US/docs/index.html#subscription-of-k-line-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTickerWs{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#request-amp-subscription-instruction + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the cex api endpoint | + + +```javascript +lbank.fetchTickerWs (symbol[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/en/latest/manual.html#ticker-structure) + +**See**: https://www.lbank.com/en-US/docs/index.html#market + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified symbol of the market to fetch the ticker for | +| params | object | extra parameters specific to the lbank api endpoint | + + +```javascript +lbank.watchTicker (symbol, params[]) +``` + + + + +### fetchTradesWs{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.lbank.com/en-US/docs/index.html#request-amp-subscription-instruction + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.fetchTradesWs (symbol[, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.lbank.com/en-US/docs/index.html#trade-record + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +get the list of trades associated with the user + +**Kind**: instance method of [lbank](#lbank) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.lbank.com/en-US/docs/index.html#update-subscribed-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | Yes | extra parameters specific to the lbank api endpoint | + + +```javascript +lbank.watchOrders ([symbol, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.lbank.com/docs/index.html#update-subscribed-asset + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +lbank.watchBalance ([params]) +``` + + + + +### fetchOrderBookWs{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/en/latest/manual.html#order-book-structure) indexed by market symbols + +**See**: https://www.lbank.com/en-US/docs/index.html#request-amp-subscription-instruction + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified symbol of the market to fetch the order book for | +| limit | int, undefined | the maximum amount of order book entries to return | +| params | object | extra parameters specific to the lbank api endpoint | + + +```javascript +lbank.fetchOrderBookWs (symbol, limit, params[]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [lbank](#lbank) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/en/latest/manual.html#order-book-structure) indexed by market symbols + +**See**: https://www.lbank.com/en-US/docs/index.html#market-depth + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified symbol of the market to fetch the order book for | +| limit | int, undefined | the maximum amount of order book entries to return | +| params | object | extra parameters specific to the lbank api endpoint | + + +```javascript +lbank.watchOrderBook (symbol, limit, params[]) +``` + diff --git a/docs/ccxt/wiki/exchanges/luno.md b/docs/ccxt/wiki/exchanges/luno.md new file mode 100644 index 0000000..06c0c2c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/luno.md @@ -0,0 +1,522 @@ + + + +## luno{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchAccounts](#fetchaccounts) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchMyTrades](#fetchmytrades) +* [fetchTradingFee](#fetchtradingfee) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchLedger](#fetchledger) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [watchTrades](#watchtrades) +* [watchOrderBook](#watchorderbook) + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [luno](#luno) +**Returns**: dict - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | dict | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for luno + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://www.luno.com/en/developers/api#tag/Market/operation/Markets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchMarkets ([params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [luno](#luno) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://www.luno.com/en/developers/api#tag/Accounts/operation/getBalances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchAccounts ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [luno](#luno) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Accounts/operation/getBalances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [luno](#luno) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.luno.com/en/developers/api#tag/Market/operation/GetOrderBookFull +- https://www.luno.com/en/developers/api#tag/Market/operation/GetOrderBook + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [luno](#luno) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Orders/operation/GetOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by luno fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Orders/operation/ListOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Orders/operation/ListOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Orders/operation/ListOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [luno](#luno) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Market/operation/GetTickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [luno](#luno) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Market/operation/GetTicker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.luno.com/en/developers/api#tag/Market/operation/ListTrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.luno.com/en/developers/api#tag/Market/operation/GetCandles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | Yes | extra parameters specific to the luno api endpoint | + + +```javascript +luno.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Orders/operation/ListUserTrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [luno](#luno) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Orders/operation/getFeeInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchTradingFee (symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [luno](#luno) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.luno.com/en/developers/api#tag/Orders/operation/PostMarketOrder +- https://www.luno.com/en/developers/api#tag/Orders/operation/PostLimitOrder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [luno](#luno) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Orders/operation/StopOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [luno](#luno) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://www.luno.com/en/developers/api#tag/Accounts/operation/ListTransactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.fetchLedger ([code, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [luno](#luno) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Receive/operation/createFundingAddress + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.name | string | No | an optional name for the new address | +| params.account_id | int | No | an optional account id for the new address | + + +```javascript +luno.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [luno](#luno) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.luno.com/en/developers/api#tag/Receive/operation/getFundingAddress + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.address | string | No | a specific cryptocurrency address to retrieve | + + +```javascript +luno.fetchDepositAddress (code[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [luno](#luno) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.luno.com/en/developers/api#tag/Streaming-API + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +luno.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [luno](#luno) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | objectConstructor | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | accepts l2 or l3 for level 2 or level 3 order book | + + +```javascript +luno.watchOrderBook (symbol[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/mercado.md b/docs/ccxt/wiki/exchanges/mercado.md new file mode 100644 index 0000000..86242f5 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/mercado.md @@ -0,0 +1,299 @@ + + + +## mercado{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [withdraw](#withdraw) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for mercado + +**Kind**: instance method of [mercado](#mercado) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [mercado](#mercado) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [mercado](#mercado) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [mercado](#mercado) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [mercado](#mercado) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [mercado](#mercado) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [mercado](#mercado) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [mercado](#mercado) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchOrder (id, symbol[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [mercado](#mercado) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [mercado](#mercado) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [mercado](#mercado) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [mercado](#mercado) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [mercado](#mercado) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mercado.fetchMyTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/mexc.md b/docs/ccxt/wiki/exchanges/mexc.md new file mode 100644 index 0000000..75e987c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/mexc.md @@ -0,0 +1,1717 @@ + + + +## mexc{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchBidsAsks](#fetchbidsasks) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchAccounts](#fetchaccounts) +* [fetchTradingFee](#fetchtradingfee) +* [fetchBalance](#fetchbalance) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderTrades](#fetchordertrades) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [setLeverage](#setleverage) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchTransfer](#fetchtransfer) +* [fetchTransfers](#fetchtransfers) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [setPositionMode](#setpositionmode) +* [fetchPositionMode](#fetchpositionmode) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchLeverage](#fetchleverage) +* [fetchPositionsHistory](#fetchpositionshistory) +* [setMarginMode](#setmarginmode) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchOrders](#watchorders) +* [watchBalance](#watchbalance) +* [unWatchTicker](#unwatchticker) +* [unWatchTickers](#unwatchtickers) +* [unWatchBidsAsks](#unwatchbidsasks) +* [unWatchOHLCV](#unwatchohlcv) +* [unWatchOrderBook](#unwatchorderbook) +* [unWatchTrades](#unwatchtrades) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#test-connectivity +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-server-time + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [mexc](#mexc) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#check-server-time +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-server-time + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an associative dictionary of currencies + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for mexc + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#exchange-information +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#order-book +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-s-depth-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#recent-trades-list +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#compressed-aggregate-trades-list +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-transaction-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | *spot only* *since must be defined* the latest time in ms to fetch entries for | + + +```javascript +mexc.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#kline-candlestick-data +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#k-line-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +mexc.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#24hr-ticker-price-change-statistics +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-trend-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#24hr-ticker-price-change-statistics +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-trend-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchTicker (symbol[, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#symbol-order-book-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchBidsAsks (symbols[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | only 'isolated' is supported for spot-margin trading | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.postOnly | bool | No | if true, the order will only be posted if it will be a maker order | +| params.reduceOnly | bool | No | *contract only* indicates if this order is to reduce the size of a position | +| params.hedged | bool | No | *swap only* true for hedged mode, false for one way mode, default is false | +| params.timeInForce | string | No | 'IOC' or 'FOK', default is 'GTC' EXCHANGE SPECIFIC PARAMETERS | +| params.leverage | int | No | *contract only* leverage is necessary on isolated margin | +| params.positionId | long | No | *contract only* it is recommended to fill in this parameter when closing a position | +| params.externalOid | string | No | *contract only* external order ID | +| params.positionMode | int | No | *contract only* 1:hedge, 2:one-way, default: the user's current config | +| params.test | boolean | No | *spot only* whether to use the test endpoint or not, default is false | + + +```javascript +mexc.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +*spot only* *all orders must have the same symbol* create a list of trade orders + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#batch-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to api endpoint | + + +```javascript +mexc.createOrders (orders[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-order +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#query-the-order-based-on-the-order-number + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | only 'isolated' is supported, for spot-margin trading | + + +```javascript +mexc.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#all-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-of-the-user-39-s-historical-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#gets-the-trigger-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for | +| params.marginMode | string | No | only 'isolated' is supported, for spot-margin trading | + + +```javascript +mexc.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#current-open-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-of-the-user-39-s-historical-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#gets-the-trigger-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | only 'isolated' is supported, for spot-margin trading | + + +```javascript +mexc.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#all-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-of-the-user-39-s-historical-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#gets-the-trigger-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#all-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-of-the-user-39-s-historical-orders +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#gets-the-trigger-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#cancel-order +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-stop-limit-trigger-order-under-maintenance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | only 'isolated' is supported for spot-margin trading | + + +```javascript +mexc.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#cancel-all-open-orders-on-a-symbol +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-all-orders-under-a-contract-under-maintenance +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-all-trigger-orders-under-maintenance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | only 'isolated' is supported for spot-margin trading | + + +```javascript +mexc.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchAccounts ([params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-mx-deduct-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#isolated-account + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbols | string | No | // required for margin, market id's separated by commas | + + +```javascript +mexc.fetchBalance ([params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-transaction-details-of-the-user-s-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | + + +```javascript +mexc.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#query-the-order-based-on-the-order-number + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#increase-or-decrease-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#increase-or-decrease-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.addMargin (symbol, amount[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - response from the exchange + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#switch-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-details-of-user-s-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | not used by mexc, but filtered internally by ccxt | +| limit | int | No | mexc limit is page_size default 20, maximum is 100 | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes, if a market has a leverage tier of 0, then the leverage tiers cannot be obtained for this market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchLeverageTiers ([symbols, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#deposit-address-supporting-network + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#generate-deposit-address-supporting-network + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the blockchain network name | + + +```javascript +mexc.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#deposit-address-supporting-network + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the chain of currency, this only apply for multi-chain currency, and there is no need for single chain currency | + + +```javascript +mexc.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#deposit-history-supporting-network + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-history-supporting-network + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchPositions (symbols[, params]) +``` + + + + +### fetchTransfer{docsify-ignore} +fetches a transfer + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v2_en/#internal-assets-transfer-order-inquiry + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | transfer id | +| code | string | No | not used by mexc fetchTransfer | +| params | object | Yes | extra parameters specific to the exchange api endpoint | + + +```javascript +mexc.fetchTransfer (id[, code, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records +- https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#query-user-universal-transfer-history * @param {string} code unified currency code of the currency transferred + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | | Yes | | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.fromAccountType | string | No | 'SPOT' for spot wallet, 'FUTURES' for contract wallet | +| params.toAccountType | string | No | 'SPOT' for spot wallet, 'FUTURES' for contract wallet | + + +```javascript +mexc.fetchTransfers (code[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#user-universal-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.symbol | string | No | market symbol required for margin account transfers eg:BTCUSDT | + + +```javascript +mexc.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-new +- https://www.mexc.com/api-docs/spot-v3/wallet-endpoints#internal-transfer + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.internal | object | No | false by default, set to true for an "internal transfer" | +| params.toAccountType | object | No | skipped by default, set to 'EMAIL|UID|MOBILE' when making an "internal transfer" | + + +```javascript +mexc.withdraw (code, amount, address, tag[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - response from the exchange + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#change-position-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by mexc setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-position-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | not used by mexc fetchPositionMode | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchPositionMode (symbol[, params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +fetch deposit and withdrawal fees + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | returns fees for all currencies if undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdrawal fees + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-the-currency-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | returns fees for all currencies if undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.fetchLeverage (symbol[, params]) +``` + + + + +### fetchPositionsHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified contract symbols | +| since | int | No | not used by mexc fetchPositionsHistory | +| limit | int | No | the maximum amount of candles to fetch, default=1000 | +| params | object | No | extra parameters specific to the exchange api endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.type | int | No | position type,1: long, 2: short | +| params.page_num | int | No | current page number, default is 1 | + + +```javascript +mexc.fetchPositionsHistory ([symbols, since, limit, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - response from the exchange + +**See**: https://mexcdevelop.github.io/apidocs/contract_v1_en/#switch-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | No | required when there is no position, else provide params["positionId"] | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.positionId | string | No | required when a position is set | +| params.direction | string | No | "long" or "short" required when there is no position | + + +```javascript +mexc.setMarginMode (marginMode[, symbol, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#miniticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.miniTicker | boolean | No | set to true for using the miniTicker endpoint | + + +```javascript +mexc.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#minitickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.miniTicker | boolean | No | set to true for using the miniTicker endpoint | + + +```javascript +mexc.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://mexcdevelop.github.io/apidocs/spot_v3_en/#individual-symbol-book-ticker-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.mexc.com/api-docs/spot-v3/websocket-market-streams#trade-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://www.mexc.com/api-docs/spot-v3/websocket-market-streams#trade-streams +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.frequency | string | No | the frequency of the order book updates, default is '10ms', can be '100ms' or '10ms | + + +```javascript +mexc.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.mexc.com/api-docs/spot-v3/websocket-market-streams#trade-streams +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#public-channels + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.mexc.com/api-docs/spot-v3/websocket-user-data-streams#spot-account-deals +- https://mexcdevelop.github.io/apidocs/contract_v1_en/#private-channels + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.mexc.com/api-docs/spot-v3/websocket-user-data-streams#spot-account-orders +- https://mexcdevelop.github.io/apidocs/spot_v3_en/#margin-account-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string, undefined | Yes | the type of orders to retrieve, can be 'spot' or 'margin' | + + +```javascript +mexc.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.mexc.com/api-docs/spot-v3/websocket-user-data-streams#spot-account-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.watchBalance ([params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.unWatchTicker (symbol[, params]) +``` + + + + +### unWatchTickers{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.unWatchTickers (symbols[, params]) +``` + + + + +### unWatchBidsAsks{docsify-ignore} +unWatches best bid & ask for symbols + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +mexc.unWatchBidsAsks (symbols[, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timezone | object | No | if provided, kline intervals are interpreted in that timezone instead of UTC, example '+08:00' | + + +```javascript +mexc.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [mexc](#mexc) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.frequency | string | No | the frequency of the order book updates, default is '10ms', can be '100ms' or '10ms | + + +```javascript +mexc.unWatchOrderBook (symbol[, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unsubscribes from the trades channel + +**Kind**: instance method of [mexc](#mexc) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.name | string | No | the name of the method to call, 'trade' or 'aggTrade', default is 'trade' | + + +```javascript +mexc.unWatchTrades (symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/modetrade.md b/docs/ccxt/wiki/exchanges/modetrade.md new file mode 100644 index 0000000..875b1bb --- /dev/null +++ b/docs/ccxt/wiki/exchanges/modetrade.md @@ -0,0 +1,1134 @@ + + + +## modetrade{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTrades](#fetchtrades) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchBalance](#fetchbalance) +* [fetchLedger](#fetchledger) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [withdraw](#withdraw) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [watchOrderBook](#watchorderbook) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [watchTrades](#watchtrades) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchPositions](#watchpositions) +* [watchBalance](#watchbalance) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for modetrade + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-available-symbols + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - an associative dictionary of currencies + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-token-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchCurrencies ([params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-market-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rate for multiple markets + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - an array of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-funding-rate-history-for-one-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +modetrade.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/private/get-funding-fee-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +modetrade.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchTradingFees ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/orderbook-snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-kline + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms))) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.algoType | float | No | 'STOP'or 'TP_SL' or 'POSITIONAL_TP_SL' | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +modetrade.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +*contract only* create a list of trade orders + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.stopLossPrice | float | No | price to trigger stop-loss orders | +| params.takeProfitPrice | float | No | price to trigger take-profit orders | + + +```javascript +modetrade.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order-by-client_order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order-by-client_order_id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +modetrade.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders-by-client_order_id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.client_order_ids | Array<string> | No | max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma | + + +```javascript +modetrade.cancelOrders (ids[, symbol, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-all-pending-algo-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-orders-in-bulk + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | + + +```javascript +modetrade.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-client_order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +modetrade.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.is_triggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | +| params.until | int | Yes | timestamp in ms of the latest order to fetch | + + +```javascript +modetrade.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.is_triggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.until | int | Yes | timestamp in ms of the latest order to fetch | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +modetrade.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.is_triggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.until | int | Yes | timestamp in ms of the latest order to fetch | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +modetrade.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-trades-of-specific-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | set to true if you want to fetch trades with pagination | +| params.until | int | Yes | timestamp in ms of the latest trade to fetch | + + +```javascript +modetrade.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-current-holding + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchBalance ([params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - response from the exchange + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | int | No | the rate of leverage | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.setLeverage ([leverage, symbol, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-one-position-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-positions-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.fetchPositions ([symbols, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/24-hour-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/24-hour-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/bbos + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/k-line + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/execution-report +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/algo-execution-report + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if trigger order | + + +```javascript +modetrade.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/execution-report +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/algo-execution-report + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if trigger order | + + +```javascript +modetrade.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/position-push + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| since | | Yes | timestamp in ms of the earliest position to fetch | +| limit | | Yes | the maximum number of positions to fetch | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchPositions ([symbols, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [modetrade](#modetrade) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +modetrade.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/ndax.md b/docs/ccxt/wiki/exchanges/ndax.md new file mode 100644 index 0000000..137e928 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/ndax.md @@ -0,0 +1,631 @@ + + + +## ndax{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [signIn](#signin) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [fetchAccounts](#fetchaccounts) +* [fetchBalance](#fetchbalance) +* [fetchLedger](#fetchledger) +* [createOrder](#createorder) +* [fetchMyTrades](#fetchmytrades) +* [cancelAllOrders](#cancelallorders) +* [cancelOrder](#cancelorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrders](#fetchorders) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [createDepositAddress](#createdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [watchTicker](#watchticker) +* [watchTrades](#watchtrades) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) + + + +### signIn{docsify-ignore} +sign in, must be called prior to using other authenticated methods + +**Kind**: instance method of [ndax](#ndax) +**Returns**: response from exchange + +**See**: https://apidoc.ndax.io/#authenticate2fa + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.signIn ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - an associative dictionary of currencies + +**See**: https://apidoc.ndax.io/#getproduct + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for ndax + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://apidoc.ndax.io/#getinstruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://apidoc.ndax.io/#getl2snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://apidoc.ndax.io/#getlevel1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchTicker (symbol[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://apidoc.ndax.io/#gettickerhistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://apidoc.ndax.io/#getuseraccounts + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchAccounts ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://apidoc.ndax.io/#getaccountpositions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchBalance ([params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://apidoc.ndax.io/#getaccounttransactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchLedger ([code, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidoc.ndax.io/#sendorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order would be triggered | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +ndax.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://apidoc.ndax.io/#gettradeshistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidoc.ndax.io/#cancelallorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidoc.ndax.io/#cancelorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +ndax.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidoc.ndax.io/#getopenorders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidoc.ndax.io/#getorderhistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://apidoc.ndax.io/#getorderstatus + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://apidoc.ndax.io/#getorderhistorybyorderid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchDepositAddress (code[, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.createDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://apidoc.ndax.io/#getdeposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | not used by ndax fetchDeposits | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://apidoc.ndax.io/#getwithdraws + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.withdraw (code, amount, address, tag[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://apidoc.ndax.io/#subscribelevel1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.watchTicker (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://apidoc.ndax.io/#subscribetrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [ndax](#ndax) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://apidoc.ndax.io/#subscribeticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [ndax](#ndax) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://apidoc.ndax.io/#subscribelevel2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +ndax.watchOrderBook (symbol[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/novadax.md b/docs/ccxt/wiki/exchanges/novadax.md new file mode 100644 index 0000000..66a7cd9 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/novadax.md @@ -0,0 +1,523 @@ + + + +## novadax{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderTrades](#fetchordertrades) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchAccounts](#fetchaccounts) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchMyTrades](#fetchmytrades) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [novadax](#novadax) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://doc.novadax.com/en-US/#get-current-system-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for novadax + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://doc.novadax.com/en-US/#get-all-supported-trading-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://doc.novadax.com/en-US/#get-latest-ticker-for-specific-pair + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://doc.novadax.com/en-US/#get-latest-tickers-for-all-trading-pairs + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchTickers (symbols[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://doc.novadax.com/en-US/#get-market-depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://doc.novadax.com/en-US/#get-recent-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://doc.novadax.com/en-US/#get-kline-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://doc.novadax.com/en-US/#get-account-balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.novadax.com/en-US/#order-introduction + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | for spot market buy orders, the quote quantity that can be used as an alternative for the amount | + + +```javascript +novadax.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.novadax.com/en-US/#cancel-an-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by novadax cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.novadax.com/en-US/#get-order-details + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by novadax fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.novadax.com/en-US/#get-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.novadax.com/en-US/#get-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.novadax.com/en-US/#get-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://doc.novadax.com/en-US/#get-order-match-details + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://doc.novadax.com/en-US/#get-sub-account-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://doc.novadax.com/en-US/#send-cryptocurrencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://doc.novadax.com/en-US/#get-sub-account-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchAccounts ([params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://doc.novadax.com/en-US/#wallet-records-of-deposits-and-withdraws + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://doc.novadax.com/en-US/#wallet-records-of-deposits-and-withdraws + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [novadax](#novadax) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://doc.novadax.com/en-US/#wallet-records-of-deposits-and-withdraws + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [novadax](#novadax) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://doc.novadax.com/en-US/#get-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +novadax.fetchMyTrades (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/oceanex.md b/docs/ccxt/wiki/exchanges/oceanex.md new file mode 100644 index 0000000..ce920a9 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/oceanex.md @@ -0,0 +1,441 @@ + + + +## oceanex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrderBooks](#fetchorderbooks) +* [fetchTrades](#fetchtrades) +* [fetchTime](#fetchtime) +* [fetchTradingFees](#fetchtradingfees) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrders](#fetchorders) +* [fetchOHLCV](#fetchohlcv) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for oceanex + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://api.oceanex.pro/doc/v1/#markets-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchMarkets ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.oceanex.pro/doc/v1/#ticker-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.oceanex.pro/doc/v1/#multiple-tickers-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchTickers (symbols[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://api.oceanex.pro/doc/v1/#order-book-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrderBooks{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - a dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbol + +**See**: https://api.oceanex.pro/doc/v1/#multiple-order-books-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols, all symbols fetched if undefined, default is undefined | +| limit | int | No | max number of entries per orderbook to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchOrderBooks (symbols[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api.oceanex.pro/doc/v1/#trades-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://api.oceanex.pro/doc/v1/#api-server-time-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchTime ([params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://api.oceanex.pro/doc/v1/#trading-fees-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchTradingFees ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://api.oceanex.pro/doc/v1/#account-info-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#new-order-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#order-status-get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#order-status-get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#order-status-get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#order-status-with-filters-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://api.oceanex.pro/doc/v1/#k-line-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#cancel-order-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by oceanex cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#cancel-multiple-orders-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | not used by oceanex cancelOrders () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api.oceanex.pro/doc/v1/#cancel-all-orders-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch the deposit addresses for a currency associated with this account + +**Kind**: instance method of [oceanex](#oceanex) +**Returns**: object - a dictionary [address structures](https://docs.ccxt.com/#/?id=address-structure), indexed by the network + +**See**: https://api.oceanex.pro/doc/v1/#deposit-addresses-post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oceanex.fetchDepositAddressesByNetwork (code[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/okcoin.md b/docs/ccxt/wiki/exchanges/okcoin.md new file mode 100644 index 0000000..7390d63 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/okcoin.md @@ -0,0 +1,787 @@ + + + +## okcoin{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderTrades](#fetchordertrades) +* [fetchLedger](#fetchledger) +* [watchTrades](#watchtrades) +* [watchOrders](#watchorders) +* [watchTicker](#watchticker) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchBalance](#watchbalance) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for okcoin + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-public-data-get-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchCurrencies ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-trades +- https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-trades-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-candlesticks +- https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-candlesticks-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchBalance ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-order +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-algo-order +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-multiple-orders +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.reduceOnly | bool | No | MARGIN orders only, or swap/future orders in net mode | +| params.postOnly | bool | No | true to place a post only order | +| params.triggerPrice | float | No | conditional orders only, the price at which the order is to be triggered | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.takeProfit.price | float | No | used for take profit limit orders, not used for take profit market price orders | +| params.takeProfit.type | string | No | 'market' or 'limit' used to specify the take profit price type | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.stopLoss.price | float | No | used for stop loss limit orders, not used for stop loss market price orders | +| params.stopLoss.type | string | No | 'market' or 'limit' used to specify the stop loss price type | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | + + +```javascript +okcoin.createOrder (symbol, type, side, amount, price[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-order +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-algo-order +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if cancel trigger or conditional orders | +| params.advanced | bool | No | True if canceling advanced orders only | + + +```javascript +okcoin.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-multiple-orders +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-algo-order +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.cancelOrders (ids, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-details +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-algo-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-list +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-algo-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if fetching trigger or conditional orders | +| params.ordType | string | No | "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap" | + + +```javascript +okcoin.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-algo-order-history +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-history-last-3-months +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-history-last-7-days + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if fetching trigger or conditional orders | +| params.ordType | string | No | "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap" | + + +```javascript +okcoin.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-funding-funds-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-funding-withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-funding-get-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#rest-api-funding-get-withdrawal-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-days +- https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-months + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://www.okcoin.com/docs-v5/en/#rest-api-funding-asset-bills-details +- https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days +- https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.fetchLedger ([code, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-trades-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#websocket-api-private-channel-order-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.watchTicker (symbol[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-candlesticks-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-order-book-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [okcoin](#okcoin) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.okcoin.com/docs-v5/en/#websocket-api-private-channel-account-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okcoin.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/okx.md b/docs/ccxt/wiki/exchanges/okx.md new file mode 100644 index 0000000..89d2098 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/okx.md @@ -0,0 +1,2788 @@ + + + +## okx{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchAccounts](#fetchaccounts) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchMarkPrice](#fetchmarkprice) +* [fetchMarkPrices](#fetchmarkprices) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchTradingFee](#fetchtradingfee) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelOrdersForSymbols](#cancelordersforsymbols) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchOrderTrades](#fetchordertrades) +* [fetchLedger](#fetchledger) +* [fetchDepositAddressesByNetwork](#fetchdepositaddressesbynetwork) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [fetchDeposits](#fetchdeposits) +* [fetchDeposit](#fetchdeposit) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchWithdrawal](#fetchwithdrawal) +* [fetchLeverage](#fetchleverage) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchPositionsForSymbol](#fetchpositionsforsymbol) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingHistory](#fetchfundinghistory) +* [setLeverage](#setleverage) +* [fetchPositionMode](#fetchpositionmode) +* [setPositionMode](#setpositionmode) +* [setMarginMode](#setmarginmode) +* [fetchCrossBorrowRates](#fetchcrossborrowrates) +* [fetchCrossBorrowRate](#fetchcrossborrowrate) +* [fetchBorrowRateHistories](#fetchborrowratehistories) +* [fetchBorrowRateHistory](#fetchborrowratehistory) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [fetchBorrowInterest](#fetchborrowinterest) +* [borrowCrossMargin](#borrowcrossmargin) +* [repayCrossMargin](#repaycrossmargin) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchOpenInterests](#fetchopeninterests) +* [fetchOpenInterestHistory](#fetchopeninteresthistory) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchSettlementHistory](#fetchsettlementhistory) +* [fetchUnderlyingAssets](#fetchunderlyingassets) +* [fetchGreeks](#fetchgreeks) +* [fetchAllGreeks](#fetchallgreeks) +* [closePosition](#closeposition) +* [fetchOption](#fetchoption) +* [fetchOptionChain](#fetchoptionchain) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTrade](#fetchconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [fetchConvertCurrencies](#fetchconvertcurrencies) +* [fetchMarginAdjustmentHistory](#fetchmarginadjustmenthistory) +* [fetchPositionsHistory](#fetchpositionshistory) +* [fetchLongShortRatioHistory](#fetchlongshortratiohistory) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [unWatchTradesForSymbols](#unwatchtradesforsymbols) +* [unWatchTrades](#unwatchtrades) +* [watchFundingRate](#watchfundingrate) +* [watchTicker](#watchticker) +* [unWatchTicker](#unwatchticker) +* [watchTickers](#watchtickers) +* [watchMarkPrice](#watchmarkprice) +* [watchMarkPrices](#watchmarkprices) +* [unWatchTickers](#unwatchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchLiquidationsForSymbols](#watchliquidationsforsymbols) +* [watchMyLiquidationsForSymbols](#watchmyliquidationsforsymbols) +* [watchOHLCV](#watchohlcv) +* [unWatchOHLCV](#unwatchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [unWatchOHLCVForSymbols](#unwatchohlcvforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [unWatchOrderBookForSymbols](#unwatchorderbookforsymbols) +* [unWatchOrderBook](#unwatchorderbook) +* [watchBalance](#watchbalance) +* [watchMyTrades](#watchmytrades) +* [watchPositions](#watchpositions) +* [watchOrders](#watchorders) +* [createOrderWs](#createorderws) +* [editOrderWs](#editorderws) +* [cancelOrderWs](#cancelorderws) +* [cancelOrdersWs](#cancelordersws) +* [cancelAllOrdersWs](#cancelallordersws) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://www.okx.com/docs-v5/en/#status-get-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [okx](#okx) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-system-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchTime ([params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchAccounts ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for okx + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://www.okx.com/docs-v5/en/#rest-api-public-data-get-instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchCurrencies ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [okx](#okx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | 'publicGetMarketBooksFull' or 'publicGetMarketBooks' default is 'publicGetMarketBooks' | + + +```javascript +okx.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchTickers ([symbols, params]) +``` + + + + +### fetchMarkPrice{docsify-ignore} +fetches mark price for the market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchMarkPrice (symbol[, params]) +``` + + + + +### fetchMarkPrices{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-mark-price + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchMarkPrices ([symbols, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.okx.com/docs-v5/en/#rest-api-market-data-get-trades +- https://www.okx.com/docs-v5/en/#rest-api-public-data-get-option-trades + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | 'publicGetMarketTrades' or 'publicGetMarketHistoryTrades' default is 'publicGetMarketTrades' | +| params.paginate | boolean | No | *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +okx.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks +- https://www.okx.com/docs-v5/en/#rest-api-market-data-get-candlesticks-history +- https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks +- https://www.okx.com/docs-v5/en/#rest-api-market-data-get-mark-price-candlesticks-history +- https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks +- https://www.okx.com/docs-v5/en/#rest-api-market-data-get-index-candlesticks-history +- https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-candlesticks-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.price | string | No | "mark" or "index" for mark price and index price candles | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.type | string | No | "Candles" or "HistoryCandles", default is "Candles" for recent candles, "HistoryCandles" for older candles | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +okx.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +okx.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-fee-rates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance +- https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | wallet type, ['funding' or 'trading'] default is 'trading' | + + +```javascript +okx.fetchBalance ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-place-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.reduceOnly | bool | No | a mark to reduce the position size for margin, swap and future orders | +| params.postOnly | bool | No | true to place a post only order | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.takeProfit.price | float | No | used for take profit limit orders, not used for take profit market price orders | +| params.takeProfit.type | string | No | 'market' or 'limit' used to specify the take profit price type | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.stopLoss.price | float | No | used for stop loss limit orders, not used for stop loss market price orders | +| params.stopLoss.type | string | No | 'market' or 'limit' used to specify the stop loss price type | +| params.positionSide | string | No | if position mode is one-way: set to 'net', if position mode is hedge-mode: set to 'long' or 'short' | +| params.trailingPercent | string | No | the percent to trail away from the current market price | +| params.tpOrdKind | string | No | 'condition' or 'limit', the default is 'condition' | +| params.hedged | bool | No | *swap and future only* true for hedged mode, false for one way mode | +| params.marginMode | string | No | 'cross' or 'isolated', the default is 'cross' | + + +```javascript +okx.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-multiple-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | client order id, uses id if not passed | +| params.stopLossPrice | float | No | stop loss trigger price | +| params.newSlOrdPx | float | No | the stop loss order price, set to stopLossPrice if the type is market | +| params.newSlTriggerPxType | string | No | 'last', 'index' or 'mark' used to specify the stop loss trigger price type, default is 'last' | +| params.takeProfitPrice | float | No | take profit trigger price | +| params.newTpOrdPx | float | No | the take profit order price, set to takeProfitPrice if the type is market | +| params.newTpTriggerPxType | string | No | 'last', 'index' or 'mark' used to specify the take profit trigger price type, default is 'last' | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.stopLoss.price | float | No | used for stop loss limit orders, not used for stop loss market price orders | +| params.stopLoss.type | string | No | 'market' or 'limit' used to specify the stop loss price type | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.takeProfit.price | float | No | used for take profit limit orders, not used for take profit market price orders | +| params.takeProfit.type | string | No | 'market' or 'limit' used to specify the take profit price type | +| params.newTpOrdKind | string | No | 'condition' or 'limit', the default is 'condition' | + + +```javascript +okx.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [okx](#okx) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-order +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if trigger orders | +| params.trailing | boolean | No | set to true if you want to cancel a trailing order | + + +```javascript +okx.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/trigger order | +| params.trailing | boolean | No | set to true if you want to cancel trailing orders | + + +```javascript +okx.cancelOrders (ids, symbol[, params]) +``` + + + + +### cancelOrdersForSymbols{docsify-ignore} +cancel multiple orders for multiple symbols + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array<CancellationRequest> | Yes | each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}] | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/trigger order | +| params.trailing | boolean | No | set to true if you want to cancel trailing orders | + + +```javascript +okx.cancelOrdersForSymbols (orders[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [okx](#okx) +**Returns**: object - the api result + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-all-after + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetch an order by the id + +**Kind**: instance method of [okx](#okx) +**Returns**: [an order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-details +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra and exchange specific parameters | +| params.trigger | boolean | No | true if fetching trigger orders | + + +```javascript +okx.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-list +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if fetching trigger or conditional orders | +| params.ordType | string | No | "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap" | +| params.algoId | string | No | Algo ID "'433845797218942976'" | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | + + +```javascript +okx.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if fetching trigger or conditional orders | +| params.ordType | string | No | "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap" | +| params.algoId | string | No | Algo ID "'433845797218942976'" | +| params.until | int | No | timestamp in ms to fetch orders for | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | + + +```javascript +okx.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-7-days +- https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-get-algo-order-history +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-order-history-last-3-months + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | True if fetching trigger or conditional orders | +| params.ordType | string | No | "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap" | +| params.algoId | string | No | Algo ID "'433845797218942976'" | +| params.until | int | No | timestamp in ms to fetch orders for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.method | string | No | method to be used, either 'privateGetTradeOrdersHistory', 'privateGetTradeOrdersHistoryArchive' or 'privateGetTradeOrdersAlgoHistory' default is 'privateGetTradeOrdersHistory' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | + + +```javascript +okx.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | Timestamp in ms of the latest time to retrieve trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +okx.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-get-transaction-details-last-3-months + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered balance of the user + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days +- https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months +- https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +okx.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDepositAddressesByNetwork{docsify-ignore} +fetch a dictionary of addresses for a currency, indexed by network + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a dictionary of [address structures](https://docs.ccxt.com/#/?id=address-structure) indexed by the network + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchDepositAddressesByNetwork (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the network name for the deposit address | + + +```javascript +okx.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +okx.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch data on a currency deposit via the deposit id + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-funding-get-deposit-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | Yes | filter by currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchDeposit (id, code[, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +okx.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchWithdrawal{docsify-ignore} +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-funding-get-withdrawal-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | withdrawal id | +| code | string | Yes | unified currency code of the currency withdrawn, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchWithdrawal (id, code[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-account-get-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | + + +```javascript +okx.fetchLeverage (symbol[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-account-get-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | MARGIN, SWAP, FUTURES, OPTION | + + +```javascript +okx.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#rest-api-account-get-positions +- https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | MARGIN, SWAP, FUTURES, OPTION | + + +```javascript +okx.fetchPositions (symbols[, params]) +``` + + + + +### fetchPositionsForSymbol{docsify-ignore} +fetch all open positions for specific symbol + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-account-get-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.instType | string | No | MARGIN (if needed) | + + +```javascript +okx.fetchPositionsForSymbol (symbol[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-funding-funds-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetches the current funding rates for multiple symbols + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a dictionary of [funding rates structure](https://docs.ccxt.com/#/?id=funding-rates-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - response from the exchange + +**See**: https://www.okx.com/docs-v5/en/#rest-api-account-set-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | +| params.posSide | string | No | 'long' or 'short' or 'net' for isolated margin long/short mode on futures and swap markets, default is 'net' | + + +```javascript +okx.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-account-configuration + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.accountId | string | No | if you have multiple accounts, you must specify the account id to fetch the position mode | + + +```javascript +okx.fetchPositionMode (symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - response from the exchange + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-position-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use long_short_mode, false for net_mode | +| symbol | string | Yes | not used by okx setPositionMode | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.setPositionMode (hedged, symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [okx](#okx) +**Returns**: object - response from the exchange + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-set-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.leverage | int | No | leverage | + + +```javascript +okx.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### fetchCrossBorrowRates{docsify-ignore} +fetch the borrow interest rates of all currencies + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a list of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchCrossBorrowRates ([params]) +``` + + + + +### fetchCrossBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [borrow rate structure](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-interest-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchCrossBorrowRate (code[, params]) +``` + + + + +### fetchBorrowRateHistories{docsify-ignore} +retrieves a history of a multiple currencies borrow interest rate at specific time slots, returns all currencies if no symbols passed, default is undefined + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a dictionary of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) indexed by the market symbol + +**See**: https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| since | int | No | timestamp in ms of the earliest borrowRate, default is undefined | +| limit | int | No | max number of borrow rate prices to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchBorrowRateHistories (codes[, since, limit, params]) +``` + + + + +### fetchBorrowRateHistory{docsify-ignore} +retrieves a history of a currencies borrow interest rate at specific time slots + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - an array of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://www.okx.com/docs-v5/en/#financial-product-savings-get-public-borrow-history-public + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | timestamp for the earliest borrow rate | +| limit | int | No | the maximum number of [borrow rate structures](https://docs.ccxt.com/#/?id=borrow-rate-structure) to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchBorrowRateHistory (code[, since, limit, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.addMargin (symbol, amount[, params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-public-data-get-position-tiers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | + + +```javascript +okx.fetchMarketLeverageTiers (symbol[, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed b the user for borrowing currency for margin trading + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - An list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-account-get-interest-accrued-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | the unified currency code for the currency of the interest | +| symbol | string | Yes | the market symbol of an isolated margin market, if undefined, the interest for cross margin markets is returned | +| since | int | No | timestamp in ms of the earliest time to receive interest records for | +| limit | int | No | the number of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) to retrieve | +| params | object | No | exchange specific parameters | +| params.type | int | No | Loan type 1 - VIP loans 2 - Market loans *Default is Market loans* | +| params.marginMode | string | No | 'cross' or 'isolated' | + + +```javascript +okx.fetchBorrowInterest (code, symbol[, since, limit, params]) +``` + + + + +### borrowCrossMargin{docsify-ignore} +create a loan to borrow margin (need to be VIP 5 and above) + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to borrow | +| amount | float | Yes | the amount to borrow | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.borrowCrossMargin (code, amount[, params]) +``` + + + + +### repayCrossMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-vip-loans-borrow-and-repay + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.id | string | No | the order ID of borrowing, it is necessary while repaying | + + +```javascript +okx.repayCrossMargin (code, amount[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +Retrieves the open interest of a currency + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +okx.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchOpenInterests{docsify-ignore} +Retrieves the open interests of some currencies + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an dictionary of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-public-data-get-open-interest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | Unified CCXT market symbols | +| params | object | No | exchange specific parameters | +| params.instType | string | Yes | Instrument type, options: 'SWAP', 'FUTURES', 'OPTION', default to 'SWAP' | +| params.uly | string | Yes | Underlying, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required | +| params.instFamily | string | Yes | Instrument family, Applicable to FUTURES/SWAP/OPTION, if instType is 'OPTION', either uly or instFamily is required | + + +```javascript +okx.fetchOpenInterests (symbols[, params]) +``` + + + + +### fetchOpenInterestHistory{docsify-ignore} +Retrieves the open interest history of a currency + +**Kind**: instance method of [okx](#okx) +**Returns**: An array of [open interest structures](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-contracts-open-interest-and-volume +- https://www.okx.com/docs-v5/en/#rest-api-trading-data-get-options-open-interest-and-volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT currency code or unified symbol | +| timeframe | string | Yes | "5m", "1h", or "1d" for option only "1d" or "8h" | +| since | int | No | The time in ms of the earliest record to retrieve as a unix timestamp | +| limit | int | No | Not used by okx, but parsed internally by CCXT | +| params | object | No | Exchange specific parameters | +| params.until | int | No | The time in ms of the latest record to retrieve as a unix timestamp | + + +```javascript +okx.fetchOpenInterestHistory (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [fees structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-funding-get-currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchSettlementHistory{docsify-ignore} +fetches historical settlement records + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [settlement history objects](https://docs.ccxt.com/#/?id=settlement-history-structure) + +**See**: https://www.okx.com/docs-v5/en/#rest-api-public-data-get-delivery-exercise-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol to fetch the settlement history for | +| since | int | No | timestamp in ms | +| limit | int | No | number of records | +| params | object | No | exchange specific params | + + +```javascript +okx.fetchSettlementHistory (symbol[, since, limit, params]) +``` + + + + +### fetchUnderlyingAssets{docsify-ignore} +fetches the market ids of underlying assets for a specific contract market type + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [underlying assets](https://docs.ccxt.com/#/?id=underlying-assets-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-underlying + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | exchange specific params | +| params.type | string | No | the contract market type, 'option', 'swap' or 'future', the default is 'option' | + + +```javascript +okx.fetchUnderlyingAssets ([params]) +``` + + + + +### fetchGreeks{docsify-ignore} +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchGreeks (symbol[, params]) +``` + + + + +### fetchAllGreeks{docsify-ignore} +fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-rest-api-get-option-market-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch greeks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uly | string | Yes | Underlying, either uly or instFamily is required | +| params.instFamily | string | Yes | Instrument family, either uly or instFamily is required | + + +```javascript +okx.fetchAllGreeks ([symbols, params]) +``` + + + + +### closePosition{docsify-ignore} +closes open positions for a market + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - [A list of position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-close-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | Unified CCXT market symbol | +| side | string | No | 'buy' or 'sell', leave as undefined in net mode | +| params | object | No | extra parameters specific to the okx api endpoint | +| params.clientOrderId | string | No | a unique identifier for the order | +| params.marginMode | string | No | 'cross' or 'isolated', default is 'cross; | +| params.code | string | No | *required in the case of closing cross MARGIN position for Single-currency margin* margin currency EXCHANGE SPECIFIC PARAMETERS | +| params.autoCxl | boolean | No | whether any pending orders for closing out needs to be automatically canceled when close position via a market order. false or true, the default is false | +| params.tag | string | No | order tag a combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters | + + +```javascript +okx.closePosition (symbol[, side, params]) +``` + + + + +### fetchOption{docsify-ignore} +fetches option data that is commonly found in an option chain + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [option chain structure](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchOption (symbol[, params]) +``` + + + + +### fetchOptionChain{docsify-ignore} +fetches data for an underlying asset that is commonly found in an option chain + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a list of [option chain structures](https://docs.ccxt.com/#/?id=option-chain-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-get-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | base currency to fetch an option chain for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.uly | string | No | the underlying asset, can be obtained from fetchUnderlyingAssets () | + + +```javascript +okx.fetchOptionChain (code[, params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-estimate-quote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchConvertQuote (fromCode, toCode[, amount, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-convert-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.createConvertTrade (id, fromCode, toCode[, amount, params]) +``` + + + + +### fetchConvertTrade{docsify-ignore} +fetch the data for a conversion trade + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to fetch | +| code | string | No | the unified currency code of the conversion trade | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchConvertTrade (id[, code, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest conversion to fetch | + + +```javascript +okx.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### fetchConvertCurrencies{docsify-ignore} +fetches all available currencies that can be converted + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an associative dictionary of currencies + +**See**: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.fetchConvertCurrencies ([params]) +``` + + + + +### fetchMarginAdjustmentHistory{docsify-ignore} +fetches the history of margin added or reduced from contract isolated positions + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [margin structures](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-7-days +- https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | not used by okx fetchMarginAdjustmentHistory | +| type | string | No | "add" or "reduce" | +| since | int | No | the earliest time in ms to fetch margin adjustment history for | +| limit | int | No | the maximum number of entries to retrieve | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.auto | boolean | No | true if fetching auto margin increases | + + +```javascript +okx.fetchMarginAdjustmentHistory ([symbol, type, since, limit, params]) +``` + + + + +### fetchPositionsHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | No | unified market symbols | +| since | int | No | timestamp in ms of the earliest position to fetch | +| limit | int | No | the maximum amount of records to fetch, default=100, max=100 | +| params | object | Yes | extra parameters specific to the exchange api endpoint | +| params.marginMode | string | No | "cross" or "isolated" EXCHANGE SPECIFIC PARAMETERS | +| params.instType | string | No | margin, swap, futures or option | +| params.type | string | No | the type of latest close position 1: close position partially, 2:close all, 3:liquidation, 4:partial liquidation; 5:adl, is it is the latest type if there are several types for the same position | +| params.posId | string | No | position id, there is attribute expiration, the posid will be expired if it is more than 30 days after the last full close position, then position will use new posid | +| params.before | string | No | timestamp in ms of the earliest position to fetch based on the last update time of the position | +| params.after | string | No | timestamp in ms of the latest position to fetch based on the last update time of the position | + + +```javascript +okx.fetchPositionsHistory ([symbols, since, limit, params]) +``` + + + + +### fetchLongShortRatioHistory{docsify-ignore} +fetches the long short ratio history for a unified market symbol + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - an array of [long short ratio structures](https://docs.ccxt.com/#/?id=long-short-ratio-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-statistics-rest-api-get-contract-long-short-ratio + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the long short ratio for | +| timeframe | string | No | the period for the ratio | +| since | int | No | the earliest time in ms to fetch ratios for | +| limit | int | No | the maximum number of long short ratio structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest ratio to fetch | + + +```javascript +okx.fetchLongShortRatioHistory (symbol[, timeframe, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-trades-channel +- https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-all-trades-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-trades-channel +- https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-all-trades-channel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | Yes | | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, trades by default. Can be 'trades' and 'trades-all' | + + +```javascript +okx.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### unWatchTradesForSymbols{docsify-ignore} +unWatches from the stream channel + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, trades by default. Can be trades, trades-all | + + +```javascript +okx.unWatchTradesForSymbols (symbols[, params]) +``` + + + + +### unWatchTrades{docsify-ignore} +unWatches from the stream channel + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.unWatchTrades (symbol[, params]) +``` + + + + +### watchFundingRate{docsify-ignore} +watch the current funding rate + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-websocket-funding-rate-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.watchFundingRate (symbol[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +okx.watchTicker (symbol[, params]) +``` + + + + +### unWatchTicker{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +okx.unWatchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +okx.watchTickers ([symbols, params]) +``` + + + + +### watchMarkPrice{docsify-ignore} +watches a mark price + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-websocket-mark-price-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +okx.watchMarkPrice (symbol[, params]) +``` + + + + +### watchMarkPrices{docsify-ignore} +watches mark prices + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-websocket-mark-price-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +okx.watchMarkPrices ([symbols, params]) +``` + + + + +### unWatchTickers{docsify-ignore} +unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +okx.unWatchTickers ([symbols, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.watchBidsAsks (symbols[, params]) +``` + + + + +### watchLiquidationsForSymbols{docsify-ignore} +watch the public liquidations of a trading pair + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + +**See**: https://www.okx.com/docs-v5/en/#public-data-websocket-liquidation-orders-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | Yes | | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the okx api endpoint | + + +```javascript +okx.watchLiquidationsForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchMyLiquidationsForSymbols{docsify-ignore} +watch the private liquidations of a trading pair + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an array of [liquidation structures](https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-websocket-balance-and-position-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the okx api endpoint | + + +```javascript +okx.watchMyLiquidationsForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### unWatchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.unWatchOHLCV (symbol, timeframe[, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### unWatchOHLCVForSymbols{docsify-ignore} +unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.unWatchOHLCVForSymbols (symbolsAndTimeframes[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [okx](#okx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.depth | string | No | okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt | + + +```javascript +okx.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [okx](#okx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | 1,5, 400, 50 (l2-tbt, vip4+) or 40000 (vip5+) the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.depth | string | No | okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt | + + +```javascript +okx.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### unWatchOrderBookForSymbols{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [okx](#okx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | the maximum amount of order book entries to return | +| params.depth | string | No | okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt | + + +```javascript +okx.unWatchOrderBookForSymbols (symbols[, params]) +``` + + + + +### unWatchOrderBook{docsify-ignore} +unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [okx](#okx) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified array of symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.limit | int | No | the maximum amount of order book entries to return | +| params.depth | string | No | okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt | + + +```javascript +okx.unWatchOrderBook (symbol[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [okx](#okx) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.watchBalance ([params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if fetching trigger or conditional trades | +| params.type | string | No | 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION' | +| params.marginMode | string | No | 'cross' or 'isolated', for automatically setting the type to spot margin | + + +```javascript +okx.watchMyTrades ([symbol, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://www.okx.com/docs-v5/en/#trading-account-websocket-positions-channel + +| Param | Type | Description | +| --- | --- | --- | +| symbols | Array<string>, undefined | list of unified market symbols | +| since | | | +| limit | | | +| params | object | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.watchPositions (symbols, since, limit, params[]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-order-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market the orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if fetching trigger or conditional orders | +| params.type | string | No | 'spot', 'swap', 'future', 'option', 'ANY', 'SPOT', 'MARGIN', 'SWAP', 'FUTURES' or 'OPTION' | +| params.marginMode | string | No | 'cross' or 'isolated', for automatically setting the type to spot margin | + + +```javascript +okx.watchOrders ([symbol, since, limit, params]) +``` + + + + +### createOrderWs{docsify-ignore} +create a trade order + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okx.com/docs-v5/en/#websocket-api-trade-place-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float, undefined | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.test | boolean | Yes | test order, default false | + + +```javascript +okx.createOrderWs (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-amend-order +- https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-amend-multiple-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float, undefined | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.editOrderWs (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://okx-docs.github.io/apidocs/websocket_api/en/#cancel-order-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clOrdId | string | No | client order id | + + +```javascript +okx.cancelOrderWs (id, symbol[, params]) +``` + + + + +### cancelOrdersWs{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [okx](#okx) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-mass-cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.cancelOrdersWs (ids, symbol[, params]) +``` + + + + +### cancelAllOrdersWs{docsify-ignore} +cancel all open orders of a type. Only applicable to Option in Portfolio Margin mode, and MMP privilege is required. + +**Kind**: instance method of [okx](#okx) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.okx.com/websockets/#message-cancelAll + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +okx.cancelAllOrdersWs (symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/onetrading.md b/docs/ccxt/wiki/exchanges/onetrading.md new file mode 100644 index 0000000..61eb4c1 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/onetrading.md @@ -0,0 +1,586 @@ + + + +## onetrading{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchTradingFees](#fetchtradingfees) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [watchBalance](#watchbalance) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchMyTrades](#watchmytrades) +* [watchOrderBook](#watchorderbook) +* [watchOrders](#watchorders) +* [watchOHLCV](#watchohlcv) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.onetrading.com/#time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.onetrading.com/#currencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for onetrading + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.onetrading.com/#instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchMarkets ([params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See** + +- https://docs.onetrading.com/#fee-groups +- https://docs.onetrading.com/#fees + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | fetchPrivateTradingFees or fetchPublicTradingFees | + + +```javascript +onetrading.fetchTradingFees ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.onetrading.com/#market-ticker-for-instrument + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.onetrading.com/#market-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchTickers ([symbols, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.onetrading.com/#order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.onetrading.com/#candlesticks + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.onetrading.com/#balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.onetrading.com/#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | onetrading only does stop limit orders and does not do stop market | + + +```javascript +onetrading.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.onetrading.com/#close-order-by-order-id + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by bitmex cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.onetrading.com/#close-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.onetrading.com/#close-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.cancelOrders (ids, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.onetrading.com/#get-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | not used by onetrading fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.onetrading.com/#get-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.onetrading.com/#get-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.onetrading.com/#trades-for-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.onetrading.com/#all-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://developers.bitpanda.com/exchange/#account-history-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.watchBalance ([params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://developers.bitpanda.com/exchange/#market-ticker-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches price tickers, a statistical calculation with the information for all markets or those specified. + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - an array of [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://developers.bitpanda.com/exchange/#market-ticker-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | Yes | unified symbols of the markets to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.watchTickers (symbols[, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +get the list of trades associated with the user + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://developers.bitpanda.com/exchange/#account-history-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for. Use 'any' to watch all trades | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://developers.bitpanda.com/exchange/#market-ticker-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://developers.bitpanda.com/exchange/#account-history-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | can listen to orders using ACCOUNT_HISTORY or TRADING | + + +```javascript +onetrading.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [onetrading](#onetrading) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://developers.bitpanda.com/exchange/#candlesticks-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +onetrading.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/oxfun.md b/docs/ccxt/wiki/exchanges/oxfun.md new file mode 100644 index 0000000..6ced73d --- /dev/null +++ b/docs/ccxt/wiki/exchanges/oxfun.md @@ -0,0 +1,1144 @@ + + + +## oxfun{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrderBook](#fetchorderbook) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchBalance](#fetchbalance) +* [fetchAccounts](#fetchaccounts) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [fetchPositions](#fetchpositions) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOHLCV](#watchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchBalance](#watchbalance) +* [watchPositions](#watchpositions) +* [watchOrders](#watchorders) +* [createOrderWs](#createorderws) +* [editOrderWs](#editorderws) +* [cancelOrderWs](#cancelorderws) +* [cancelOrdersWs](#cancelordersws) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitmex + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.ox.fun/?json#get-v3-markets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: dict - an associative dictionary of currencies + +**See**: https://docs.ox.fun/?json#get-v3-assets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | dict | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchCurrencies ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.ox.fun/?json#get-v3-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.ox.fun/?json#get-v3-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchTicker (symbol[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.ox.fun/?json#get-v3-candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch (default 24 hours ago) | +| limit | int | No | the maximum amount of candles to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch (default now) | + + +```javascript +oxfun.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.ox.fun/?json#get-v3-depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return (default 5, max 100) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rates for multiple markets + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Order> - an array of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.ox.fun/?json#get-v3-funding-estimates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rates for a symbol + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Order> - an array of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.ox.fun/?json#get-v3-funding-estimates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +Fetches the history of funding rates + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.ox.fun/?json#get-v3-funding-rates + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch (default 24 hours ago) | +| limit | int | No | the maximum amount of trades to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade to fetch (default now) | + + +```javascript +oxfun.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetches the history of funding payments + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.ox.fun/?json#get-v3-funding + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch (default 24 hours ago) | +| limit | int | No | the maximum amount of trades to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade to fetch (default now) | + + +```javascript +oxfun.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes, if a market has a leverage tier of 0, then the leverage tiers cannot be obtained for this market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + +**See**: https://docs.ox.fun/?json#get-v3-leverage-tiers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchLeverageTiers ([symbols, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.ox.fun/?json#get-v3-exchange-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch (default 24 hours ago) | +| limit | int | No | the maximum amount of trades to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade to fetch (default now) | + + +```javascript +oxfun.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Trade> - a list of [trade structures](https://github.com/ccxt/ccxt/wiki/Manual#trade-structure) + +**See**: https://docs.ox.fun/?json#get-v3-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum amount of trades to fetch (default 200, max 500) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest trade to fetch (default now) | + + +```javascript +oxfun.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.ox.fun/?json#get-v3-balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.asset | string | No | currency id, if empty the exchange returns info about all currencies | +| params.subAcc | string | No | Name of sub account. If no subAcc is given, then the response contains only the account linked to the API-Key. | + + +```javascript +oxfun.fetchBalance ([params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch subaccounts associated with a profile + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See**: https://docs.ox.fun/?json#get-v3-account-names + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.fetchAccounts ([params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.ox.fun/?json#post-v3-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account id to transfer from | +| toAccount | string | Yes | account id to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.ox.fun/?json#get-v3-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (default 50, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | + + +```javascript +oxfun.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.ox.fun/?json#get-v3-deposit-addresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | network for fetch deposit address | + + +```javascript +oxfun.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.ox.fun/?json#get-v3-deposit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (default 50, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | + + +```javascript +oxfun.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.ox.fun/?json#get-v3-withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for (default 24 hours ago) | +| limit | int | No | the maximum number of transfer structures to retrieve (default 50, max 200) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transfers for (default time now) | + + +```javascript +oxfun.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.ox.fun/?json#post-v3-withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | network for withdraw | +| params.externalFee | bool | No | if false, then the fee is taken from the quantity, also with the burn fee for asset SOLO EXCHANGE SPECIFIC PARAMETERS | +| params.tfaType | string | No | GOOGLE, or AUTHY_SECRET, or YUBIKEY, for 2FA | +| params.code | string | No | 2FA code | + + +```javascript +oxfun.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.ox.fun/?json#get-v3-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.subAcc | boolean | No | | + + +```javascript +oxfun.fetchPositions (symbols[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#post-v3-orders-place + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit', 'STOP_LIMIT' or 'STOP_MARKET' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | int | No | a unique id for the order | +| params.timestamp | int | No | in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected. | +| params.recvWindow | int | No | in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected. If timestamp is provided without recvWindow, then a default recvWindow of 1000ms is used. | +| params.responseType | string | No | FULL or ACK | +| params.cost | float | No | the quote quantity that can be used as an alternative for the amount for market buy orders | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.limitPrice | float | No | Limit price for the STOP_LIMIT order | +| params.postOnly | bool | No | if true, the order will only be posted if it will be a maker order | +| params.timeInForce | string | No | GTC (default), IOC, FOK, PO, MAKER_ONLY or MAKER_ONLY_REPRICE (reprices order to the best maker only price if the specified price were to lead to a taker trade) | +| params.selfTradePrevention | string | No | NONE, EXPIRE_MAKER, EXPIRE_TAKER or EXPIRE_BOTH for more info check here [https://docs.ox.fun/?json#self-trade-prevention-modes](https://docs.ox.fun/?json#self-trade-prevention-modes) | +| params.displayQuantity | string | No | for an iceberg order, pass both quantity and displayQuantity fields in the order request | + + +```javascript +oxfun.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +create a list of trade orders + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#post-v3-orders-place + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timestamp | int | No | *for all orders* in milliseconds. If orders reach the matching engine and the current timestamp exceeds timestamp + recvWindow, then all orders will be rejected. | +| params.recvWindow | int | No | *for all orders* in milliseconds. If orders reach the matching engine and the current timestamp exceeds timestamp + recvWindow, then all orders will be rejected. If timestamp is provided without recvWindow, then a default recvWindow of 1000ms is used. | +| params.responseType | string | No | *for all orders* FULL or ACK | + + +```javascript +oxfun.createOrders (orders[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://open.big.one/docs/spot_orders.html#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#get-v3-orders-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | a unique id for the order | +| symbol | string | No | not used by oxfun fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | int | No | the client order id of the order | + + +```javascript +oxfun.fetchOrder (id[, symbol, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#get-v3-orders-working + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.orderId | int | No | a unique id for the order | +| params.clientOrderId | int | No | the client order id of the order | + + +```javascript +oxfun.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#delete-v3-orders-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | int | No | a unique id for the order | +| params.timestamp | int | No | in milliseconds | +| params.recvWindow | int | No | in milliseconds | +| params.responseType | string | No | 'FULL' or 'ACK' | + + +```javascript +oxfun.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - response from exchange + +**See**: https://docs.ox.fun/?json#delete-v3-orders-cancel-all + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#delete-v3-orders-cancel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timestamp | int | No | in milliseconds | +| params.recvWindow | int | No | in milliseconds | +| params.responseType | string | No | 'FULL' or 'ACK' | + + +```javascript +oxfun.cancelOrders (ids[, symbol, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.ox.fun/?json#trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.ox.fun/?json#trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.ox.fun/?json#candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.ox.fun/?json#candles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.ox.fun/?json#fixed-size-order-book +- https://docs.ox.fun/?json#full-order-book + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.ox.fun/?json#fixed-size-order-book +- https://docs.ox.fun/?json#full-order-book + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.ox.fun/?json#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.ox.fun/?json#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchTickers ([symbols, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.ox.fun/?json#best-bid-ask + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.watchBidsAsks (symbols[, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.ox.fun/?json#balance-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchBalance ([params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://docs.ox.fun/?json#position-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| since | | Yes | | +| limit | | Yes | | +| params | object | Yes | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchPositions (symbols, since, limit, params[]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#order-channel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.tag | int, string | No | If given it will be echoed in the reply and the max size of tag is 32 | + + +```javascript +oxfun.watchOrders (symbol[, since, limit, params]) +``` + + + + +### createOrderWs{docsify-ignore} +create a trade order + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#order-commands + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit', 'STOP_LIMIT' or 'STOP_MARKET' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | int | No | a unique id for the order | +| params.timestamp | int | No | in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected. | +| params.recvWindow | int | No | in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected. If timestamp is provided without recvWindow, then a default recvWindow of 1000ms is used. | +| params.cost | float | No | the quote quantity that can be used as an alternative for the amount for market buy orders | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.limitPrice | float | No | Limit price for the STOP_LIMIT order | +| params.postOnly | bool | No | if true, the order will only be posted if it will be a maker order | +| params.timeInForce | string | No | GTC (default), IOC, FOK, PO, MAKER_ONLY or MAKER_ONLY_REPRICE (reprices order to the best maker only price if the specified price were to lead to a taker trade) | +| params.selfTradePreventionMode | string | No | NONE, EXPIRE_MAKER, EXPIRE_TAKER or EXPIRE_BOTH for more info check here [https://docs.ox.fun/?json#self-trade-prevention-modes](https://docs.ox.fun/?json#self-trade-prevention-modes) | +| params.displayQuantity | string | No | for an iceberg order, pass both quantity and displayQuantity fields in the order request | + + +```javascript +oxfun.createOrderWs (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrderWs{docsify-ignore} +edit a trade order + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#modify-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float, undefined | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.timestamp | int | No | in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected. | +| params.recvWindow | int | No | in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected. If timestamp is provided without recvWindow, then a default recvWindow of 1000ms is used. | + + +```javascript +oxfun.editOrderWs (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrderWs{docsify-ignore} +cancels an open order + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.ox.fun/?json#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.cancelOrderWs (id, symbol[, params]) +``` + + + + +### cancelOrdersWs{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [oxfun](#oxfun) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-mass-cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +oxfun.cancelOrdersWs (ids, symbol[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/p2b.md b/docs/ccxt/wiki/exchanges/p2b.md new file mode 100644 index 0000000..74c3569 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/p2b.md @@ -0,0 +1,320 @@ + + + +## p2b{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchClosedOrders](#fetchclosedorders) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bigone + +**Kind**: instance method of [p2b](#p2b) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#markets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +p2b.fetchMarkets ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [p2b](#p2b) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://futures-docs.poloniex.com/#get-real-time-ticker-of-all-symbols + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +p2b.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [p2b](#p2b) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +p2b.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [p2b](#p2b) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#depth-result + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.interval | string | No | 0 (default), 0.00000001, 0.0000001, 0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 1 | + + +```javascript +p2b.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [p2b](#p2b) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | 1-100, default=50 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.lastId | int | Yes | order id | + + +```javascript +p2b.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [p2b](#p2b) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#kline + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | 1m, 1h, or 1d | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | 1-500, default=50 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.offset | int | No | default=0, with this value the last candles are returned | + + +```javascript +p2b.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [p2b](#p2b) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#all-balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +p2b.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [p2b](#p2b) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | must be 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +p2b.createOrder (symbol, type, side, amount, price[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [p2b](#p2b) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +p2b.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [p2b](#p2b) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.offset | int | No | 0-10000, default=0 | + + +```javascript +p2b.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [p2b](#p2b) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#deals-by-order-id + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | 1-100, default=50 | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.offset | int | No | 0-10000, default=0 | + + +```javascript +p2b.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user, only the transaction records in the past 3 month can be queried, the time between since and params["until"] cannot be longer than 24 hours + +**Kind**: instance method of [p2b](#p2b) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#deals-history-by-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for, default = params["until"] - 86400000 | +| limit | int | No | 1-100, default=50 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for, default = current timestamp or since + 86400000 EXCHANGE SPECIFIC PARAMETERS | +| params.offset | int | No | 0-10000, default=0 | + + +```javascript +p2b.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user, the time between since and params["untnil"] cannot be longer than 24 hours + +**Kind**: instance method of [p2b](#p2b) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#orders-history-by-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for, default = params["until"] - 86400000 | +| limit | int | No | 1-100, default=50 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch orders for, default = current timestamp or since + 86400000 EXCHANGE SPECIFIC PARAMETERS | +| params.offset | int | No | 0-10000, default=0 | + + +```javascript +p2b.fetchClosedOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/paradex().md b/docs/ccxt/wiki/exchanges/paradex().md new file mode 100644 index 0000000..bb4c6b9 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/paradex().md @@ -0,0 +1,691 @@ + + + +## paradex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchStatus](#fetchstatus) +* [fetchMarkets](#fetchmarkets) +* [fetchOHLCV](#fetchohlcv) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOpenInterest](#fetchopeninterest) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchBalance](#fetchbalance) +* [fetchMyTrades](#fetchmytrades) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchLiquidations](#fetchliquidations) +* [fetchTransfers](#fetchtransfers) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchMarginMode](#fetchmarginmode) +* [setMarginMode](#setmarginmode) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [fetchGreeks](#fetchgreeks) +* [fetchAllGreeks](#fetchallgreeks) + + + +### paradex{docsify-ignore} +Paradex is a decentralized exchange built on the StarkWare layer 2 scaling solution. To access private methods you can either use the ETH public key and private key by setting (exchange.privateKey and exchange.walletAddress) +or alternatively you can provide the startknet private key and public key by setting exchange.options['paradexAccount'] with add {"privateKey": A, "publicKey": B, "address": C} + + + +```javascript +paradex.paradex () +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [paradex](#paradex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.api.testnet.paradex.trade/#get-system-time-unix-milliseconds + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchTime ([params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://docs.api.testnet.paradex.trade/#get-system-state + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchStatus ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for bitget + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.api.testnet.paradex.trade/#list-available-markets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchMarkets ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.api.testnet.paradex.trade/#ohlcv-for-a-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +paradex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.api.testnet.paradex.trade/#list-available-markets-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.api.testnet.paradex.trade/#list-available-markets-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.api.testnet.paradex.trade/#get-market-orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.api.testnet.paradex.trade/#trade-tape + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times | + + +```javascript +paradex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a contract trading pair + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://docs.api.testnet.paradex.trade/#list-available-markets-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +paradex.fetchOpenInterest (symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.api.prod.paradex.trade/#create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stopPrice | float | No | alias for triggerPrice | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.stopLossPrice | float | No | the price that a stop loss order is triggered at | +| params.takeProfitPrice | float | No | the price that a take profit order is triggered at | +| params.timeInForce | string | No | "GTC", "IOC", or "POST_ONLY" | +| params.postOnly | bool | No | true or false | +| params.reduceOnly | bool | No | Ensures that the executed order does not flip the opened position. | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +paradex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.api.prod.paradex.trade/#cancel-order +- https://docs.api.prod.paradex.trade/#cancel-open-order-by-client-order-id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +paradex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.api.prod.paradex.trade/#cancel-all-open-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.api.prod.paradex.trade/#get-order +- https://docs.api.prod.paradex.trade/#get-order-by-client-id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +paradex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.api.prod.paradex.trade/#get-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.side | string | No | 'buy' or 'sell' | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | +| params.until | int | Yes | timestamp in ms of the latest order to fetch | + + +```javascript +paradex.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.api.prod.paradex.trade/#paradex-rest-api-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.api.prod.paradex.trade/#list-balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchBalance ([params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.api.prod.paradex.trade/#list-fills + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +paradex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.api.prod.paradex.trade/#list-open-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.api.prod.paradex.trade/#list-open-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchPositions ([symbols, params]) +``` + + + + +### fetchLiquidations{docsify-ignore} +retrieves the public liquidations of a trading pair + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - an array of [liquidation structures](https://docs.ccxt.com/#/?id=liquidation-structure) + +**See**: https://docs.api.prod.paradex.trade/#list-liquidations + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| since | int | No | the earliest time in ms to fetch liquidations for | +| limit | int | No | the maximum number of liquidation structures to retrieve | +| params | object | No | exchange specific parameters for the huobi api endpoint | +| params.until | int | No | timestamp in ms of the latest liquidation | + + +```javascript +paradex.fetchLiquidations (symbol[, since, limit, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.api.prod.paradex.trade/#paradex-rest-api-transfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +paradex.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [paradex](#paradex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.api.prod.paradex.trade/#paradex-rest-api-transfers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch withdrawals for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +paradex.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchMarginMode{docsify-ignore} +fetches the margin mode of a specific symbol + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [margin mode structure](https://docs.ccxt.com/#/?id=margin-mode-structure) + +**See**: https://docs.api.testnet.paradex.trade/#get-account-margin-configuration + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchMarginMode (symbol[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - response from the exchange + +**See**: https://docs.api.testnet.paradex.trade/#set-margin-configuration + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.leverage | float | No | the rate of leverage | + + +```javascript +paradex.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://docs.api.testnet.paradex.trade/#get-account-margin-configuration + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - response from the exchange + +**See**: https://docs.api.testnet.paradex.trade/#set-margin-configuration + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | No | unified market symbol (is mandatory for swap markets) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | + + +```javascript +paradex.setLeverage (leverage[, symbol, params]) +``` + + + + +### fetchGreeks{docsify-ignore} +fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://docs.api.testnet.paradex.trade/#list-available-markets-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch greeks for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchGreeks (symbol[, params]) +``` + + + + +### fetchAllGreeks{docsify-ignore} +fetches all option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract + +**Kind**: instance method of [paradex](#paradex) +**Returns**: object - a [greeks structure](https://docs.ccxt.com/#/?id=greeks-structure) + +**See**: https://docs.api.testnet.paradex.trade/#list-available-markets-summary + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch greeks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paradex.fetchAllGreeks ([symbols, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/paymium.md b/docs/ccxt/wiki/exchanges/paymium.md new file mode 100644 index 0000000..7df8683 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/paymium.md @@ -0,0 +1,241 @@ + + + +## paymium{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDepositAddresses](#fetchdepositaddresses) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [transfer](#transfer) + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://paymium.github.io/api-documentation/#tag/User/paths/~1user/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://paymium.github.io/api-documentation/#tag/Public-data/paths/~1data~1%7Bcurrency%7D~1depth/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://paymium.github.io/api-documentation/#tag/Public-data/paths/~1data~1%7Bcurrency%7D~1ticker/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [paymium](#paymium) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://paymium.github.io/api-documentation/#tag/Public-data/paths/~1data~1%7Bcurrency%7D~1trades/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://paymium.github.io/api-documentation/#tag/User/paths/~1user~1addresses/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://paymium.github.io/api-documentation/#tag/User/paths/~1user~1addresses~1%7Baddress%7D/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddresses{docsify-ignore} +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://paymium.github.io/api-documentation/#tag/User/paths/~1user~1addresses/get + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.fetchDepositAddresses (codes[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://paymium.github.io/api-documentation/#tag/Order/paths/~1user~1orders/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://paymium.github.io/api-documentation/#tag/Order/paths/~1user~1orders~1%7Buuid%7D/delete +- https://paymium.github.io/api-documentation/#tag/Order/paths/~1user~1orders~1%7Buuid%7D~1cancel/delete + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by paymium cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.cancelOrder (id, symbol[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [paymium](#paymium) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://paymium.github.io/api-documentation/#tag/Transfer/paths/~1user~1email_transfers/post + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +paymium.transfer (code, amount, fromAccount, toAccount[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/phemex.md b/docs/ccxt/wiki/exchanges/phemex.md new file mode 100644 index 0000000..31b1841 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/phemex.md @@ -0,0 +1,1127 @@ + + + +## phemex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchTrades](#fetchtrades) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchPositions](#fetchpositions) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchFundingRate](#fetchfundingrate) +* [setMargin](#setmargin) +* [setMarginMode](#setmarginmode) +* [setPositionMode](#setpositionmode) +* [fetchLeverageTiers](#fetchleveragetiers) +* [setLeverage](#setleverage) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [withdraw](#withdraw) +* [fetchOpenInterest](#fetchopeninterest) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [watchBalance](#watchbalance) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchTrades](#watchtrades) +* [watchOrderBook](#watchorderbook) +* [watchOHLCV](#watchohlcv) +* [watchMyTrades](#watchmytrades) +* [watchOrders](#watchorders) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for phemex + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://phemex-docs.github.io/#query-product-information-3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchCurrencies ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querykline +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | *only used for USDT settled contracts, otherwise is emulated and not supported by the exchange* timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | *USDT settled/ linear swaps only* end time in ms | + + +```javascript +phemex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query24hrsticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols-2 // spot +- https://phemex-docs.github.io/#query-24-ticker-for-all-symbols // linear +- https://phemex-docs.github.io/#query-24-hours-ticker-for-all-symbols // inverse + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#querytrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://phemex-docs.github.io/#query-wallets +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions +- https://phemex-docs.github.io/#query-trading-account-and-positions + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | spot or swap | +| params.code | string | No | *swap only* currency code of the balance to query (USD, USDT, etc), default is USDT | + + +```javascript +phemex.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#place-order +- https://phemex-docs.github.io/#place-order-http-put-prefered-3 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | float | No | trigger price for conditional orders | +| params.takeProfit | object | No | *swap only* *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *swap only* *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.posSide | string | No | *swap only* "Merged" for one way mode, "Long" for buy side of hedged mode, "Short" for sell side of hedged mode | +| params.hedged | bool | No | *swap only* true for hedged mode, false for one way mode, default is false | + + +```javascript +phemex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#amend-order-by-orderid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.posSide | string | No | either 'Merged' or 'Long' or 'Short' | + + +```javascript +phemex.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancel-single-order-by-orderid + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.posSide | string | No | either 'Merged' or 'Long' or 'Short' | + + +```javascript +phemex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#cancelall + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to cancel orders in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://phemex-docs.github.io/#query-orders-by-ids + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryopenorder +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotListAllOpenOrder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#queryorder +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#queryorder +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedgedd-Perpetual-API.md#query-closed-orders-by-symbol +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataOrdersByIds + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.settle | string | No | the settlement currency to fetch orders for | + + +```javascript +phemex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-user-trade +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-trade +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#spotDataTradesHist + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the chain name to fetch the deposit address e.g. ETH, TRX, EOS, SOL, etc. | + + +```javascript +phemex.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#query-trading-account-and-positions +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-account-positions +- https://phemex-docs.github.io/#query-account-positions-with-unrealized-pnl + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.code | string | No | the currency code to fetch positions for, USD, BTC or USDT, USDT is the default | +| params.method | string | No | *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetGAccountsAccountPositions' default is 'privateGetGAccountsAccountPositions' | + + +```javascript +phemex.fetchPositions ([symbols, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#futureDataFundingFeesHist + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchFundingRate (symbol[, params]) +``` + + + + +### setMargin{docsify-ignore} +Either adds or reduces margin in an isolated position in order to set the margin to a specific value + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - A [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#assign-position-balance-in-isolated-marign-mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market to set margin in | +| amount | float | Yes | the amount to set the margin to | +| params | object | No | parameters specific to the exchange API endpoint | + + +```javascript +phemex.setMargin (symbol, amount[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - response from the exchange + +**See**: https://phemex-docs.github.io/#set-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - response from the exchange + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#switch-position-mode-synchronously + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by binance setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure), indexed by market symbols + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchLeverageTiers (symbols[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - response from the exchange + +**See**: https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#set-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage, 100 > leverage > -100 excluding numbers between -1 to 1 | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.hedged | bool | No | set to true if hedged position mode is enabled (by default long and short leverage are set to the same value) | +| params.longLeverageRr | float | No | *hedged mode only* set the leverage for long positions | +| params.shortLeverageRr | float | No | *hedged mode only* set the leverage for short positions | + + +```javascript +phemex.setLeverage (leverage, symbol[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See** + +- https://phemex-docs.github.io/#transfer-between-spot-and-futures +- https://phemex-docs.github.io/#universal-transfer-main-account-only-transfer-between-sub-to-main-main-to-sub-or-sub-to-sub + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.bizType | string | No | for transferring between main and sub-acounts either 'SPOT' or 'PERPETUAL' default is 'SPOT' | + + +```javascript +phemex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://phemex-docs.github.io/#query-transfer-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchTransfers (code[, since, limit, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://phemex-docs.github.io/#query-funding-rate-history-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | +| params.until | int | No | timestamp in ms of the latest funding rate | + + +```javascript +phemex.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [transaction structure](https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure) + +**See**: https://phemex-docs.github.io/#create-withdraw-request + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the phemex api endpoint | +| params.network | string | No | unified network code | + + +```javascript +phemex.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchOpenInterest{docsify-ignore} +retrieves the open interest of a trading pair + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - an open interest structure[https://docs.ccxt.com/#/?id=open-interest-structure](https://docs.ccxt.com/#/?id=open-interest-structure) + +**See**: https://phemex-docs.github.io/#query-24-hours-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified CCXT market symbol | +| params | object | No | exchange specific parameters | + + +```javascript +phemex.fetchOpenInterest (symbol[, params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://phemex-docs.github.io/#rfq-quote + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | Yes | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.fetchConvertQuote (fromCode, toCode, amount[, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://phemex-docs.github.io/#convert + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.createConvertTrade (id, fromCode, toCode[, amount, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://phemex-docs.github.io/#query-convert-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve, default 20, max 200 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | string | No | the end time in ms | +| params.fromCurrency | string | No | the currency that you sold and converted from | +| params.toCurrency | string | No | the currency that you bought and converted into | + + +```javascript +phemex.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-account-order-position-aop +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-account-order-position-aop +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-wallet-order-messages + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.settle | string | No | set to USDT to use hedged perpetual api | + + +```javascript +phemex.watchBalance ([params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-24-hours-ticker +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-24-hours-ticker +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-24-hours-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-24-hours-ticker +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-24-hours-ticker +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-24-hours-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers | + + +```javascript +phemex.watchTickers ([symbols, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-trade +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-trade +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-trade + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [phemex](#phemex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-orderbook +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-orderbook-for-new-model +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-30-levels-orderbook +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-full-orderbook + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#subscribe-kline +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Contract-API-en.md#subscribe-kline +- https://github.com/phemex/phemex-api-docs/blob/master/Public-Spot-API-en.md#subscribe-kline + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [phemex](#phemex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +phemex.watchOrders (symbol[, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/poloniex.md b/docs/ccxt/wiki/exchanges/poloniex.md new file mode 100644 index 0000000..3e916e6 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/poloniex.md @@ -0,0 +1,834 @@ + + + +## poloniex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchOHLCV](#fetchohlcv) +* [fetchMarkets](#fetchmarkets) +* [fetchTime](#fetchtime) +* [fetchTickers](#fetchtickers) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrderTrades](#fetchordertrades) +* [fetchBalance](#fetchbalance) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOrderBook](#fetchorderbook) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchDeposits](#fetchdeposits) +* [setLeverage](#setleverage) +* [fetchLeverage](#fetchleverage) +* [fetchPositionMode](#fetchpositionmode) +* [setPositionMode](#setpositionmode) +* [fetchPositions](#fetchpositions) +* [reduceMargin](#reducemargin) +* [addMargin](#addmargin) + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://api-docs.poloniex.com/spot/api/public/market-data#candles +- https://api-docs.poloniex.com/v3/futures/api/market/get-kline-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +poloniex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for poloniex + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://api-docs.poloniex.com/spot/api/public/reference-data#symbol-information +- https://api-docs.poloniex.com/v3/futures/api/market/get-all-product-info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchMarkets ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://api-docs.poloniex.com/spot/api/public/reference-data#system-timestamp + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchTime ([params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/public/market-data#ticker +- https://api-docs.poloniex.com/v3/futures/api/market/get-market-info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchTickers (symbols[, params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - an associative dictionary of currencies + +**See**: https://api-docs.poloniex.com/spot/api/public/reference-data#currency-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchCurrencies ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/public/market-data#ticker +- https://api-docs.poloniex.com/v3/futures/api/market/get-market-info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://api-docs.poloniex.com/spot/api/public/market-data#trades +- https://api-docs.poloniex.com/v3/futures/api/market/get-execution-info + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/private/trade#trade-history +- https://api-docs.poloniex.com/v3/futures/api/trade/get-execution-details + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +poloniex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/private/order#open-orders +- https://api-docs.poloniex.com/spot/api/private/smart-order#open-orders // trigger orders +- https://api-docs.poloniex.com/v3/futures/api/trade/get-current-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | set true to fetch trigger orders instead of regular orders | + + +```javascript +poloniex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://api-docs.poloniex.com/v3/futures/api/trade/get-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest entry | + + +```javascript +poloniex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/private/order#create-order +- https://api-docs.poloniex.com/spot/api/private/smart-order#create-order // trigger orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order is triggered at | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | + + +```javascript +poloniex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/private/order#cancel-replace-order +- https://api-docs.poloniex.com/spot/api/private/smart-order#cancel-replace-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | No | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | + + +```javascript +poloniex.editOrder (id, symbol, type, side[, amount, price, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/private/order#cancel-all-orders +- https://api-docs.poloniex.com/spot/api/private/smart-order#cancel-all-orders // trigger orders +- https://api-docs.poloniex.com/v3/futures/api/trade/cancel-all-orders - contract markets + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if canceling trigger orders | + + +```javascript +poloniex.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetch an order by it's id + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/private/order#order-details +- https://api-docs.poloniex.com/spot/api/private/smart-order#open-orders // trigger orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | true if fetching a trigger order | + + +```javascript +poloniex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/trade#trades-by-order-id + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://api-docs.poloniex.com/spot/api/private/account#all-account-balances +- https://api-docs.poloniex.com/v3/futures/api/account/balance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchBalance ([params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://api-docs.poloniex.com/spot/api/private/account#fee-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchTradingFees ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://api-docs.poloniex.com/spot/api/public/market-data#order-book +- https://api-docs.poloniex.com/v3/futures/api/market/get-order-book + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/wallet#deposit-addresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/wallet#deposit-addresses + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchDepositAddress (code[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/account#accounts-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/wallet#withdraw-currency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/wallet#wallets-activity-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/wallet#wallets-activity-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<object> - a list of [fees structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://api-docs.poloniex.com/spot/api/public/reference-data#currency-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://api-docs.poloniex.com/spot/api/private/wallet#wallets-activity-records + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchDeposits (code[, since, limit, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - response from the exchange + +**See**: https://api-docs.poloniex.com/v3/futures/api/positions/set-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | int | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | 'cross' or 'isolated' | + + +```javascript +poloniex.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://api-docs.poloniex.com/v3/futures/api/positions/get-leverages + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchLeverage (symbol[, params]) +``` + + + + +### fetchPositionMode{docsify-ignore} +fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - an object detailing whether the market is in hedged or one-way mode + +**See**: https://api-docs.poloniex.com/v3/futures/api/positions/position-mode-switch + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.fetchPositionMode (symbol[, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - response from the exchange + +**See**: https://api-docs.poloniex.com/v3/futures/api/positions/position-mode-switch + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use dualSidePosition | +| symbol | string | Yes | not used by binance setPositionMode () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://api-docs.poloniex.com/v3/futures/api/positions/get-current-position + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.standard | boolean | No | whether to fetch standard contract positions | + + +```javascript +poloniex.fetchPositions (symbols[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | the amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.reduceMargin (symbol, amount[, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [poloniex](#poloniex) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +poloniex.addMargin (symbol, amount[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/probit.md b/docs/ccxt/wiki/exchanges/probit.md new file mode 100644 index 0000000..a060fcf --- /dev/null +++ b/docs/ccxt/wiki/exchanges/probit.md @@ -0,0 +1,677 @@ + + + +## probit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchTime](#fetchtime) +* [fetchOHLCV](#fetchohlcv) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrder](#fetchorder) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDepositAddresses](#fetchdepositaddresses) +* [withdraw](#withdraw) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [signIn](#signin) +* [watchBalance](#watchbalance) +* [watchTicker](#watchticker) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchOrders](#watchorders) +* [watchOrderBook](#watchorderbook) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for probit + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs-en.probit.com/reference/market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [probit](#probit) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs-en.probit.com/reference/currency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchCurrencies ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [probit](#probit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs-en.probit.com/reference/balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [probit](#probit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs-en.probit.com/reference/order_book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [probit](#probit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs-en.probit.com/reference/ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [probit](#probit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs-en.probit.com/reference/ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchTicker (symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs-en.probit.com/reference/trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs-en.probit.com/reference/trade-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [probit](#probit) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs-en.probit.com/reference/time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchTime ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs-en.probit.com/reference/candle + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | string | No | timestamp in ms of the earliest candle to fetch | + + +```javascript +probit.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs-en.probit.com/reference/open_order-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs-en.probit.com/reference/order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [probit](#probit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs-en.probit.com/reference/order-3 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchOrder (id, symbol[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [probit](#probit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs-en.probit.com/reference/order-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | the quote quantity that can be used as an alternative for the amount for market buy orders | + + +```javascript +probit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [probit](#probit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs-en.probit.com/reference/order-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [probit](#probit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs-en.probit.com/reference/deposit_address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddresses{docsify-ignore} +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance method of [probit](#probit) +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs-en.probit.com/reference/deposit_address + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchDepositAddresses (codes[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [probit](#probit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs-en.probit.com/reference/withdrawal + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of transaction structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made to an account + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of transaction structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs-en.probit.com/reference/transferpayment + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch transactions for | +| limit | int | No | the maximum number of transaction structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch transactions for | + + +```javascript +probit.fetchDepositsWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<object> - a list of [fees structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs-en.probit.com/reference/currency + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### signIn{docsify-ignore} +sign in, must be called prior to using other authenticated methods + +**Kind**: instance method of [probit](#probit) +**Returns**: response from exchange + +**See**: https://docs-en.probit.com/reference/token + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.signIn ([params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [probit](#probit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs-en.probit.com/reference/balance-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.watchBalance ([params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [probit](#probit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs-en.probit.com/reference/marketdata + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.interval | int | No | Unit time to synchronize market information (ms). Available units: 100, 500 | + + +```javascript +probit.watchTicker (symbol[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs-en.probit.com/reference/trade_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.interval | int | No | Unit time to synchronize market information (ms). Available units: 100, 500 | + + +```javascript +probit.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +get the list of trades associated with the user + +**Kind**: instance method of [probit](#probit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs-en.probit.com/reference/trade_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on an order made by the user + +**Kind**: instance method of [probit](#probit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs-en.probit.com/reference/open_order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market the order was made in | +| since | int | No | timestamp in ms of the earliest order to watch | +| limit | int | No | the maximum amount of orders to watch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.channel | string | No | choose what channel to use. Can open_order or order_history. | + + +```javascript +probit.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [probit](#probit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs-en.probit.com/reference/marketdata + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +probit.watchOrderBook (symbol[, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/timex.md b/docs/ccxt/wiki/exchanges/timex.md new file mode 100644 index 0000000..f0c56d6 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/timex.md @@ -0,0 +1,466 @@ + + + +## timex{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchDepositAddress](#fetchdepositaddress) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [timex](#timex) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for timex + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listMarkets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [timex](#timex) +**Returns**: object - an associative dictionary of currencies + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCurrencies + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchCurrencies ([params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Manager/getDeposits + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made to an account + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Manager/getWithdraws + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of transaction structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [timex](#timex) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [timex](#timex) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchTicker (symbol[, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [timex](#timex) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/orderbookV2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listTrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Public/listCandles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +timex.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [timex](#timex) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getBalances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [timex](#timex) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/createOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [timex](#timex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/deleteOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by timex cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [timex](#timex) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/deleteOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | Yes | unified market symbol, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.cancelOrders (ids, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [timex](#timex) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getOrderDetails + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by timex fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getOpenOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getOrders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [timex](#timex) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/History/getTrades_1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [timex](#timex) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Trading/getFees + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account, does not accept params["network"] + +**Kind**: instance method of [timex](#timex) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://plasma-relay-backend.timex.io/swagger-ui/index.html?urls.primaryName=Relay#/Currency/selectCurrencyBySymbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +timex.fetchDepositAddress (code[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/tokocrypto.md b/docs/ccxt/wiki/exchanges/tokocrypto.md new file mode 100644 index 0000000..e1f3f1c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/tokocrypto.md @@ -0,0 +1,483 @@ + + + +## tokocrypto{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchOHLCV](#fetchohlcv) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [cancelOrder](#cancelorder) +* [fetchMyTrades](#fetchmytrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://www.tokocrypto.com/apidocs/#check-server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for tokocrypto + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://www.tokocrypto.com/apidocs/#get-all-supported-trading-symbol + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://www.tokocrypto.com/apidocs/#order-book + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://www.tokocrypto.com/apidocs/#recent-trades-list +- https://www.tokocrypto.com/apidocs/#compressedaggregate-trades-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://binance-docs.github.io/apidocs/spot/en/#24hr-ticker-price-change-statistics + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://binance-docs.github.io/apidocs/spot/en/#24hr-ticker-price-change-statistics + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchTicker (symbol[, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://binance-docs.github.io/apidocs/spot/en/#symbol-order-book-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchBidsAsks (symbols[, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.price | string | No | "mark" or "index" for mark price and index price candles | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +tokocrypto.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://www.tokocrypto.com/apidocs/#account-information-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | 'future', 'delivery', 'savings', 'funding', or 'spot' | +| params.marginMode | string | No | 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null | +| params.symbols | Array<string>, undefined | No | unified market symbols, only used in isolated margin mode | + + +```javascript +tokocrypto.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.tokocrypto.com/apidocs/#new-order--signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | the price at which a trigger order would be triggered | +| params.cost | float | No | for spot market buy orders, the quote quantity that can be used as an alternative for the amount | + + +```javascript +tokocrypto.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.tokocrypto.com/apidocs/#query-order-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.tokocrypto.com/apidocs/#all-orders-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.tokocrypto.com/apidocs/#all-orders-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.tokocrypto.com/apidocs/#all-orders-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://www.tokocrypto.com/apidocs/#cancel-order-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://www.tokocrypto.com/apidocs/#account-trade-list-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://www.tokocrypto.com/apidocs/#deposit-address-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.tokocrypto.com/apidocs/#deposit-history-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch deposits for | + + +```javascript +tokocrypto.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.tokocrypto.com/apidocs/#withdraw-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [tokocrypto](#tokocrypto) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://www.tokocrypto.com/apidocs/#withdraw-signed + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +tokocrypto.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/toobit.md b/docs/ccxt/wiki/exchanges/toobit.md new file mode 100644 index 0000000..122c29c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/toobit.md @@ -0,0 +1,1113 @@ + + + +## toobit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchTickers](#fetchtickers) +* [fetchLastPrices](#fetchlastprices) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchBalance](#fetchbalance) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchOrders](#fetchorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchMyTrades](#fetchmytrades) +* [transfer](#transfer) +* [fetchLedger](#fetchledger) +* [fetchTradingFees](#fetchtradingfees) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) +* [setMarginMode](#setmarginmode) +* [setLeverage](#setleverage) +* [fetchLeverage](#fetchleverage) +* [fetchPositions](#fetchpositions) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOHLCV](#watchohlcv) +* [watchOHLCVForSymbols](#watchohlcvforsymbols) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchOrderBook](#watchorderbook) +* [watchOrderBookForSymbols](#watchorderbookforsymbols) +* [watchBalance](#watchbalance) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchPositions](#watchpositions) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#test-connectivity + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [toobit](#toobit) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#check-server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchTime ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - an associative dictionary of currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchCurrencies ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for toobit + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#exchange-information +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#exchange-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#order-book +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#order-book + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get a list of the most recent trades for a particular symbol + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#recent-trades-list +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#recent-trades-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum number of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#kline-candlestick-data +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#kline-candlestick-data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#24hr-ticker-price-change-statistics +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#24hr-ticker-price-change-statistics + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchTickers (symbols[, params]) +``` + + + + +### fetchLastPrices{docsify-ignore} +fetches the last price for multiple markets + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a dictionary of lastprices structures + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#symbol-price-ticker +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#symbol-price-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the last prices | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchLastPrices (symbols[, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#symbol-order-book-ticker +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#symbol-order-book-ticker + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchBidsAsks ([symbols, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [funding rates structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexe by market symbols + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#funding-rate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#get-funding-rate-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +toobit.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#account-information-user_data +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#futures-account-balance-user_data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpointinvalid | + + +```javascript +toobit.fetchBalance ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#new-order-trade +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#new-order-trade + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market', 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#cancel-order-trade +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#cancel-order-trade + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#cancel-all-open-orders-trade +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#cancel-orders-trade + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#cancel-multiple-orders-trade +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#cancel-multiple-orders-trade + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.cancelOrders (ids[, symbol, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#query-order-user_data +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-order-user_data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#current-open-orders-user_data +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-current-open-order-user_data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#all-orders-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-history-orders-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#account-trade-list-user_data +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#account-trade-list-user_data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch trades for | + + +```javascript +toobit.fetchMyTrades ([symbol, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://open.big.one/docs/spot_transfer.html#transfer-of-user + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | 'spot', 'swap' | +| toAccount | string | Yes | 'spot', 'swap' | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See** + +- https://toobit-docs.github.io/apidocs/spot/v1/en/#get-account-transaction-history-list-user_data +- https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#get-future-account-transaction-history-list-user_data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | end time in ms | + + +```javascript +toobit.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#user-trade-fee-rate-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchTradingFees ([params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#deposit-history-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposit structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchDeposits ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#withdrawal-records-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawal structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#deposit-address-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#withdraw-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | a memo for the transaction | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.withdraw (code, amount, address, tag[, params]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - response from the exchange + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#change-margin-type-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.setMarginMode (marginMode, symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - response from the exchange + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#change-initial-leverage-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.setLeverage (leverage, symbol[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#get-the-leverage-multiple-and-position-mode-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchLeverage (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-position-user_data + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.fetchPositions (symbols[, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#trade-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#trade-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.name | string | No | the name of the method to call, 'trade' or 'aggTrade', default is 'trade' | + + +```javascript +toobit.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#kline-candlestick-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOHLCVForSymbols{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#kline-candlestick-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbolsAndTimeframes | Array<Array<string>> | Yes | array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchOHLCVForSymbols (symbolsAndTimeframes[, since, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#individual-symbol-ticker-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#individual-symbol-ticker-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchTickers (symbols[, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#partial-book-depth-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOrderBookForSymbols{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#partial-book-depth-streams + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified array of symbols | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchOrderBookForSymbols (symbols[, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [toobit](#toobit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#payload-account-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchBalance ([params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#payload-order-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://toobit-docs.github.io/apidocs/spot/v1/en/#payload-ticket-push + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.unifiedMargin | boolean | No | use unified margin account | + + +```javascript +toobit.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [toobit](#toobit) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#event-position-update + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum number of positions to retrieve | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +toobit.watchPositions ([symbols, since, limit, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/upbit.md b/docs/ccxt/wiki/exchanges/upbit.md new file mode 100644 index 0000000..964f9f6 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/upbit.md @@ -0,0 +1,909 @@ + + + +## upbit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBooks](#fetchorderbooks) +* [fetchOrderBook](#fetchorderbook) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOHLCV](#fetchohlcv) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [editOrder](#editorder) +* [fetchDeposits](#fetchdeposits) +* [fetchDeposit](#fetchdeposit) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchWithdrawal](#fetchwithdrawal) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [fetchOrder](#fetchorder) +* [fetchDepositAddresses](#fetchdepositaddresses) +* [fetchDepositAddress](#fetchdepositaddress) +* [createDepositAddress](#createdepositaddress) +* [withdraw](#withdraw) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchTrades](#watchtrades) +* [watchTradesForSymbols](#watchtradesforsymbols) +* [watchOrderBook](#watchorderbook) +* [watchOHLCV](#watchohlcv) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchBalance](#watchbalance) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for upbit + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://docs.upbit.com/kr/reference/마켓-코드-조회 +- https://global-docs.upbit.com/reference/listing-market-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.upbit.com/kr/reference/전체-계좌-조회 +- https://global-docs.upbit.com/reference/overall-account-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchBalance ([params]) +``` + + + + +### fetchOrderBooks{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbol + +**See** + +- https://docs.upbit.com/kr/reference/호가-정보-조회 +- https://global-docs.upbit.com/reference/order-book-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols, all symbols fetched if undefined, default is undefined | +| limit | int | No | not used by upbit fetchOrderBooks () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchOrderBooks (symbols[, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.upbit.com/kr/reference/호가-정보-조회 +- https://global-docs.upbit.com/reference/order-book-list + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.upbit.com/kr/reference/ticker현재가-정보 +- https://global-docs.upbit.com/reference/tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See** + +- https://docs.upbit.com/kr/reference/ticker현재가-정보 +- https://global-docs.upbit.com/reference/tickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See** + +- https://docs.upbit.com/kr/reference/최근-체결-내역 +- https://global-docs.upbit.com/reference/today-trades-history + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://docs.upbit.com/kr/reference/주문-가능-정보 +- https://global-docs.upbit.com/reference/available-order-information + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for markets + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [trading fee structure](https://docs.ccxt.com/#/?id=trading-fee-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchTradingFees ([params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://docs.upbit.com/kr/reference/분minute-캔들-1 +- https://global-docs.upbit.com/reference/minutes + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.upbit.com/kr/reference/주문하기 +- https://global-docs.upbit.com/reference/order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | supports 'market' and 'limit'. if params.ordType is set to best, a best-type order will be created regardless of the value of type. | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | for market buy and best buy orders, the quote quantity that can be used as an alternative for the amount | +| params.ordType | string | No | this field can be used to place a ‘best’ type order | +| params.timeInForce | string | No | 'IOC' or 'FOK'. only for limit or best type orders. this field is required when the order type is 'best'. | + + +```javascript +upbit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.upbit.com/kr/reference/주문-취소 +- https://global-docs.upbit.com/reference/order-cancel + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by upbit cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.cancelOrder (id, symbol[, params]) +``` + + + + +### editOrder{docsify-ignore} +canceled existing order and create new order. It's only generated same side and symbol as the canceled order. it returns the data of the canceled order, except for `new_order_uuid` and `new_identifier`. to get the details of the new order, use `fetchOrder(new_order_uuid)`. + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.upbit.com/kr/reference/취소-후-재주문 +- https://global-docs.upbit.com/reference/cancel-and-new + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the uuid of the previous order you want to edit. | +| symbol | string | Yes | the symbol of the new order. it must be the same as the symbol of the previous order. | +| type | string | Yes | the type of the new order. only limit or market is accepted. if params.newOrdType is set to best, a best-type order will be created regardless of the value of type. | +| side | string | Yes | the side of the new order. it must be the same as the side of the previous order. | +| amount | number | Yes | the amount of the asset you want to buy or sell. It could be overridden by specifying the new_volume parameter in params. | +| price | number | Yes | the price of the asset you want to buy or sell. It could be overridden by specifying the new_price parameter in params. | +| params | object | No | extra parameters specific to the exchange API endpoint. | +| params.clientOrderId | string | No | to identify the previous order, either the id or this field is required in this method. | +| params.cost | float | No | for market buy and best buy orders, the quote quantity that can be used as an alternative for the amount. | +| params.newTimeInForce | string | No | 'IOC' or 'FOK'. only for limit or best type orders. this field is required when the order type is 'best'. | +| params.newClientOrderId | string | No | the order ID that the user can define. | +| params.newOrdType | string | No | this field only accepts limit, price, market, or best. You can refer to the Upbit developer documentation for details on how to use this field. | + + +```javascript +upbit.editOrder (id, symbol, type, side, amount, price[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.upbit.com/kr/reference/입금-리스트-조회 +- https://global-docs.upbit.com/reference/deposit-list-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch information on a deposit + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.upbit.com/kr/reference/개별-입금-조회 +- https://global-docs.upbit.com/reference/individual-deposit-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the unique id for the deposit | +| code | string | No | unified currency code of the currency deposited | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.txid | string | No | withdrawal transaction id, the id argument is reserved for uuid | + + +```javascript +upbit.fetchDeposit (id[, code, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.upbit.com/kr/reference/전체-출금-조회 +- https://global-docs.upbit.com/reference/withdrawal-list-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchWithdrawal{docsify-ignore} +fetch data on a currency withdrawal via the withdrawal id + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.upbit.com/kr/reference/개별-출금-조회 +- https://global-docs.upbit.com/reference/individual-withdrawal-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the unique id for the withdrawal | +| code | string | No | unified currency code of the currency withdrawn | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.txid | string | No | withdrawal transaction id, the id argument is reserved for uuid | + + +```javascript +upbit.fetchWithdrawal (id[, code, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.upbit.com/kr/reference/대기-주문-조회 +- https://global-docs.upbit.com/reference/open-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.state | string | No | default is 'wait', set to 'watch' for stop limit orders | + + +```javascript +upbit.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.upbit.com/kr/reference/종료-주문-조회 +- https://global-docs.upbit.com/reference/closed-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest order | + + +```javascript +upbit.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.upbit.com/kr/reference/종료-주문-조회 +- https://global-docs.upbit.com/reference/closed-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | timestamp in ms of the earliest order, default is undefined | +| limit | int | No | max number of orders to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest order | + + +```javascript +upbit.fetchCanceledOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.upbit.com/kr/reference/개별-주문-조회 +- https://global-docs.upbit.com/reference/individual-order-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by upbit fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchDepositAddresses{docsify-ignore} +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + +**See** + +- https://docs.upbit.com/kr/reference/전체-입금-주소-조회 +- https://global-docs.upbit.com/reference/general-deposit-address-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.fetchDepositAddresses (codes[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See** + +- https://docs.upbit.com/kr/reference/개별-입금-주소-조회 +- https://global-docs.upbit.com/reference/individual-deposit-address-inquiry + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | Yes | deposit chain, can view all chains via this.publicGetWalletAssets, default is eth, unless the currency has a default chain within this.options['networks'] | + + +```javascript +upbit.fetchDepositAddress (code[, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See** + +- https://docs.upbit.com/kr/reference/입금-주소-생성-요청 +- https://global-docs.upbit.com/reference/deposit-address-generation + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.createDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See** + +- https://docs.upbit.com/kr/reference/디지털자산-출금하기 +- https://global-docs.upbit.com/reference/withdrawal-digital-assets + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.withdraw (code, amount, address, tag[, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://global-docs.upbit.com/reference/websocket-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://global-docs.upbit.com/reference/websocket-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchTickers (symbols[, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://global-docs.upbit.com/reference/websocket-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchTradesForSymbols{docsify-ignore} +get the list of most recent trades for a list of symbols + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://global-docs.upbit.com/reference/websocket-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchTradesForSymbols (symbols[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://global-docs.upbit.com/reference/websocket-orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches information an OHLCV with timestamp, openingPrice, highPrice, lowPrice, tradePrice, baseVolume in 1s. + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<OHLCV> - a list of [OHLCV structures](https://docs.ccxt.com/#/?id=ohlcv-structure) + +**See** + +- https://docs.upbit.com/kr/reference/websocket-candle for Upbit KR +- https://global-docs.upbit.com/reference/websocket-candle for Upbit Global + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| timeframe | string | Yes | specifies the OHLCV candle interval to watch. As of now, Upbit only supports 1s candles. | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://global-docs.upbit.com/reference/websocket-myorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [upbit](#upbit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://global-docs.upbit.com/reference/websocket-myorder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [upbit](#upbit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://global-docs.upbit.com/reference/websocket-myasset + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +upbit.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/wavesexchange.md b/docs/ccxt/wiki/exchanges/wavesexchange.md new file mode 100644 index 0000000..feed22d --- /dev/null +++ b/docs/ccxt/wiki/exchanges/wavesexchange.md @@ -0,0 +1,421 @@ + + + +## wavesexchange{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [signIn](#signin) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOHLCV](#fetchohlcv) +* [fetchDepositAddress](#fetchdepositaddress) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchBalance](#fetchbalance) +* [fetchMyTrades](#fetchmytrades) +* [fetchTrades](#fetchtrades) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [withdraw](#withdraw) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for wavesexchange + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: Array<object> - an array of objects representing market data + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://matcher.waves.exchange/api-docs/index.html#/markets/getOrderBook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### signIn{docsify-ignore} +sign in, must be called prior to using other authenticated methods + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: response from exchange + +**See**: https://docs.wx.network/en/api/auth/oauth2-token + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.signIn ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://api.wavesplatform.com/v0/docs/#/pairs/getPairsListAll + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchTickers ([symbols, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://api.wavesplatform.com/v0/docs/#/candles/getCandles + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | + + +```javascript +wavesexchange.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchDepositAddress (code[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://matcher.waves.exchange/api-docs/index.html#/serialize/serializeOrder + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price at which a stop order is triggered at | + + +```javascript +wavesexchange.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://matcher.waves.exchange/api-docs/index.html#/cancel/cancelOrdersByIdsWithKeyOrSignature + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://matcher.waves.exchange/api-docs/index.html#/status/getOrderStatusByPKAndIdWithSig + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchBalance ([params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://api.wavesplatform.com/v0/docs/#/transactions/searchTxsExchange + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://api.wavesplatform.com/v0/docs/#/transactions/searchTxsExchange + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See** + +- https://docs.wx.network/en/api/gateways/deposit/currencies +- https://docs.wx.network/en/api/gateways/withdraw/currencies + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | list of unified currency codes | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [wavesexchange](#wavesexchange) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +wavesexchange.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/whitebit.md b/docs/ccxt/wiki/exchanges/whitebit.md new file mode 100644 index 0000000..ee89ee8 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/whitebit.md @@ -0,0 +1,1230 @@ + + + +## whitebit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTransactionFees](#fetchtransactionfees) +* [fetchDepositWithdrawFees](#fetchdepositwithdrawfees) +* [fetchTradingFees](#fetchtradingfees) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchOrderBook](#fetchorderbook) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchOHLCV](#fetchohlcv) +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [createMarketOrderWithCost](#createmarketorderwithcost) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchBalance](#fetchbalance) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchDepositAddress](#fetchdepositaddress) +* [createDepositAddress](#createdepositaddress) +* [setLeverage](#setleverage) +* [transfer](#transfer) +* [withdraw](#withdraw) +* [fetchDeposit](#fetchdeposit) +* [fetchDeposits](#fetchdeposits) +* [fetchBorrowInterest](#fetchborrowinterest) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [fetchPositionHistory](#fetchpositionhistory) +* [fetchPositions](#fetchpositions) +* [fetchPosition](#fetchposition) +* [fetchCrossBorrowRate](#fetchcrossborrowrate) +* [watchOHLCV](#watchohlcv) +* [watchOrderBook](#watchorderbook) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchTrades](#watchtrades) +* [watchMyTrades](#watchmytrades) +* [watchOrders](#watchorders) +* [watchBalance](#watchbalance) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for whitebit + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.whitebit.com/public/http-v4/#market-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.whitebit.com/public/http-v4/#asset-status-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchCurrencies ([params]) +``` + + + + +### fetchTransactionFees{docsify-ignore} +`DEPRECATED` + +please use fetchDepositWithdrawFees instead + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.whitebit.com/public/http-v4/#fee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | not used by fetchTransactionFees () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchTransactionFees (codes[, params]) +``` + + + + +### fetchDepositWithdrawFees{docsify-ignore} +fetch deposit and withdraw fees + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a list of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://docs.whitebit.com/public/http-v4/#fee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | not used by fetchDepositWithdrawFees () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchDepositWithdrawFees (codes[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://docs.whitebit.com/public/http-v4/#asset-status-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchTradingFees ([params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.whitebit.com/public/http-v4/#market-activity + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchTicker (symbol[, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.whitebit.com/public/http-v4/#market-activity + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either v2PublicGetTicker or v4PublicGetTicker default is v4PublicGetTicker | + + +```javascript +whitebit.fetchTickers ([symbols, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.whitebit.com/public/http-v4/#orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.whitebit.com/public/http-v4/#recent-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#query-executed-order-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.whitebit.com/public/http-v1/#kline + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://docs.whitebit.com/public/http-v4/#server-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://docs.whitebit.com/public/http-v4/#server-time + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchTime ([params]) +``` + + + + +### createMarketOrderWithCost{docsify-ignore} +create a market order by providing the symbol, side and cost + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| side | string | Yes | 'buy' or 'sell' | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.createMarketOrderWithCost (symbol, side, cost[, params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.whitebit.com/private/http-trade-v4/#create-limit-order +- https://docs.whitebit.com/private/http-trade-v4/#create-market-order +- https://docs.whitebit.com/private/http-trade-v4/#create-buy-stock-market-order +- https://docs.whitebit.com/private/http-trade-v4/#create-stop-limit-order +- https://docs.whitebit.com/private/http-trade-v4/#create-stop-market-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.cost | float | No | *market orders only* the cost of the order in units of the base currency | +| params.triggerPrice | float | No | The price at which a trigger order is triggered at | +| params.postOnly | bool | No | If true, the order will only be posted to the order book and not executed immediately | +| params.clientOrderId | string | No | a unique id for the order | +| params.marginMode | string | No | 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null | + + +```javascript +whitebit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#modify-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | cancel order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | Yes | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.editOrder (id, symbol, type, side, amount, price[, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#cancel-all-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | string | No | market type, ['swap', 'spot'] | +| params.isMargin | boolean | No | cancel all margin orders | + + +```javascript +whitebit.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - the api result + +**See**: https://docs.whitebit.com/private/http-trade-v4/#sync-kill-switch-timer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.types | string | No | Order types value. Example: "spot", "margin", "futures" or null | +| params.symbol | string | No | symbol unified symbol of the market the order was made in | + + +```javascript +whitebit.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.whitebit.com/private/http-main-v4/#main-balance +- https://docs.whitebit.com/private/http-trade-v4/#trading-balance + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchBalance ([params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#query-unexecutedactive-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchOpenOrders ([symbol, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#query-executed-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#query-executed-order-deals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See** + +- https://docs.whitebit.com/private/http-main-v4/#get-fiat-deposit-address +- https://docs.whitebit.com/private/http-main-v4/#get-cryptocurrency-deposit-address + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchDepositAddress (code[, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.whitebit.com/private/http-main-v4/#create-new-address-for-deposit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.network | string | No | the blockchain network to create a deposit address on | +| params.type | string | No | address type, available for specific currencies | + + +```javascript +whitebit.createDepositAddress (code[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - response from the exchange + +**See**: https://docs.whitebit.com/private/http-trade-v4/#change-collateral-account-leverage + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.setLeverage (leverage, symbol[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.whitebit.com/private/http-main-v4/#transfer-between-main-and-trade-balances + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from - main, spot, collateral | +| toAccount | string | Yes | account to transfer to - main, spot, collateral | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.whitebit.com/private/http-main-v4/#create-withdraw-request + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchDeposit{docsify-ignore} +fetch information on a deposit + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | deposit id | +| code | string | Yes | not used by whitebit fetchDeposit () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchDeposit (id, code[, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchBorrowInterest{docsify-ignore} +fetch the interest owed by the user for borrowing currency for margin trading + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [borrow interest structures](https://docs.ccxt.com/#/?id=borrow-interest-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#open-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch borrrow interest for | +| limit | int | No | the maximum number of structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchBorrowInterest (code, symbol[, since, limit, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://docs.whitebit.com/public/http-v4/#available-futures-markets-list + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [funding history structures](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#funding-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the starting timestamp in milliseconds | +| limit | int | No | the number of entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch funding history for | + + +```javascript +whitebit.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://github.com/whitebit-exchange/api-docs/blob/main/pages/private/http-main-v4.md#get-depositwithdraw-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100 | +| params | object | No | extra parameters specific to the exchange API endpoint EXCHANGE SPECIFIC PARAMETERS | +| params.transactionMethod | number | No | Method. Example: 1 to display deposits / 2 to display withdraws. Do not send this parameter in order to receive both deposits and withdraws. | +| params.address | string | No | Can be used for filtering transactions by specific address or memo. | +| params.addresses | Array<string> | No | Can be used for filtering transactions by specific addresses or memos (max: 20). | +| params.uniqueId | string | No | Can be used for filtering transactions by specific unique id | +| params.offset | int | No | If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000 | +| params.status | Array<string> | No | Can be used for filtering transactions by status codes. Caution: You must use this parameter with appropriate transactionMethod and use valid status codes for this method. You can find them below. Example: "status": [3,7] | + + +```javascript +whitebit.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#convert-estimate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | Yes | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchConvertQuote (fromCode, toCode, amount[, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#convert-confirm + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.createConvertTrade (id, fromCode, toCode[, amount, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#convert-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve, default 20, max 200 | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | string | No | the end time in ms | +| params.fromTicker | string | No | the currency that you sold and converted from | +| params.toTicker | string | No | the currency that you bought and converted into | +| params.quoteId | string | No | the quote id of the conversion | + + +```javascript +whitebit.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### fetchPositionHistory{docsify-ignore} +fetches historical positions + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#positions-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified contract symbol | +| since | int | No | the earliest time in ms to fetch positions for | +| limit | int | No | the maximum amount of records to fetch | +| params | object | No | extra parameters specific to the exchange api endpoint | +| params.positionId | int | No | the id of the requested position | + + +```javascript +whitebit.fetchPositionHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [position structures](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#open-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchPositions ([symbols, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://docs.whitebit.com/private/http-trade-v4/#open-positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchPosition (symbol[, params]) +``` + + + + +### fetchCrossBorrowRate{docsify-ignore} +fetch the rate of interest to borrow a currency for margin trading + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [borrow rate structure](https://docs.ccxt.com/#/?id=borrow-rate-structure) + +**See**: https://docs.whitebit.com/private/http-main-v4/#get-plans + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.fetchCrossBorrowRate (code[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.whitebit.com/public/websocket/#kline + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.whitebit.com/public/websocket/#market-depth + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.whitebit.com/public/websocket/#market-statistics + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.whitebit.com/public/websocket/#market-statistics + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.watchTickers ([symbols, params]) +``` + + + + +### watchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.whitebit.com/public/websocket/#market-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches trades made by the user + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.whitebit.com/private/websocket/#deals + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | str | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.whitebit.com/private/websocket/#orders-pending + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +whitebit.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [whitebit](#whitebit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See** + +- https://docs.whitebit.com/private/websocket/#balance-spot +- https://docs.whitebit.com/private/websocket/#balance-margin + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.type | str | No | spot or contract if not provided this.options['defaultType'] is used | + + +```javascript +whitebit.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/woo.md b/docs/ccxt/wiki/exchanges/woo.md new file mode 100644 index 0000000..3e7875e --- /dev/null +++ b/docs/ccxt/wiki/exchanges/woo.md @@ -0,0 +1,1560 @@ + + + +## woo{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchTrades](#fetchtrades) +* [fetchTradingFee](#fetchtradingfee) +* [fetchTradingFees](#fetchtradingfees) +* [fetchCurrencies](#fetchcurrencies) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createMarketSellOrderWithCost](#createmarketsellorderwithcost) +* [createTrailingAmountOrder](#createtrailingamountorder) +* [createTrailingPercentOrder](#createtrailingpercentorder) +* [createOrder](#createorder) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelAllOrdersAfter](#cancelallordersafter) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchAccounts](#fetchaccounts) +* [fetchBalance](#fetchbalance) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchLedger](#fetchledger) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [transfer](#transfer) +* [fetchTransfers](#fetchtransfers) +* [withdraw](#withdraw) +* [repayMargin](#repaymargin) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [setPositionMode](#setpositionmode) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [addMargin](#addmargin) +* [reduceMargin](#reducemargin) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [fetchConvertQuote](#fetchconvertquote) +* [createConvertTrade](#createconverttrade) +* [fetchConvertTrade](#fetchconverttrade) +* [fetchConvertTradeHistory](#fetchconverttradehistory) +* [fetchConvertCurrencies](#fetchconvertcurrencies) +* [watchOrderBook](#watchorderbook) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [watchTrades](#watchtrades) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchPositions](#watchpositions) +* [watchBalance](#watchbalance) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/systemInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [woo](#woo) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/systemInfo + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for woo + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/instruments + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchMarkets ([params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/marketTrades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFee{docsify-ignore} +fetch the trading fees for a market + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [fee structure](https://docs.ccxt.com/#/?id=fee-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/trading/get_tradingFee + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.portfolioMargin | boolean | No | set to true if you would like to fetch trading fees in a portfolio margin account | +| params.subType | string | No | "linear" or "inverse" | + + +```javascript +woo.fetchTradingFee (symbol[, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://developer.woox.io/api-reference/endpoint/account/get_account_info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchTradingFees ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.woox.io/#available-token-public + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchCurrencies ([params]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.woox.io/#send-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createMarketSellOrderWithCost{docsify-ignore} +create a market sell order by providing the symbol and cost + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.woox.io/#send-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.createMarketSellOrderWithCost (symbol, cost[, params]) +``` + + + + +### createTrailingAmountOrder{docsify-ignore} +create a trailing order by providing the symbol, type, side, amount, price and trailingAmount + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.woox.io/#send-algo-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, or number of contracts | +| price | float | No | the price for the order to be filled at, in units of the quote currency, ignored in market orders | +| trailingAmount | float | Yes | the quote amount to trail away from the current market price | +| trailingTriggerPrice | float | Yes | the price to activate a trailing order, default uses the price argument | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.createTrailingAmountOrder (symbol, type, side, amount[, price, trailingAmount, trailingTriggerPrice, params]) +``` + + + + +### createTrailingPercentOrder{docsify-ignore} +create a trailing order by providing the symbol, type, side, amount, price and trailingPercent + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.woox.io/#send-algo-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency, or number of contracts | +| price | float | No | the price for the order to be filled at, in units of the quote currency, ignored in market orders | +| trailingPercent | float | Yes | the percent to trail away from the current market price | +| trailingTriggerPrice | float | Yes | the price to activate a trailing order, default uses the price argument | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.createTrailingPercentOrder (symbol, type, side, amount[, price, trailingPercent, trailingTriggerPrice, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/trading/post_order +- https://developer.woox.io/api-reference/endpoint/trading/post_algo_order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | *for swap markets only* 'cross' or 'isolated', default 'cross' | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.algoType | float | No | 'STOP' or 'TRAILING_STOP' or 'OCO' or 'CLOSE_POSITION' | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.trailingAmount | string | No | the quote amount to trail away from the current market price | +| params.trailingPercent | string | No | the percent to trail away from the current market price | +| params.trailingTriggerPrice | string | No | the price to trigger a trailing order, default uses the price argument | +| params.position_side | string | No | 'SHORT' or 'LONG' - if position mode is HEDGE_MODE and the trading involves futures, then is required, otherwise this parameter is not required | + + +```javascript +woo.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.woox.io/#edit-order +- https://docs.woox.io/#edit-order-by-client_order_id +- https://docs.woox.io/#edit-algo-order +- https://docs.woox.io/#edit-algo-order-by-client_order_id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.stopLossPrice | float | No | price to trigger stop-loss orders | +| params.takeProfitPrice | float | No | price to trigger take-profit orders | +| params.trailingAmount | string | No | the quote amount to trail away from the current market price | +| params.trailingPercent | string | No | the percent to trail away from the current market price | +| params.trailingTriggerPrice | string | No | the price to trigger a trailing order, default uses the price argument | + + +```javascript +woo.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [woo](#woo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/trading/cancel_order +- https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a trigger/algo order | + + +```javascript +woo.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/trading/cancel_all_order +- https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a trigger/algo order | + + +```javascript +woo.cancelAllOrders (symbol[, params]) +``` + + + + +### cancelAllOrdersAfter{docsify-ignore} +dead man's switch, cancel all orders after the given timeout + +**Kind**: instance method of [woo](#woo) +**Returns**: object - the api result + +**See**: https://developer.woox.io/api-reference/endpoint/trading/cancel_all_after + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| timeout | number | Yes | time in milliseconds, 0 represents cancel the timer | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.cancelAllOrdersAfter (timeout[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [woo](#woo) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/trading/get_order +- https://developer.woox.io/api-reference/endpoint/trading/get_algo_order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a trigger/algo order | + + +```javascript +woo.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/trading/get_orders +- https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a trigger/algo order | +| params.isTriggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +woo.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/trading/get_orders +- https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a trigger/algo order | +| params.isTriggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +woo.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/trading/get_orders +- https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a trigger/algo order | +| params.isTriggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.trailing | boolean | No | set to true if you want to fetch trailing orders | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +woo.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [woo](#woo) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/klineHistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms))) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +woo.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.woox.io/#get-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/trading/get_transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | set to true if you want to fetch trades with pagination | + + +```javascript +woo.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchAccounts{docsify-ignore} +fetch all the accounts associated with a profile + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a dictionary of [account structures](https://docs.ccxt.com/#/?id=account-structure) indexed by the account type + +**See** + +- https://developer.woox.io/api-reference/endpoint/account/get_account_info +- https://developer.woox.io/api-reference/endpoint/account/sub_accounts + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchAccounts ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.woox.io/#get-current-holding-get-balance-new + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchBalance ([params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/assets/get_wallet_deposit + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchDepositAddress (code[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered balance of the user + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.woox.io/#get-transfer-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### fetchTransfers{docsify-ignore} +fetch a history of internal transfers made on an account + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [transfer structures](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/assets/get_transfer_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency transferred | +| since | int | No | the earliest time in ms to fetch transfers for | +| limit | int | No | the maximum number of transfers structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | the latest time in ms to fetch entries for | + + +```javascript +woo.fetchTransfers (code[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.woox.io/#token-withdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.withdraw (code, amount, address, tag[, params]) +``` + + + + +### repayMargin{docsify-ignore} +repay borrowed margin and interest + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [margin loan structure](https://docs.ccxt.com/#/?id=margin-loan-structure) + +**See**: https://docs.woox.io/#repay-interest + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency to repay | +| amount | float | Yes | the amount to repay | +| symbol | string | Yes | not used by woo.repayMargin () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.repayMargin (code, amount, symbol[, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/futures/get_fundingFee_history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +woo.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/fundingRate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/fundingRate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the funding rate for multiple markets + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rates-structure), indexed by market symbols + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/fundingRate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/public_data/fundingRateHistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +woo.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### setPositionMode{docsify-ignore} +set hedged to true or false for a market + +**Kind**: instance method of [woo](#woo) +**Returns**: object - response from the exchange + +**See**: https://developer.woox.io/api-reference/endpoint/futures/position_mode + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| hedged | bool | Yes | set to true to use HEDGE_MODE, false for ONE_WAY | +| symbol | string | Yes | not used by woo setPositionMode | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.setPositionMode (hedged, symbol[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See** + +- https://developer.woox.io/api-reference/endpoint/account/get_account_info +- https://developer.woox.io/api-reference/endpoint/futures/get_leverage + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | *for swap markets only* 'cross' or 'isolated' | +| params.positionMode | string | No | *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE' | + + +```javascript +woo.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [woo](#woo) +**Returns**: object - response from the exchange + +**See** + +- https://developer.woox.io/api-reference/endpoint/spot_margin/set_leverage +- https://developer.woox.io/api-reference/endpoint/futures/set_leverage + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | float | Yes | the rate of leverage (1, 2, 3, 4 or 5 for spot markets, 1, 2, 3, 4, 5, 10, 15, 20 for swap markets) | +| symbol | string | No | unified market symbol (is mandatory for swap markets) | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.marginMode | string | No | *for swap markets only* 'cross' or 'isolated' | +| params.positionMode | string | No | *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE' | + + +```javascript +woo.setLeverage (leverage[, symbol, params]) +``` + + + + +### addMargin{docsify-ignore} +add margin + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://docs.woox.io/#update-isolated-margin-setting + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to add | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.position_side | string | No | 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode | + + +```javascript +woo.addMargin (symbol, amount[, params]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://docs.woox.io/#update-isolated-margin-setting + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| amount | float | Yes | amount of margin to remove | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.position_side | string | No | 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode | + + +```javascript +woo.reduceMargin (symbol, amount[, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/futures/get_positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://developer.woox.io/api-reference/endpoint/futures/get_positions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchPositions ([symbols, params]) +``` + + + + +### fetchConvertQuote{docsify-ignore} +fetch a quote for converting from one currency to another + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.woox.io/#get-quote-rfq + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchConvertQuote (fromCode, toCode[, amount, params]) +``` + + + + +### createConvertTrade{docsify-ignore} +convert from one currency to another + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.woox.io/#send-quote-rft + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to make | +| fromCode | string | Yes | the currency that you want to sell and convert from | +| toCode | string | Yes | the currency that you want to buy and convert into | +| amount | float | No | how much you want to trade in units of the from currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.createConvertTrade (id, fromCode, toCode[, amount, params]) +``` + + + + +### fetchConvertTrade{docsify-ignore} +fetch the data for a conversion trade + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [conversion structure](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.woox.io/#get-quote-trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the id of the trade that you want to fetch | +| code | string | No | the unified currency code of the conversion trade | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchConvertTrade (id[, code, params]) +``` + + + + +### fetchConvertTradeHistory{docsify-ignore} +fetch the users history of conversion trades + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [conversion structures](https://docs.ccxt.com/#/?id=conversion-structure) + +**See**: https://docs.woox.io/#get-quote-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | the unified currency code | +| since | int | No | the earliest time in ms to fetch conversions for | +| limit | int | No | the maximum number of conversion structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest conversion to fetch | + + +```javascript +woo.fetchConvertTradeHistory ([code, since, limit, params]) +``` + + + + +### fetchConvertCurrencies{docsify-ignore} +fetches all available currencies that can be converted + +**Kind**: instance method of [woo](#woo) +**Returns**: object - an associative dictionary of currencies + +**See**: https://docs.woox.io/#get-quote-asset-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.fetchConvertCurrencies ([params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [woo](#woo) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See** + +- https://docs.woox.io/#orderbookupdate +- https://docs.woox.io/#orderbook + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | either (default) 'orderbook' or 'orderbookupdate', default is 'orderbook' | + + +```javascript +woo.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.woox.io/#24h-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.woox.io/#bbos + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.woox.io/#k-line + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.woox.io/#trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://docs.woox.io/#executionreport +- https://docs.woox.io/#algoexecutionreportv2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if trigger order | + + +```javascript +woo.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See** + +- https://docs.woox.io/#executionreport +- https://docs.woox.io/#algoexecutionreportv2 + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if trigger order | + + +```javascript +woo.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [woo](#woo) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://docs.woox.io/#position-push + +| Param | Type | Description | +| --- | --- | --- | +| symbols | Array<string>, undefined | list of unified market symbols | +| since | | | +| limit | | | +| params | object | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.watchPositions (symbols, since, limit, params[]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [woo](#woo) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.woox.io/#balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woo.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/woofipro.md b/docs/ccxt/wiki/exchanges/woofipro.md new file mode 100644 index 0000000..a0af04c --- /dev/null +++ b/docs/ccxt/wiki/exchanges/woofipro.md @@ -0,0 +1,1138 @@ + + + +## woofipro{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchStatus](#fetchstatus) +* [fetchTime](#fetchtime) +* [fetchMarkets](#fetchmarkets) +* [fetchCurrencies](#fetchcurrencies) +* [fetchTrades](#fetchtrades) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingRates](#fetchfundingrates) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchTradingFees](#fetchtradingfees) +* [fetchOrderBook](#fetchorderbook) +* [fetchOHLCV](#fetchohlcv) +* [createOrder](#createorder) +* [createOrders](#createorders) +* [editOrder](#editorder) +* [cancelOrder](#cancelorder) +* [cancelOrders](#cancelorders) +* [cancelAllOrders](#cancelallorders) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchOrderTrades](#fetchordertrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchBalance](#fetchbalance) +* [fetchLedger](#fetchledger) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [fetchDepositsWithdrawals](#fetchdepositswithdrawals) +* [withdraw](#withdraw) +* [fetchLeverage](#fetchleverage) +* [setLeverage](#setleverage) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [watchOrderBook](#watchorderbook) +* [watchTicker](#watchticker) +* [watchTickers](#watchtickers) +* [watchBidsAsks](#watchbidsasks) +* [watchOHLCV](#watchohlcv) +* [watchTrades](#watchtrades) +* [watchOrders](#watchorders) +* [watchMyTrades](#watchmytrades) +* [watchPositions](#watchpositions) +* [watchBalance](#watchbalance) + + + +### fetchStatus{docsify-ignore} +the latest known information on the availability of the exchange API + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [status structure](https://docs.ccxt.com/#/?id=exchange-status-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchStatus ([params]) +``` + + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the exchange server + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: int - the current integer timestamp in milliseconds from the exchange server + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchTime ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for woofipro + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-available-symbols + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchMarkets ([params]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - an associative dictionary of currencies + +**See** + +- https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-collateral-info#get-supported-collateral-info +- https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-chains-per-builder#get-supported-chains-per-builder + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchCurrencies ([params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-market-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchFundingRate (symbol[, params]) +``` + + + + +### fetchFundingRates{docsify-ignore} +fetch the current funding rate for multiple markets + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - an array of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchFundingRates (symbols[, params]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rate prices + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-funding-rate-history-for-one-market + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures](https://docs.ccxt.com/#/?id=funding-rate-history-structure) to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.until | int | No | timestamp in ms of the latest funding rate | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +woofipro.fetchFundingRateHistory (symbol[, since, limit, params]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the history of funding payments paid and received on this account + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [funding history structure](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/private/get-funding-fee-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol | +| since | int | No | the earliest time in ms to fetch funding history for | +| limit | int | No | the maximum number of funding history structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +woofipro.fetchFundingHistory ([symbol, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchTradingFees ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/orderbook-snapshot + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-kline + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms))) | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.takeProfit | object | No | *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only) | +| params.takeProfit.triggerPrice | float | No | take profit trigger price | +| params.stopLoss | object | No | *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only) | +| params.stopLoss.triggerPrice | float | No | stop loss trigger price | +| params.algoType | float | No | 'STOP'or 'TP_SL' or 'POSITIONAL_TP_SL' | +| params.cost | float | No | *spot market buy only* the quote quantity that can be used as an alternative for the amount | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +woofipro.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### createOrders{docsify-ignore} +*contract only* create a list of trade orders + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-create-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| orders | Array | Yes | list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.createOrders (orders[, params]) +``` + + + + +### editOrder{docsify-ignore} +edit a trade order + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-algo-order + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.triggerPrice | float | No | The price a trigger order is triggered at | +| params.stopLossPrice | float | No | price to trigger stop-loss orders | +| params.takeProfitPrice | float | No | price to trigger take-profit orders | + + +```javascript +woofipro.editOrder (id, symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order-by-client_order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order-by-client_order_id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +woofipro.cancelOrder (id, symbol[, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders-by-client_order_id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.client_order_ids | Array<string> | No | max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma | + + +```javascript +woofipro.cancelOrders (ids[, symbol, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - an list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-all-pending-algo-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-orders-in-bulk + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | + + +```javascript +woofipro.cancelAllOrders (symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-client_order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | the order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.clientOrderId | string | No | a unique id for the order | + + +```javascript +woofipro.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.is_triggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | +| params.until | int | Yes | timestamp in ms of the latest order to fetch | + + +```javascript +woofipro.fetchOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.is_triggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.until | int | Yes | timestamp in ms of the latest order to fetch | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +woofipro.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders +- https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | boolean | No | whether the order is a stop/algo order | +| params.is_triggered | boolean | No | whether the order has been triggered (false by default) | +| params.side | string | No | 'buy' or 'sell' | +| params.until | int | Yes | timestamp in ms of the latest order to fetch | +| params.paginate | boolean | No | set to true if you want to fetch orders with pagination | + + +```javascript +woofipro.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### fetchOrderTrades{docsify-ignore} +fetch all the trades made from a single order + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-trades-of-specific-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchOrderTrades (id, symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-trades + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.paginate | boolean | No | set to true if you want to fetch trades with pagination | +| params.until | int | Yes | timestamp in ms of the latest trade to fetch | + + +```javascript +woofipro.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-current-holding + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchBalance ([params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of deposits structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchDeposits (code[, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of withdrawals structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchWithdrawals (code[, since, limit, params]) +``` + + + + +### fetchDepositsWithdrawals{docsify-ignore} +fetch history of deposits and withdrawals + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a list of [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code for the currency of the deposit/withdrawals, default is undefined | +| since | int | No | timestamp in ms of the earliest deposit/withdrawal, default is undefined | +| limit | int | No | max number of deposit/withdrawals to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchDepositsWithdrawals ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.withdraw (code, amount, address, tag[, params]) +``` + + + + +### fetchLeverage{docsify-ignore} +fetch the set leverage for a market + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [leverage structure](https://docs.ccxt.com/#/?id=leverage-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchLeverage (symbol[, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - response from the exchange + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| leverage | int | No | the rate of leverage | +| symbol | string | No | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.setLeverage ([leverage, symbol, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on an open position + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-one-position-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market the position is held in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchPosition (symbol[, params]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-positions-info + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.fetchPositions ([symbols, params]) +``` + + + + +### watchOrderBook{docsify-ignore} +watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/orderbook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchOrderBook (symbol[, limit, params]) +``` + + + + +### watchTicker{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/24-hour-ticker + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchTicker (symbol[, params]) +``` + + + + +### watchTickers{docsify-ignore} +watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/24-hour-tickers + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchTickers (symbols[, params]) +``` + + + + +### watchBidsAsks{docsify-ignore} +watches best bid & ask for symbols + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/bbos + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchBidsAsks (symbols[, params]) +``` + + + + +### watchOHLCV{docsify-ignore} +watches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/k-line + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### watchTrades{docsify-ignore} +watches information on multiple trades made in a market + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/public/trade + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market trades were made in | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trade structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchTrades (symbol[, since, limit, params]) +``` + + + + +### watchOrders{docsify-ignore} +watches information on multiple orders made by the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/execution-report +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/algo-execution-report + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if trigger order | + + +```javascript +woofipro.watchOrders (symbol[, since, limit, params]) +``` + + + + +### watchMyTrades{docsify-ignore} +watches information on multiple trades made by the user + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/execution-report +- https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/algo-execution-report + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.trigger | bool | No | true if trigger order | + + +```javascript +woofipro.watchMyTrades (symbol[, since, limit, params]) +``` + + + + +### watchPositions{docsify-ignore} +watch all open positions + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/en/latest/manual.html#position-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/position-push + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string> | No | list of unified market symbols | +| since | | Yes | timestamp in ms of the earliest position to fetch | +| limit | | Yes | the maximum number of positions to fetch | +| params | object | Yes | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchPositions ([symbols, since, limit, params]) +``` + + + + +### watchBalance{docsify-ignore} +watch balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [woofipro](#woofipro) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://orderly.network/docs/build-on-evm/evm-api/websocket-api/private/balance + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +woofipro.watchBalance ([params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/xt.md b/docs/ccxt/wiki/exchanges/xt.md new file mode 100644 index 0000000..efcc796 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/xt.md @@ -0,0 +1,1046 @@ + + + +## xt{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchTime](#fetchtime) +* [fetchCurrencies](#fetchcurrencies) +* [fetchMarkets](#fetchmarkets) +* [fetchOHLCV](#fetchohlcv) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTickers](#fetchtickers) +* [fetchBidsAsks](#fetchbidsasks) +* [fetchTrades](#fetchtrades) +* [fetchMyTrades](#fetchmytrades) +* [fetchBalance](#fetchbalance) +* [createMarketBuyOrderWithCost](#createmarketbuyorderwithcost) +* [createOrder](#createorder) +* [fetchOrder](#fetchorder) +* [fetchOrders](#fetchorders) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [fetchCanceledOrders](#fetchcanceledorders) +* [cancelOrder](#cancelorder) +* [cancelAllOrders](#cancelallorders) +* [cancelOrders](#cancelorders) +* [fetchLedger](#fetchledger) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDeposits](#fetchdeposits) +* [fetchWithdrawals](#fetchwithdrawals) +* [withdraw](#withdraw) +* [setLeverage](#setleverage) +* [addMargin](#addmargin) +* [reduceMargin](#reducemargin) +* [fetchLeverageTiers](#fetchleveragetiers) +* [fetchMarketLeverageTiers](#fetchmarketleveragetiers) +* [fetchFundingRateHistory](#fetchfundingratehistory) +* [fetchFundingInterval](#fetchfundinginterval) +* [fetchFundingRate](#fetchfundingrate) +* [fetchFundingHistory](#fetchfundinghistory) +* [fetchPosition](#fetchposition) +* [fetchPositions](#fetchpositions) +* [transfer](#transfer) +* [setMarginMode](#setmarginmode) +* [editOrder](#editorder) + + + +### fetchTime{docsify-ignore} +fetches the current integer timestamp in milliseconds from the xt server + +**Kind**: instance method of [xt](#xt) +**Returns**: int - the current integer timestamp in milliseconds from the xt server + +**See**: https://doc.xt.com/#market1serverInfo + +| Param | Type | Description | +| --- | --- | --- | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchTime (params, [undefined]) +``` + + + + +### fetchCurrencies{docsify-ignore} +fetches all available currencies on an exchange + +**Kind**: instance method of [xt](#xt) +**Returns**: object - an associative dictionary of currencies + +**See**: https://doc.xt.com/#deposit_withdrawalsupportedCurrenciesGet + +| Param | Type | Description | +| --- | --- | --- | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchCurrencies (params, [undefined]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for xt + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - an array of objects representing market data + +**See** + +- https://doc.xt.com/#market2symbol +- https://doc.xt.com/#futures_quotesgetSymbols + + +| Param | Type | Description | +| --- | --- | --- | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchMarkets (params, [undefined]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See** + +- https://doc.xt.com/#market4kline +- https://doc.xt.com/#futures_quotesgetKLine + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.until | int | No | timestamp in ms of the latest candle to fetch | +| params.paginate | boolean | No | default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) | + + +```javascript +xt.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [xt](#xt) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/en/latest/manual.html#order-book-structure) indexed by market symbols + +**See** + +- https://doc.xt.com/#market3depth +- https://doc.xt.com/#futures_quotesgetDepth + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/en/latest/manual.html#ticker-structure) + +**See** + +- https://doc.xt.com/#market10ticker24h +- https://doc.xt.com/#futures_quotesgetAggTicker + + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified market symbol to fetch the ticker for | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchTicker (symbol, params[]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market + +**Kind**: instance method of [xt](#xt) +**Returns**: object - an array of [ticker structures](https://docs.ccxt.com/en/latest/manual.html#ticker-structure) + +**See** + +- https://doc.xt.com/#market10ticker24h +- https://doc.xt.com/#futures_quotesgetAggTickers + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | No | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchTickers ([symbols, params]) +``` + + + + +### fetchBidsAsks{docsify-ignore} +fetches the bid and ask price and volume for multiple markets + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/en/latest/manual.html#ticker-structure) + +**See**: https://doc.xt.com/#market9tickerBook + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | No | unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchBidsAsks ([symbols, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/en/latest/manual.html?#public-trades) + +**See** + +- https://doc.xt.com/#market5tradeRecent +- https://doc.xt.com/#futures_quotesgetDeal + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [trade structures](https://docs.ccxt.com/en/latest/manual.html?#public-trades) + +**See** + +- https://doc.xt.com/#tradetradeGet +- https://doc.xt.com/#futures_ordergetTrades + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchMyTrades ([symbol, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [balance structure](https://docs.ccxt.com/en/latest/manual.html?#balance-structure) + +**See** + +- https://doc.xt.com/#balancebalancesGet +- https://doc.xt.com/#futures_usergetBalances + + +| Param | Type | Description | +| --- | --- | --- | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchBalance (params, [undefined]) +``` + + + + +### createMarketBuyOrderWithCost{docsify-ignore} +create a market buy order by providing the symbol and cost + +**Kind**: instance method of [xt](#xt) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://doc.xt.com/#orderorderPost + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| cost | float | Yes | how much you want to trade in units of the quote currency | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +xt.createMarketBuyOrderWithCost (symbol, cost[, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [xt](#xt) +**Returns**: object - an [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderorderPost +- https://doc.xt.com/#futures_ordercreate +- https://doc.xt.com/#futures_entrustcreatePlan +- https://doc.xt.com/#futures_entrustcreateProfit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much you want to trade in units of the base currency | +| price | float | No | the price to fulfill the order, in units of the quote currency, can be ignored in market orders | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.timeInForce | string | No | 'GTC', 'IOC', 'FOK' or 'GTX' | +| params.entrustType | string | No | 'TAKE_PROFIT', 'STOP', 'TAKE_PROFIT_MARKET', 'STOP_MARKET', 'TRAILING_STOP_MARKET', required if stopPrice is defined, currently isn't functioning on xt's side | +| params.triggerPriceType | string | No | 'INDEX_PRICE', 'MARK_PRICE', 'LATEST_PRICE', required if stopPrice is defined | +| params.triggerPrice | float | No | price to trigger a stop order | +| params.stopPrice | float | No | alias for triggerPrice | +| params.stopLoss | float | No | price to set a stop-loss on an open position | +| params.takeProfit | float | No | price to set a take-profit on an open position | + + +```javascript +xt.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [xt](#xt) +**Returns**: object - An [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderorderGet +- https://doc.xt.com/#futures_ordergetById +- https://doc.xt.com/#futures_entrustgetPlanById +- https://doc.xt.com/#futures_entrustgetProfitById + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.trigger | bool | No | if the order is a trigger order or not | +| params.stopLossTakeProfit | bool | No | if the order is a stop-loss or take-profit order | + + +```javascript +xt.fetchOrder (id[, symbol, params]) +``` + + + + +### fetchOrders{docsify-ignore} +fetches information on multiple orders made by the user + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderhistoryOrderGet +- https://doc.xt.com/#futures_ordergetHistory +- https://doc.xt.com/#futures_entrustgetPlanHistory + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market the orders were made in | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.trigger | bool | No | if the order is a trigger order or not | + + +```javascript +xt.fetchOrders ([symbol, since, limit, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderopenOrderGet +- https://doc.xt.com/#futures_ordergetOrders +- https://doc.xt.com/#futures_entrustgetPlan +- https://doc.xt.com/#futures_entrustgetProfit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market the orders were made in | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.trigger | bool | No | if the order is a trigger order or not | +| params.stopLossTakeProfit | bool | No | if the order is a stop-loss or take-profit order | + + +```javascript +xt.fetchOpenOrders ([symbol, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderhistoryOrderGet +- https://doc.xt.com/#futures_ordergetOrders +- https://doc.xt.com/#futures_entrustgetPlan +- https://doc.xt.com/#futures_entrustgetProfit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market the orders were made in | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.trigger | bool | No | if the order is a trigger order or not | +| params.stopLossTakeProfit | bool | No | if the order is a stop-loss or take-profit order | + + +```javascript +xt.fetchClosedOrders ([symbol, since, limit, params]) +``` + + + + +### fetchCanceledOrders{docsify-ignore} +fetches information on multiple canceled orders made by the user + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderhistoryOrderGet +- https://doc.xt.com/#futures_ordergetOrders +- https://doc.xt.com/#futures_entrustgetPlan +- https://doc.xt.com/#futures_entrustgetProfit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market the orders were made in | +| since | int | No | timestamp in ms of the earliest order | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.trigger | bool | No | if the order is a trigger order or not | +| params.stopLossTakeProfit | bool | No | if the order is a stop-loss or take-profit order | + + +```javascript +xt.fetchCanceledOrders ([symbol, since, limit, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [xt](#xt) +**Returns**: object - An [order structure](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderorderDel +- https://doc.xt.com/#futures_ordercancel +- https://doc.xt.com/#futures_entrustcancelPlan +- https://doc.xt.com/#futures_entrustcancelProfit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | No | unified symbol of the market the order was made in | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.trigger | bool | No | if the order is a trigger order or not | +| params.stopLossTakeProfit | bool | No | if the order is a stop-loss or take-profit order | + + +```javascript +xt.cancelOrder (id[, symbol, params]) +``` + + + + +### cancelAllOrders{docsify-ignore} +cancel all open orders in a market + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See** + +- https://doc.xt.com/#orderopenOrderDel +- https://doc.xt.com/#futures_ordercancelBatch +- https://doc.xt.com/#futures_entrustcancelPlanBatch +- https://doc.xt.com/#futures_entrustcancelProfitBatch + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified market symbol of the market to cancel orders in | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.trigger | bool | No | if the order is a trigger order or not | +| params.stopLossTakeProfit | bool | No | if the order is a stop-loss or take-profit order | + + +```javascript +xt.cancelAllOrders ([symbol, params]) +``` + + + + +### cancelOrders{docsify-ignore} +cancel multiple orders + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [order structures](https://docs.ccxt.com/en/latest/manual.html#order-structure) + +**See**: https://doc.xt.com/#orderbatchOrderDel + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| ids | Array<string> | Yes | order ids | +| symbol | string | No | unified market symbol of the market to cancel orders in | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.cancelOrders (ids[, symbol, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/en/latest/manual.html#ledger-structure) + +**See**: https://doc.xt.com/#futures_usergetBalanceBill + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | timestamp in ms of the earliest ledger entry | +| limit | int | No | max number of ledger entries to return | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [xt](#xt) +**Returns**: object - an [address structure](https://docs.ccxt.com/en/latest/manual.html#address-structure) + +**See**: https://doc.xt.com/#deposit_withdrawaldepositAddressGet + +| Param | Type | Description | +| --- | --- | --- | +| code | string | unified currency code | +| params | object | extra parameters specific to the xt api endpoint | +| params.network | string | required network id | + + +```javascript +xt.fetchDepositAddress (code, params[]) +``` + + + + +### fetchDeposits{docsify-ignore} +fetch all deposits made to an account + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/en/latest/manual.html#transaction-structure) + +**See**: https://doc.xt.com/#deposit_withdrawalhistoryDepositGet + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch deposits for | +| limit | int | No | the maximum number of transaction structures to retrieve | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchDeposits ([code, since, limit, params]) +``` + + + + +### fetchWithdrawals{docsify-ignore} +fetch all withdrawals made from an account + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [transaction structures](https://docs.ccxt.com/en/latest/manual.html#transaction-structure) + +**See**: https://doc.xt.com/#deposit_withdrawalwithdrawHistory + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code | +| since | int | No | the earliest time in ms to fetch withdrawals for | +| limit | int | No | the maximum number of transaction structures to retrieve | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchWithdrawals ([code, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/en/latest/manual.html#transaction-structure) + +**See**: https://doc.xt.com/#deposit_withdrawalwithdraw + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | No | | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.withdraw (code, amount, address[, tag, params]) +``` + + + + +### setLeverage{docsify-ignore} +set the level of leverage for a market + +**Kind**: instance method of [xt](#xt) +**Returns**: object - response from the exchange + +**See**: https://doc.xt.com/#futures_useradjustLeverage + +| Param | Type | Description | +| --- | --- | --- | +| leverage | float | the rate of leverage | +| symbol | string | unified market symbol | +| params | object | extra parameters specific to the xt api endpoint | +| params.positionSide | string | 'LONG' or 'SHORT' | + + +```javascript +xt.setLeverage (leverage, symbol, params[]) +``` + + + + +### addMargin{docsify-ignore} +add margin to a position + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=add-margin-structure) + +**See**: https://doc.xt.com/#futures_useradjustMargin + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified market symbol | +| amount | float | amount of margin to add | +| params | object | extra parameters specific to the xt api endpoint | +| params.positionSide | string | 'LONG' or 'SHORT' | + + +```javascript +xt.addMargin (symbol, amount, params[]) +``` + + + + +### reduceMargin{docsify-ignore} +remove margin from a position + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [margin structure](https://docs.ccxt.com/#/?id=reduce-margin-structure) + +**See**: https://doc.xt.com/#futures_useradjustMargin + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified market symbol | +| amount | float | the amount of margin to remove | +| params | object | extra parameters specific to the xt api endpoint | +| params.positionSide | string | 'LONG' or 'SHORT' | + + +```javascript +xt.reduceMargin (symbol, amount, params[]) +``` + + + + +### fetchLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage for different trade sizes + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a dictionary of [leverage tiers structures](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See**: https://doc.xt.com/#futures_quotesgetLeverageBrackets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | No | a list of unified market symbols | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchLeverageTiers ([symbols, params]) +``` + + + + +### fetchMarketLeverageTiers{docsify-ignore} +retrieve information on the maximum leverage for different trade sizes of a single market + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [leverage tiers structure](https://docs.ccxt.com/#/?id=leverage-tiers-structure) + +**See**: https://doc.xt.com/#futures_quotesgetLeverageBracket + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified market symbol | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchMarketLeverageTiers (symbol, params[]) +``` + + + + +### fetchFundingRateHistory{docsify-ignore} +fetches historical funding rates + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [funding rate structures](https://docs.ccxt.com/en/latest/manual.html?#funding-rate-history-structure) + +**See**: https://doc.xt.com/#futures_quotesgetFundingRateRecord + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | No | unified symbol of the market to fetch the funding rate history for | +| since | int | No | timestamp in ms of the earliest funding rate to fetch | +| limit | int | No | the maximum amount of [funding rate structures] to fetch | +| params | object | Yes | extra parameters specific to the xt api endpoint | +| params.paginate | bool | Yes | true/false whether to use the pagination helper to aumatically paginate through the results | + + +```javascript +xt.fetchFundingRateHistory ([symbol, since, limit, params]) +``` + + + + +### fetchFundingInterval{docsify-ignore} +fetch the current funding rate interval + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://doc.xt.com/#futures_quotesgetFundingRate + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +xt.fetchFundingInterval (symbol[, params]) +``` + + + + +### fetchFundingRate{docsify-ignore} +fetch the current funding rate + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [funding rate structure](https://docs.ccxt.com/#/?id=funding-rate-structure) + +**See**: https://doc.xt.com/#futures_quotesgetFundingRate + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified market symbol | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchFundingRate (symbol, params[]) +``` + + + + +### fetchFundingHistory{docsify-ignore} +fetch the funding history + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [funding history structures](https://docs.ccxt.com/#/?id=funding-history-structure) + +**See**: https://doc.xt.com/#futures_usergetFunding + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the starting timestamp in milliseconds | +| limit | int | No | the number of entries to return | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchFundingHistory (symbol[, since, limit, params]) +``` + + + + +### fetchPosition{docsify-ignore} +fetch data on a single open contract trade position + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://doc.xt.com/#futures_usergetPosition + +| Param | Type | Description | +| --- | --- | --- | +| symbol | string | unified market symbol of the market the position is held in | +| params | object | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchPosition (symbol, params[]) +``` + + + + +### fetchPositions{docsify-ignore} +fetch all open positions + +**Kind**: instance method of [xt](#xt) +**Returns**: Array<object> - a list of [position structure](https://docs.ccxt.com/#/?id=position-structure) + +**See**: https://doc.xt.com/#futures_usergetPosition + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | string | No | list of unified market symbols, not supported with xt | +| params | object | Yes | extra parameters specific to the xt api endpoint | + + +```javascript +xt.fetchPositions ([symbols, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [xt](#xt) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://doc.xt.com/#transfersubTransferPost + +| Param | Type | Description | +| --- | --- | --- | +| code | string | unified currency code | +| amount | float | amount to transfer | +| fromAccount | string | account to transfer from - spot, swap, leverage, finance | +| toAccount | string | account to transfer to - spot, swap, leverage, finance | +| params | object | extra parameters specific to the whitebit api endpoint | + + +```javascript +xt.transfer (code, amount, fromAccount, toAccount, params[]) +``` + + + + +### setMarginMode{docsify-ignore} +set margin mode to 'cross' or 'isolated' + +**Kind**: instance method of [xt](#xt) +**Returns**: object - response from the exchange + +**See**: https://doc.xt.com/#futures_userchangePositionType + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| marginMode | string | Yes | 'cross' or 'isolated' | +| symbol | string | No | required | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.positionSide | string | No | *required* "long" or "short" | + + +```javascript +xt.setMarginMode (marginMode[, symbol, params]) +``` + + + + +### editOrder{docsify-ignore} +cancels an order and places a new order + +**Kind**: instance method of [xt](#xt) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See** + +- https://doc.xt.com/#orderorderUpdate +- https://doc.xt.com/#futures_orderupdate +- https://doc.xt.com/#futures_entrustupdateProfit + + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of the currency you want to trade in units of the base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.stopLoss | float | No | price to set a stop-loss on an open position | +| params.takeProfit | float | No | price to set a take-profit on an open position | + + +```javascript +xt.editOrder (id, symbol, type, side, amount[, price, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/yobit.md b/docs/ccxt/wiki/exchanges/yobit.md new file mode 100644 index 0000000..66fabff --- /dev/null +++ b/docs/ccxt/wiki/exchanges/yobit.md @@ -0,0 +1,374 @@ + + + +## yobit{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchBalance](#fetchbalance) +* [fetchMarkets](#fetchmarkets) +* [fetchOrderBook](#fetchorderbook) +* [fetchOrderBooks](#fetchorderbooks) +* [fetchTickers](#fetchtickers) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [fetchTradingFees](#fetchtradingfees) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOrder](#fetchorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [createDepositAddress](#createdepositaddress) +* [fetchDepositAddress](#fetchdepositaddress) +* [withdraw](#withdraw) + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchBalance ([params]) +``` + + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for yobit + +**Kind**: instance method of [yobit](#yobit) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchMarkets ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchOrderBooks{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data for multiple markets + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - a dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbol + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | list of unified market symbols, all symbols fetched if undefined, default is undefined | +| limit | int | No | max number of entries per orderbook to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchOrderBooks (symbols[, limit, params]) +``` + + + + +### fetchTickers{docsify-ignore} +fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - a dictionary of [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbols | Array<string>, undefined | Yes | unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.all | object | No | you can set to `true` for convenience to fetch all tickers from this exchange by sending multiple requests | + + +```javascript +yobit.fetchTickers (symbols[, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [yobit](#yobit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### fetchTradingFees{docsify-ignore} +fetch the trading fees for multiple markets + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - a dictionary of [fee structures](https://docs.ccxt.com/#/?id=fee-structure) indexed by market symbols + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchTradingFees ([params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | must be 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by yobit cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOrder{docsify-ignore} +fetches information on an order made by the user + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by yobit fetchOrder | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [yobit](#yobit) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [yobit](#yobit) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### createDepositAddress{docsify-ignore} +create a currency deposit address + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code of the currency for the deposit address | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.createDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.fetchDepositAddress (code[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [yobit](#yobit) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://yobit.net/en/api + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +yobit.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/zaif.md b/docs/ccxt/wiki/exchanges/zaif.md new file mode 100644 index 0000000..435eb90 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/zaif.md @@ -0,0 +1,240 @@ + + + +## zaif{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchOpenOrders](#fetchopenorders) +* [fetchClosedOrders](#fetchclosedorders) +* [withdraw](#withdraw) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for zaif + +**Kind**: instance method of [zaif](#zaif) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/PublicAPI.html#id12 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.fetchMarkets ([params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [zaif](#zaif) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id10 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [zaif](#zaif) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/PublicAPI.html#id34 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market + +**Kind**: instance method of [zaif](#zaif) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/PublicAPI.html#id22 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.fetchTicker (symbol[, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [zaif](#zaif) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/PublicAPI.html#id28 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [zaif](#zaif) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/MarginTradingAPI.html#id23 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | must be 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [zaif](#zaif) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id37 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | not used by zaif cancelOrder () | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [zaif](#zaif) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/MarginTradingAPI.html#id28 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchClosedOrders{docsify-ignore} +fetches information on multiple closed orders made by the user + +**Kind**: instance method of [zaif](#zaif) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id24 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol of the market orders were made in | +| since | int | No | the earliest time in ms to fetch orders for | +| limit | int | No | the maximum number of order structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.fetchClosedOrders (symbol[, since, limit, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [zaif](#zaif) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id41 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zaif.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/exchanges/zonda.md b/docs/ccxt/wiki/exchanges/zonda.md new file mode 100644 index 0000000..bdc0077 --- /dev/null +++ b/docs/ccxt/wiki/exchanges/zonda.md @@ -0,0 +1,360 @@ + + + +## zonda{docsify-ignore} +**Kind**: global class +**Extends**: Exchange + +* [fetchMarkets](#fetchmarkets) +* [fetchOpenOrders](#fetchopenorders) +* [fetchMyTrades](#fetchmytrades) +* [fetchBalance](#fetchbalance) +* [fetchOrderBook](#fetchorderbook) +* [fetchTicker](#fetchticker) +* [fetchLedger](#fetchledger) +* [fetchOHLCV](#fetchohlcv) +* [fetchTrades](#fetchtrades) +* [createOrder](#createorder) +* [cancelOrder](#cancelorder) +* [fetchDepositAddress](#fetchdepositaddress) +* [fetchDepositAddresses](#fetchdepositaddresses) +* [transfer](#transfer) +* [withdraw](#withdraw) + + + +### fetchMarkets{docsify-ignore} +retrieves data on all markets for zonda + +**Kind**: instance method of [zonda](#zonda) +**Returns**: Array<object> - an array of objects representing market data + +**See**: https://docs.zondacrypto.exchange/reference/ticker-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchMarkets ([params]) +``` + + + + +### fetchOpenOrders{docsify-ignore} +fetch all unfilled currently open orders + +**Kind**: instance method of [zonda](#zonda) +**Returns**: Array<Order> - a list of [order structures](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.zondacrypto.exchange/reference/active-orders + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | not used by zonda fetchOpenOrders | +| since | int | No | the earliest time in ms to fetch open orders for | +| limit | int | No | the maximum number of open orders structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchOpenOrders (symbol[, since, limit, params]) +``` + + + + +### fetchMyTrades{docsify-ignore} +fetch all trades made by the user + +**Kind**: instance method of [zonda](#zonda) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure) + +**See**: https://docs.zondacrypto.exchange/reference/transactions-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified market symbol | +| since | int | No | the earliest time in ms to fetch trades for | +| limit | int | No | the maximum number of trades structures to retrieve | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchMyTrades (symbol[, since, limit, params]) +``` + + + + +### fetchBalance{docsify-ignore} +query for balance and get the amount of funds available for trading or funds locked in orders + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - a [balance structure](https://docs.ccxt.com/#/?id=balance-structure) + +**See**: https://docs.zondacrypto.exchange/reference/list-of-wallets + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchBalance ([params]) +``` + + + + +### fetchOrderBook{docsify-ignore} +fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - A dictionary of [order book structures](https://docs.ccxt.com/#/?id=order-book-structure) indexed by market symbols + +**See**: https://docs.zondacrypto.exchange/reference/orderbook-2 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the order book for | +| limit | int | No | the maximum amount of order book entries to return | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchOrderBook (symbol[, limit, params]) +``` + + + + +### fetchTicker{docsify-ignore} +v1_01PublicGetTradingTickerSymbol retrieves timestamp, datetime, bid, ask, close, last, previousClose, v1_01PublicGetTradingStatsSymbol retrieves high, low, volume and opening price of an asset + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - a [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure) + +**See**: https://docs.zondacrypto.exchange/reference/market-statistics + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch the ticker for | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.method | string | No | v1_01PublicGetTradingTickerSymbol (default) or v1_01PublicGetTradingStatsSymbol | + + +```javascript +zonda.fetchTicker (symbol[, params]) +``` + + + + +### fetchLedger{docsify-ignore} +fetch the history of changes, actions done by the user or operations that altered the balance of the user + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - a [ledger structure](https://docs.ccxt.com/#/?id=ledger) + +**See**: https://docs.zondacrypto.exchange/reference/operations-history + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | No | unified currency code, default is undefined | +| since | int | No | timestamp in ms of the earliest ledger entry, default is undefined | +| limit | int | No | max number of ledger entries to return, default is undefined | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchLedger ([code, since, limit, params]) +``` + + + + +### fetchOHLCV{docsify-ignore} +fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market + +**Kind**: instance method of [zonda](#zonda) +**Returns**: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume + +**See**: https://docs.zondacrypto.exchange/reference/candles-chart + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch OHLCV data for | +| timeframe | string | Yes | the length of time each candle represents | +| since | int | No | timestamp in ms of the earliest candle to fetch | +| limit | int | No | the maximum amount of candles to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchOHLCV (symbol, timeframe[, since, limit, params]) +``` + + + + +### fetchTrades{docsify-ignore} +get the list of most recent trades for a particular symbol + +**Kind**: instance method of [zonda](#zonda) +**Returns**: Array<Trade> - a list of [trade structures](https://docs.ccxt.com/#/?id=public-trades) + +**See**: https://docs.zondacrypto.exchange/reference/last-transactions + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to fetch trades for | +| since | int | No | timestamp in ms of the earliest trade to fetch | +| limit | int | No | the maximum amount of trades to fetch | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchTrades (symbol[, since, limit, params]) +``` + + + + +### createOrder{docsify-ignore} +create a trade order + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - an [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.zondacrypto.exchange/reference/new-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| symbol | string | Yes | unified symbol of the market to create an order in | +| type | string | Yes | 'market' or 'limit' | +| side | string | Yes | 'buy' or 'sell' | +| amount | float | Yes | how much of currency you want to trade in units of base currency | +| price | float | No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.createOrder (symbol, type, side, amount[, price, params]) +``` + + + + +### cancelOrder{docsify-ignore} +cancels an open order + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - An [order structure](https://docs.ccxt.com/#/?id=order-structure) + +**See**: https://docs.zondacrypto.exchange/reference/cancel-order + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| id | string | Yes | order id | +| symbol | string | Yes | unified symbol of the market the order was made in | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.cancelOrder (id, symbol[, params]) +``` + + + + +### fetchDepositAddress{docsify-ignore} +fetch the deposit address for a currency associated with this account + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - an [address structure](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.zondacrypto.exchange/reference/deposit-addresses-for-crypto + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| params | object | No | extra parameters specific to the exchange API endpoint | +| params.walletId | string | No | Wallet id to filter deposit adresses. | + + +```javascript +zonda.fetchDepositAddress (code[, params]) +``` + + + + +### fetchDepositAddresses{docsify-ignore} +fetch deposit addresses for multiple currencies and chain types + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - a list of [address structures](https://docs.ccxt.com/#/?id=address-structure) + +**See**: https://docs.zondacrypto.exchange/reference/deposit-addresses-for-crypto + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| codes | Array<string>, undefined | Yes | zonda does not support filtering filtering by multiple codes and will ignore this parameter. | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.fetchDepositAddresses (codes[, params]) +``` + + + + +### transfer{docsify-ignore} +transfer currency internally between wallets on the same account + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - a [transfer structure](https://docs.ccxt.com/#/?id=transfer-structure) + +**See**: https://docs.zondacrypto.exchange/reference/internal-transfer + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | amount to transfer | +| fromAccount | string | Yes | account to transfer from | +| toAccount | string | Yes | account to transfer to | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.transfer (code, amount, fromAccount, toAccount[, params]) +``` + + + + +### withdraw{docsify-ignore} +make a withdrawal + +**Kind**: instance method of [zonda](#zonda) +**Returns**: object - a [transaction structure](https://docs.ccxt.com/#/?id=transaction-structure) + +**See**: https://docs.zondacrypto.exchange/reference/crypto-withdrawal-1 + +| Param | Type | Required | Description | +| --- | --- | --- | --- | +| code | string | Yes | unified currency code | +| amount | float | Yes | the amount to withdraw | +| address | string | Yes | the address to withdraw to | +| tag | string | Yes | | +| params | object | No | extra parameters specific to the exchange API endpoint | + + +```javascript +zonda.withdraw (code, amount, address, tag[, params]) +``` + diff --git a/docs/ccxt/wiki/favicon.ico b/docs/ccxt/wiki/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4f261c9a6232a0653ee2ca01439921e77792763b GIT binary patch literal 7406 zcmeHM2~dat|Vxa?C#ncp!{nxGzVMTjUrO1<}MD zD54Q_n9X4n!DP*`8dKTY&DO3tsy2rgc%tF~?$`f6|IA?ABo((R*(zVvoA-Tr} z>wmhx{)zfge{yyvNDJC$Ni>Iu?Ctes3!-mOH+;BIPBJGdA4TK{A2gwOFl)z?L=gOM zKS6JM?Et-4xQ+@U!)Z(UbF_P7Ic56Kr;9)SKv|Gk0X|fplR;&19A!h#3i6@e-urYP ze6qEbau@p3Dacdpt@IiAn}7U`K0Dq{S1(^8ZCEh9Qd&ft(o+ySg-VvjP=@~k#9u&7 zHI=j%+|$!Tz2NdV6=M6+UydH3@?|Q@hMogHiE`QUIO@D`9?v+2XBMg}XgB!Iy}PtEJDs+HOO`6>!jEUE6f(=-8_%htY{=f8Ug|u57V%>d-w(0c==6te z^w&>LQ1`8yR1zCanSS%>?!9|-4_vmCqvo1w>NtOn$`detg%9O`J5kPsJk{Qg80~bl zWk0pl)si+em|lb2oT{ev(Gm2@hEi$-XZX&eEQK%HV@%-A^XKUjI2ZbWx7V*+o@)S#^w-Mf32K0f>oWd?dv$GNlAys3)H5-^OIhvLQPmd+*;z41c;0dFmMQcf1w- zsHI(nT55m2g&NCCX-h^56?2hPo0&!>su=p{@OzXQumEv?q|$g5_4M{o2lTzVO00_> zJO_CU#5lpZ;7b?JqhB3}eT-VRZl=>89H+*zVk+XIkfZM@Bfy(V;*^MqJn5Xj>z?GRdj- z7lB&jO6BTpOQG$VX|9jo`0T4fxvzgS^B)2K{58SQ#yK1O9U4&fNHl*m|6wftv>J2s z7;hGT&o9JZ6#l}z(2-%$iHXqx)ghsw@vGd#{y(fg%7qgOQ&V4#O7<9MIcHOyJXM}5 zW}xw*{`_EMD>tJnYsXud4()&Bug%ZT&yCv3;`@(<&Of3KicG=J=Y}NcTEm06CtRh{ z7oYKLXvoZ3QYDp257u$Yb)%r zOH}Xf1LD`rx`9k(38){;G!t?c{aGGN-dgeX72aIquOVGZah?R5vHk%~?}kUanfE0v z^UUvCXYN+7Z_jaK%$!XrdJqPXubF9D=WI4cT;!a}v1ptL?eUAoe40OH?_p9ouE_C$ zd>PY&_x)Go_qY4web>idzup)nW3o7pDt^5!@C??|mVV}(e!b0VD9~5FT0W$&|NL!( z1X?pFLM!?Q_n)h;-4-d%KPSYuu4}|w$5R~=F05yrw@j=Q-csa1@6Y}ZjU@WJ8r%%F zpY@miSO1;EQ{{T%u>OSpit(_TkC7R7V{eldZq7= zai)#)Z>%dSvP$nepGMnnSP$IKy}!c$k1;;>BmDm~87p`#LtLNAxaYCo8A;gh++B<{ zOiNg%5;L$pj_sNz#P-vAewQ_=G=yhU^Z-4iN?bkSL;fK0QO-_}+dldXFq~=+_5vGl zsu>C*>2d1!Uw=iqlw{fjE>bR`JGXDs+b{3pvFg2^d%zFCrr@30JRXNK{JCqrmewr^ zr2_Dct}goF>#yl1A;)}Z)O2gGOXED$#@LGL(wmdBF}Kkm@xiYw}|{6Cz5fJY|_nM|e*2v84z2xQ>`t5Nfe z7}z4i(Pq)q)jTO-_!+mG7-EK5_iA z)GQbU@)qm`ZZSg^S4gLuMOo*`WSdt+WeMa~z}r{nr>1%=Qzw@XO0`?AR{LyD6)Ar; z-$98!KSlwKktC4W1DRb)wm zeWlQU-wCXkzUUXmXCv6Lz8^k*!7dr;=q-><+6;*#zd&E|cFeF~{qK{Xz<|}p{P1Sx z@(A>M|7Edr3a;4svx?!IqCcDPebehjxGQD%rEM**(vf{l*q0X2r-$FgzSV{MaHZ$DQnH+<#ZBh^MZr zS8*0fqR+5Lm*QUi*nxfgd7-Il1MLO(;5@<38YhpwPgk*rw;w!!JLhw>2m2=5dp~{u zJ*rM#!Jk3coijV9T)ub_arX1)tGtjP#Hk=1&KyUY_wZ*QcBlLX_HlN1&CUl+_*PJz zypn3bZ13;JnSky8?0oVq&LAJX^Cx}}X5SBvG&j-t@BU3ytCsU;F!mjwAupS*U%5<& zn|9N+OP%~Th<1FBVE575@L=4Fx59pf-_O~1g8a}R+yx(@_SahYvjMvoXXm0)e4AkB zxyST)27d1ukjNEQ5-Ww51d3dO-;f|%$+V$LFL}Qav8Yf4O>rI>Z8Kq*!f}e5LL#xU zbq=2I=Qmfb7#B7lWr<{@Q<%p{IL;1RY6iRIL_hl{29I6hy&z0A)zV5aG_e0jbB6%W zr{_IsJ!YuFOKCyFW=xwEHGG1F#j{E;uW(BX7mGP|vjRLlJuSn%6uu6D*7KeTu=EME zp1ydfLNQ{Bf5hk^16=|qj~+d7nw4V2_)vvhK1@1KCXuuLjo?(1M!C*(8Q>oi^OUWX t!aa~1AGvV2=OTzfK?-?@J1$6k!= 1) ? '-' + cache[id] : '' + return lower + part +} + +exports.cleanNames = function (names) { + if (!names) return [] + return names.map (name => name.replace (/Array./g, 'Array')) +} + +// this method is copied from dmd except for the option params handling +function methodSig () { + const args = arrayify(this.params).filter(function (param) { + return param.name && !/\./.test(param.name) + }) + function firstOptionalIndex (params) { + let i = 0; + for (; i < params.length && !(params[i].optional); i++); + return i + } + const names = args.map (arg => arg.name) + if (args.length) { + const firstOptional = firstOptionalIndex (args) + if ((firstOptional > 0) && (args.length > 1)) { + names[firstOptional - 1] = names[firstOptional - 1] + '[' + } else { + names[firstOptional] = '[' + names[firstOptional] + } + names[names.length - 1] = names[names.length - 1] + ']' + } + return names.join (', ') +} + +exports.methodSig = methodSig diff --git a/docs/ccxt/wiki/index.html b/docs/ccxt/wiki/index.html new file mode 100644 index 0000000..90b3de6 --- /dev/null +++ b/docs/ccxt/wiki/index.html @@ -0,0 +1,69 @@ + + + + + ccxt - documentation + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + diff --git a/docs/ccxt/wiki/partials/body.hbs b/docs/ccxt/wiki/partials/body.hbs new file mode 100644 index 0000000..fa0c6dd --- /dev/null +++ b/docs/ccxt/wiki/partials/body.hbs @@ -0,0 +1,29 @@ +{{>deprecated~}} +{{>description~}} +{{>scope~}} +{{>summary~}} +{{>augments~}} +{{>implements~}} +{{>mixes~}} +{{>default~}} +{{>chainable~}} +{{>overrides~}} +{{>returns~}} +{{>category~}} +{{>throws~}} +{{>fires~}} +{{>this~}} +{{>access~}} +{{>readOnly~}} +{{>requires~}} +{{>customTags~}} +{{>see~}} +{{>since~}} +{{>version~}} +{{>authors~}} +{{>license~}} +{{>copyright~}} +{{>todo~}} +{{>params~}} +{{>properties~}} +{{>examples~}} diff --git a/docs/ccxt/wiki/partials/deprecated.hbs b/docs/ccxt/wiki/partials/deprecated.hbs new file mode 100644 index 0000000..8deb529 --- /dev/null +++ b/docs/ccxt/wiki/partials/deprecated.hbs @@ -0,0 +1,3 @@ +{{#if deprecated}}`DEPRECATED` + +{{/if~}} diff --git a/docs/ccxt/wiki/partials/docs.hbs b/docs/ccxt/wiki/partials/docs.hbs new file mode 100644 index 0000000..838f7d6 --- /dev/null +++ b/docs/ccxt/wiki/partials/docs.hbs @@ -0,0 +1,6 @@ +{{>header~}} +{{>body}} +##### Supported exchanges +{{>member-index-list~}} +{{>separator~}} +{{>members~}} diff --git a/docs/ccxt/wiki/partials/header.hbs b/docs/ccxt/wiki/partials/header.hbs new file mode 100644 index 0000000..6283947 --- /dev/null +++ b/docs/ccxt/wiki/partials/header.hbs @@ -0,0 +1,9 @@ + + + +{{#if exchange}} +{{>heading-indent}}[{{exchange}}](#{{getFragment this}}) +{{else}} +{{>heading-indent}}{{name}} +{{/if~}} + diff --git a/docs/ccxt/wiki/partials/member-index-list.hbs b/docs/ccxt/wiki/partials/member-index-list.hbs new file mode 100644 index 0000000..05c7b76 --- /dev/null +++ b/docs/ccxt/wiki/partials/member-index-list.hbs @@ -0,0 +1,6 @@ +{{#if (isFunction this)}} +* [{{exchange}}](#{{getFragment this}}) +{{/if}} +{{#indexChildren ~}} +{{>member-index-list~}} +{{/indexChildren}} diff --git a/docs/ccxt/wiki/partials/members.hbs b/docs/ccxt/wiki/partials/members.hbs new file mode 100644 index 0000000..c18d9f7 --- /dev/null +++ b/docs/ccxt/wiki/partials/members.hbs @@ -0,0 +1,9 @@ +{{#children inherited=undefined ~}} +{{>header~}} +{{>body}} + +```javascript +{{exchange}}.{{name}} ({{methodSig this}}) +``` + +{{/children~}} diff --git a/docs/ccxt/wiki/partials/params-table.hbs b/docs/ccxt/wiki/partials/params-table.hbs new file mode 100644 index 0000000..839fdb6 --- /dev/null +++ b/docs/ccxt/wiki/partials/params-table.hbs @@ -0,0 +1,12 @@ +{{#if params}} + +{{tableHead params "name|Param" "type|Type" "optional|Required" "description|Description" ~}} + +{{#tableRow params "name" "type" "optional" "description" ~}} +| {{#if @col1}}{{name}} | {{/if~}} +{{#if @col2}}{{>linked-type-list types=(cleanNames type.names) delimiter=", " }} | {{/if~}} +{{#if @col3}}{{#unless optional}}Yes{{else}}No{{/unless}} | {{/if~}} +{{#if @col4}}{{{stripNewlines (inlineLinks description)}}} |{{/if}} +{{/tableRow}} + +{{/if}} diff --git a/docs/ccxt/wiki/partials/returns.hbs b/docs/ccxt/wiki/partials/returns.hbs new file mode 100644 index 0000000..a068ddd --- /dev/null +++ b/docs/ccxt/wiki/partials/returns.hbs @@ -0,0 +1,12 @@ +{{#if returns}} +{{#if returns.[0].description~}} +**Returns**: {{#each returns~}} + {{#if type~}} + {{#if type.names}}{{>linked-type-list types=(cleanNames type.names) delimiter=" \| " ~}}{{/if}} + {{~#if description}} - {{{inlineLinks description}}}{{/if~}} + {{else~}} + {{{inlineLinks description}~}} + {{/if~}} +{{~/each}} + +{{/if}}{{/if}} diff --git a/docs/ccxt/wiki/spec.hbs b/docs/ccxt/wiki/spec.hbs new file mode 100644 index 0000000..768e111 --- /dev/null +++ b/docs/ccxt/wiki/spec.hbs @@ -0,0 +1 @@ +{{>all-docs}} diff --git a/src/cli/args.ts b/src/cli/args.ts index 68685c3..2a13814 100644 --- a/src/cli/args.ts +++ b/src/cli/args.ts @@ -4,7 +4,7 @@ export interface CliOptions { strategy?: StrategyId; silent: boolean; help: boolean; - exchange?: "aster" | "grvt" | "lighter"; + exchange?: "aster" | "grvt" | "lighter" | "backpack"; } const STRATEGY_VALUES = new Set(["trend", "maker", "offset-maker"]); @@ -68,7 +68,7 @@ function assignStrategy(options: CliOptions, raw: string): void { function assignExchange(options: CliOptions, raw: string): void { const normalized = raw.trim().toLowerCase(); if (!normalized) return; - if (normalized === "aster" || normalized === "grvt" || normalized === "lighter") { + if (normalized === "aster" || normalized === "grvt" || normalized === "lighter" || normalized === "backpack") { options.exchange = normalized as CliOptions["exchange"]; } else if (normalized === "gravity" || normalized === "grav" || normalized === "grv") { options.exchange = "grvt"; @@ -77,7 +77,7 @@ function assignExchange(options: CliOptions, raw: string): void { export function printCliHelp(): void { // eslint-disable-next-line no-console - console.log(`Usage: bun run index.ts [--strategy ] [--exchange ] [--silent]\n\n` + + console.log(`Usage: bun run index.ts [--strategy ] [--exchange ] [--silent]\n\n` + `Options:\n` + ` --strategy, -s Automatically start the specified strategy without the interactive menu.\n` + ` Aliases: offset, offset-maker for the offset maker engine.\n` + diff --git a/src/config.ts b/src/config.ts index 2af9dcb..17ef2ff 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,3 +1,18 @@ +/** + * Trading Configuration + * + * Environment Variables for Backpack Exchange: + * - BACKPACK_API_KEY: Required API key for Backpack + * - BACKPACK_API_SECRET: Required API secret for Backpack + * - BACKPACK_PASSWORD: Optional password for Backpack (if required) + * - BACKPACK_SUBACCOUNT: Optional subaccount name + * - BACKPACK_SYMBOL: Override symbol (defaults to TRADE_SYMBOL) + * - BACKPACK_SANDBOX: Set to "true" for sandbox mode + * - BACKPACK_DEBUG: Set to "true" for debug logging + * + * Usage: Set EXCHANGE=backpack to use Backpack exchange + */ + export interface TradingConfig { symbol: string; tradeAmount: number; diff --git a/src/exchanges/backpack/adapter.ts b/src/exchanges/backpack/adapter.ts new file mode 100644 index 0000000..4dae7d6 --- /dev/null +++ b/src/exchanges/backpack/adapter.ts @@ -0,0 +1,175 @@ +import type { + AccountListener, + DepthListener, + ExchangeAdapter, + KlineListener, + OrderListener, + TickerListener, +} from "../adapter"; +import type { AsterOrder, CreateOrderParams } from "../types"; +import { extractMessage } from "../../utils/errors"; +import { BackpackGateway, type BackpackGatewayOptions } from "./gateway"; + +export interface BackpackCredentials { + apiKey?: string; + apiSecret?: string; + password?: string; + subaccount?: string; + symbol?: string; + sandbox?: boolean; +} + +export class BackpackExchangeAdapter implements ExchangeAdapter { + readonly id = "backpack"; + private readonly gateway: BackpackGateway; + private readonly symbol: string; + private initPromise: Promise | null = null; + private readonly initContexts = new Set(); + private retryTimer: ReturnType | null = null; + private retryDelayMs = 3000; + private lastInitErrorAt = 0; + + constructor(credentials: BackpackCredentials = {}) { + const apiKey = credentials.apiKey ?? process.env.BACKPACK_API_KEY; + const apiSecret = credentials.apiSecret ?? process.env.BACKPACK_API_SECRET; + const password = credentials.password ?? process.env.BACKPACK_PASSWORD; + const subaccount = credentials.subaccount ?? process.env.BACKPACK_SUBACCOUNT; + const sandbox = credentials.sandbox ?? (process.env.BACKPACK_SANDBOX === "true"); + + const symbol = credentials.symbol ?? process.env.BACKPACK_SYMBOL ?? process.env.TRADE_SYMBOL ?? "BTCUSDC"; + + if (!apiKey || !apiSecret) { + throw new Error("BACKPACK_API_KEY and BACKPACK_API_SECRET environment variables are required"); + } + + const gatewayOptions: BackpackGatewayOptions = { + apiKey, + apiSecret, + password, + subaccount, + symbol, + sandbox, + logger: (context, error) => this.logError(context, error), + }; + + this.gateway = new BackpackGateway(gatewayOptions); + this.symbol = symbol; + } + + supportsTrailingStops(): boolean { + return false; // TODO: Check if Backpack supports trailing stops via ccxt + } + + watchAccount(cb: AccountListener): void { + void this.ensureInitialized("watchAccount"); + this.gateway.onAccount(this.safeInvoke("watchAccount", cb)); + } + + watchOrders(cb: OrderListener): void { + void this.ensureInitialized("watchOrders"); + this.gateway.onOrders(this.safeInvoke("watchOrders", cb)); + } + + watchDepth(_symbol: string, cb: DepthListener): void { + void this.ensureInitialized("watchDepth"); + this.gateway.onDepth(this.safeInvoke("watchDepth", cb)); + } + + watchTicker(_symbol: string, cb: TickerListener): void { + void this.ensureInitialized("watchTicker"); + this.gateway.onTicker(this.safeInvoke("watchTicker", cb)); + } + + watchKlines(_symbol: string, interval: string, cb: KlineListener): void { + void this.ensureInitialized(`watchKlines:${interval}`); + this.gateway.watchKlines(interval, this.safeInvoke("watchKlines", cb)); + } + + async createOrder(params: CreateOrderParams): Promise { + await this.ensureInitialized("createOrder"); + return this.gateway.createOrder(params); + } + + async cancelOrder(params: { symbol: string; orderId: number | string }): Promise { + await this.ensureInitialized("cancelOrder"); + await this.gateway.cancelOrder({ orderId: params.orderId }); + } + + async cancelOrders(params: { symbol: string; orderIdList: Array }): Promise { + await this.ensureInitialized("cancelOrders"); + await this.gateway.cancelOrders({ orderIdList: params.orderIdList }); + } + + async cancelAllOrders(_params: { symbol: string }): Promise { + await this.ensureInitialized("cancelAllOrders"); + await this.gateway.cancelAllOrders(); + } + + private safeInvoke void>(context: string, cb: T): T { + const wrapped = ((...args: any[]) => { + try { + cb(...args); + } catch (error) { + console.error(`[BackpackExchangeAdapter] ${context} handler failed: ${extractMessage(error)}`); + } + }) as T; + return wrapped; + } + + private ensureInitialized(context?: string): Promise { + if (!this.initPromise) { + this.initContexts.clear(); + this.initPromise = this.gateway + .ensureInitialized(this.symbol) + .then((value) => { + this.clearRetry(); + return value; + }) + .catch((error) => { + this.handleInitError("initialize", error); + this.initPromise = null; + this.scheduleRetry(); + throw error; + }); + } + if (context && !this.initContexts.has(context)) { + this.initContexts.add(context); + this.initPromise.catch((error) => { + this.handleInitError(context, error); + this.scheduleRetry(); + }); + } + return this.initPromise; + } + + private scheduleRetry(): void { + if (this.retryTimer) return; + this.retryTimer = setTimeout(() => { + this.retryTimer = null; + if (this.initPromise) return; + this.retryDelayMs = Math.min(this.retryDelayMs * 2, 60_000); + void this.ensureInitialized("retry"); + }, this.retryDelayMs); + } + + private clearRetry(): void { + if (this.retryTimer) { + clearTimeout(this.retryTimer); + this.retryTimer = null; + } + this.retryDelayMs = 3000; + } + + private handleInitError(context: string, error: unknown): void { + const now = Date.now(); + if (now - this.lastInitErrorAt < 5000) return; + this.lastInitErrorAt = now; + console.error(`[BackpackExchangeAdapter] ${context} failed`, error); + } + + private logError(context: string, error: unknown): void { + if (process.env.BACKPACK_DEBUG === "1" || process.env.BACKPACK_DEBUG === "true") { + console.error(`[BackpackExchangeAdapter] ${context} failed: ${extractMessage(error)}`); + } + } +} diff --git a/src/exchanges/backpack/gateway.ts b/src/exchanges/backpack/gateway.ts new file mode 100644 index 0000000..4d52bbf --- /dev/null +++ b/src/exchanges/backpack/gateway.ts @@ -0,0 +1,504 @@ +import ccxt, { type Balances, type Order as CcxtOrder, type OrderBook as CcxtOrderBook, type Ticker as CcxtTicker } from "ccxt"; +import type { + AsterAccountSnapshot, + AsterOrder, + AsterDepth, + AsterTicker, + AsterKline, + CreateOrderParams, + OrderType, +} from "../types"; +import type { + AccountListener, + OrderListener, + DepthListener, + TickerListener, + KlineListener, +} from "../adapter"; + +export interface BackpackGatewayOptions { + apiKey?: string; + apiSecret?: string; + password?: string; + subaccount?: string; + symbol: string; + sandbox?: boolean; + logger?: (context: string, error: unknown) => void; +} + +export class BackpackGateway { + private readonly exchange: any; + private readonly symbol: string; + private marketSymbol: string; + private readonly logger: (context: string, error: unknown) => void; + private initialized = false; + private initPromise: Promise | null = null; + + // Event listeners + private accountListeners = new Set(); + private orderListeners = new Set(); + private depthListeners = new Set(); + private tickerListeners = new Set(); + private klineListeners = new Set<{ interval: string; callback: KlineListener }>(); + + // Polling intervals + private accountPollTimer: NodeJS.Timeout | null = null; + private orderPollTimer: NodeJS.Timeout | null = null; + private depthPollTimer: NodeJS.Timeout | null = null; + private tickerPollTimer: NodeJS.Timeout | null = null; + private klinePollTimers = new Map(); + + // WebSocket streams + private wsOrderBook: any = null; + private wsTicker: any = null; + private wsKlines = new Map(); + private wsOrders: any = null; + private wsBalance: any = null; + + constructor(options: BackpackGatewayOptions) { + this.symbol = options.symbol.toUpperCase(); + this.marketSymbol = this.symbol; + this.logger = options.logger ?? ((context, error) => console.error(`[BackpackGateway] ${context}:`, error)); + + // dynamic constructor for specific exchange + this.exchange = new (ccxt as any).backpack({ + apiKey: options.apiKey, + secret: options.apiSecret, + password: options.password, + subaccount: options.subaccount, + sandbox: options.sandbox ?? false, + enableRateLimit: true, + timeout: 30000, + }); + } + + async ensureInitialized(symbol?: string): Promise { + if (this.initialized) return; + + if (this.initPromise) return this.initPromise; + + this.initPromise = this.doInitialize(symbol); + return this.initPromise; + } + + private async doInitialize(symbol?: string): Promise { + try { + await this.exchange.loadMarkets(); + + // Verify symbol exists + const requested = (symbol ?? this.symbol).toUpperCase(); + const resolved = this.resolveMarketSymbol(requested); + if (!resolved) { + throw new Error(`Symbol ${requested} not found in Backpack markets`); + } + this.marketSymbol = resolved; + + this.initialized = true; + this.logger("initialize", `Backpack gateway initialized for ${this.marketSymbol}`); + } catch (error) { + this.logger("initialize", error); + throw error; + } + } + + private resolveMarketSymbol(requested: string): string | null { + // normalize helpers (strip non-alphanumerics for robust comparisons) + const strip = (v: string | undefined | null) => (v ?? "").toUpperCase().replace(/[^A-Z0-9]/g, ""); + + // Backpack uses USDC quote; accept common USD/USDT aliases in user input + const normalizeUsdAlias = (v: string) => { + const up = v.toUpperCase(); + // Replace ...USD... or ...USDT... (optionally before _ or PERP or end) with USDC + // Examples: BTCUSDPERP -> BTCUSDCPERP, BTCUSD -> BTCUSDC, BTC_USDT_PERP -> BTC_USDC_PERP + return up + .replace(/USDT(?=(?:[_-]?PERP)?$)/, "USDC") + .replace(/USD(?=(?:[_-]?PERP)?$)/, "USDC"); + }; + + const requestedWithUsdc = normalizeUsdAlias(requested); + const compactRequested = strip(requestedWithUsdc); + + // 1) exact key in markets (e.g. "BTC/USDC" or "BTC/USDC:USDC") + if (this.exchange.markets[requestedWithUsdc]) return requestedWithUsdc; + + // 2) direct markets_by_id lookup by exact id + const byId = (this.exchange as any).markets_by_id ?? {}; + if (byId[requestedWithUsdc]) return byId[requestedWithUsdc].symbol; + + // 3) flexible lookup: compare compacted forms against ids, symbols, and base+quote + const markets = Object.values(this.exchange.markets) as Array; + for (const m of markets) { + const idCompact = strip(m.id as string); + const symbolCompact = strip(m.symbol as string); + const baseQuoteCompact = strip((m.base as string) + (m.quote as string)); + if (idCompact === compactRequested) return m.symbol; + if (symbolCompact === compactRequested) return m.symbol; + if (baseQuoteCompact === compactRequested) return m.symbol; + } + + // 4) try matching against markets_by_id keys by compacted form + for (const key of Object.keys(byId)) { + if (strip(key) === compactRequested) return byId[key].symbol; + } + + return null; + } + + private normalizeTimeframe(interval: string): string { + const timeframeMap: Record = { + "1m": "1m", + "5m": "5m", + "15m": "15m", + "1h": "1h", + "4h": "4h", + "1d": "1d", + }; + return timeframeMap[interval] || "1m"; + } + + // Event subscription methods + onAccount(callback: AccountListener): void { + this.accountListeners.add(callback); + this.startAccountPolling(); + } + + onOrders(callback: OrderListener): void { + this.orderListeners.add(callback); + this.startOrderPolling(); + } + + onDepth(callback: DepthListener): void { + this.depthListeners.add(callback); + this.startDepthPolling(); + } + + onTicker(callback: TickerListener): void { + this.tickerListeners.add(callback); + this.startTickerPolling(); + } + + watchKlines(interval: string, callback: KlineListener): void { + const normalizedInterval = this.normalizeTimeframe(interval); + this.klineListeners.add({ interval: normalizedInterval, callback }); + this.startKlinePolling(normalizedInterval); + } + + // Polling implementations + private startAccountPolling(): void { + if (this.accountPollTimer) return; + + const poll = async () => { + try { + const balance = await this.exchange.fetchBalance(); + const accountSnapshot = this.mapBalanceToAccountSnapshot(balance); + + for (const listener of this.accountListeners) { + listener(accountSnapshot); + } + } catch (error) { + this.logger("accountPoll", error); + } + }; + + poll(); // Initial fetch + this.accountPollTimer = setInterval(poll, 5000); // Poll every 5 seconds + } + + private startOrderPolling(): void { + if (this.orderPollTimer) return; + + const poll = async () => { + try { + const [openOrders, closedOrders] = await Promise.all([ + this.exchange.fetchOpenOrders(this.marketSymbol), + this.exchange.fetchClosedOrders(this.marketSymbol, undefined, 50), // Last 50 closed orders + ]); + + const allOrders = [...openOrders, ...closedOrders]; + const mappedOrders = allOrders.map(order => this.mapOrderToAsterOrder(order)); + + for (const listener of this.orderListeners) { + listener(mappedOrders); + } + } catch (error) { + this.logger("orderPoll", error); + } + }; + + poll(); // Initial fetch + this.orderPollTimer = setInterval(poll, 2000); // Poll every 2 seconds + } + + private startDepthPolling(): void { + if (this.depthPollTimer) return; + + const poll = async () => { + try { + const orderbook = await this.exchange.fetchOrderBook(this.marketSymbol, 20); + const depth = this.mapOrderBookToDepth(orderbook); + + for (const listener of this.depthListeners) { + listener(depth); + } + } catch (error) { + this.logger("depthPoll", error); + } + }; + + poll(); // Initial fetch + this.depthPollTimer = setInterval(poll, 1000); // Poll every 1 second + } + + private startTickerPolling(): void { + if (this.tickerPollTimer) return; + + const poll = async () => { + try { + const ticker = await this.exchange.fetchTicker(this.marketSymbol); + const asterTicker = this.mapTickerToAsterTicker(ticker); + + for (const listener of this.tickerListeners) { + listener(asterTicker); + } + } catch (error) { + this.logger("tickerPoll", error); + } + }; + + poll(); // Initial fetch + this.tickerPollTimer = setInterval(poll, 2000); // Poll every 2 seconds + } + + private startKlinePolling(interval: string): void { + if (this.klinePollTimers.has(interval)) return; + + const poll = async () => { + try { + const ohlcv = await this.exchange.fetchOHLCV(this.marketSymbol, interval, undefined, 100); + const klines = (ohlcv as number[][]) + .filter((c) => Array.isArray(c) && c.length >= 6) + .map((c) => this.mapOHLCVToKline([c[0], c[1], c[2], c[3], c[4], c[5]] as [number, number, number, number, number, number], interval)); + + for (const listener of this.klineListeners) { + if (listener.interval === interval) { + listener.callback(klines); + } + } + } catch (error) { + this.logger("klinePoll", error); + } + }; + + poll(); // Initial fetch + this.klinePollTimers.set(interval, setInterval(poll, 5000)); // Poll every 5 seconds + } + + // Order management + async createOrder(params: CreateOrderParams): Promise { + await this.ensureInitialized(); + + // Only pass exchange-specific params in the last argument so we don't + // override ccxt's internal request mapping (e.g. side mapping for Backpack). + const symbol = this.marketSymbol; + const type = this.mapOrderTypeToCcxt(params.type); + const side = params.side.toLowerCase(); + const amount = params.quantity; + const price = params.price; + + const extraParams: Record = {}; + if (params.stopPrice !== undefined) extraParams.stopPrice = params.stopPrice; + // Map GTX (post-only) to Backpack's postOnly boolean and use GTC as TIF + if (params.timeInForce === "GTX") { + extraParams.postOnly = true; + extraParams.timeInForce = "GTC"; + } else if (params.timeInForce !== undefined) { + extraParams.timeInForce = params.timeInForce; // GTC, IOC, FOK + } + // Reduce-only string boolean -> boolean per OpenAPI + if (params.reduceOnly !== undefined) { + extraParams.reduceOnly = params.reduceOnly === "true"; + } + + const order = await this.exchange.createOrder( + symbol, + type, + side, + amount, + price, + extraParams + ); + + return this.mapOrderToAsterOrder(order); + } + + async cancelOrder(params: { orderId: number | string }): Promise { + await this.exchange.cancelOrder(params.orderId.toString(), this.marketSymbol); + } + + async cancelOrders(params: { orderIdList: Array }): Promise { + await Promise.all( + params.orderIdList.map(orderId => + this.exchange.cancelOrder(orderId.toString(), this.marketSymbol) + ) + ); + } + + async cancelAllOrders(): Promise { + try { + if (typeof (this.exchange as any).cancelAllOrders === "function") { + await (this.exchange as any).cancelAllOrders(this.marketSymbol); + return; + } + } catch { + // fall through to manual cancel + } + const open = await this.exchange.fetchOpenOrders(this.marketSymbol); + for (const o of open) { + await this.exchange.cancelOrder(o.id as string, this.marketSymbol); + } + } + + // Mapping functions + private mapBalanceToAccountSnapshot(balance: Balances): AsterAccountSnapshot { + const positions: any[] = []; // Backpack is spot-only, no positions + const assets: any[] = []; + + for (const [currency, amount] of Object.entries(balance)) { + if (typeof amount === 'object' && amount !== null) { + assets.push({ + asset: currency, + walletBalance: amount.total?.toString() || "0", + availableBalance: amount.free?.toString() || "0", + updateTime: Date.now(), + }); + } + } + + return { + canTrade: true, + canDeposit: true, + canWithdraw: true, + updateTime: Date.now(), + totalWalletBalance: balance.total?.toString() || "0", + totalUnrealizedProfit: "0", + positions, + assets, + }; + } + + private mapOrderToAsterOrder(order: CcxtOrder): AsterOrder { + const side = (order.side ?? "buy").toUpperCase() as "BUY" | "SELL"; + const mappedType = this.mapCcxtOrderTypeToAster(order.type); + return { + orderId: String(order.id ?? ""), + clientOrderId: (order.clientOrderId as any as string) || "", + symbol: order.symbol || this.marketSymbol, + side, + type: mappedType, + status: (order.status as any as string) || "", + price: order.price?.toString() || "0", + origQty: order.amount?.toString() || "0", + executedQty: order.filled?.toString() || "0", + stopPrice: order.stopPrice?.toString() || "0", + time: order.timestamp || Date.now(), + updateTime: order.lastUpdateTimestamp || Date.now(), + reduceOnly: false, + closePosition: false, + avgPrice: order.average?.toString(), + cumQuote: order.cost?.toString(), + }; + } + + private mapOrderBookToDepth(orderbook: CcxtOrderBook): AsterDepth { + return { + lastUpdateId: orderbook.nonce || Date.now(), + bids: (orderbook.bids || []).filter((t) => t && t.length >= 2).map(([price, amount]) => [String(price ?? 0), String(amount ?? 0)]), + asks: (orderbook.asks || []).filter((t) => t && t.length >= 2).map(([price, amount]) => [String(price ?? 0), String(amount ?? 0)]), + eventTime: orderbook.timestamp, + }; + } + + private mapTickerToAsterTicker(ticker: CcxtTicker): AsterTicker { + return { + symbol: ticker.symbol, + lastPrice: ticker.last?.toString() || "0", + openPrice: ticker.open?.toString() || "0", + highPrice: ticker.high?.toString() || "0", + lowPrice: ticker.low?.toString() || "0", + volume: ticker.baseVolume?.toString() || "0", + quoteVolume: ticker.quoteVolume?.toString() || "0", + eventTime: ticker.timestamp, + }; + } + + private mapOHLCVToKline(candle: [number, number, number, number, number, number], interval: string): AsterKline { + const [timestamp, open, high, low, close, volume] = candle; + return { + openTime: timestamp, + closeTime: timestamp + this.getIntervalMs(interval), + open: open.toString(), + high: high.toString(), + low: low.toString(), + close: close.toString(), + volume: volume.toString(), + numberOfTrades: 0, + }; + } + + private mapOrderTypeToCcxt(type: string): string { + const typeMap: Record = { + "LIMIT": "limit", + "MARKET": "market", + "STOP_MARKET": "stop", + "TRAILING_STOP_MARKET": "trailing-stop", + }; + return typeMap[type] || "limit"; + } + + private mapCcxtOrderTypeToAster(type: string | undefined): OrderType { + const typeMap: Record = { + "limit": "LIMIT", + "market": "MARKET", + "stop": "STOP_MARKET", + "trailing-stop": "TRAILING_STOP_MARKET", + }; + return type ? (typeMap[type] ?? "LIMIT") : "LIMIT"; + } + + private getIntervalMs(interval: string): number { + const intervalMap: Record = { + "1m": 60 * 1000, + "5m": 5 * 60 * 1000, + "15m": 15 * 60 * 1000, + "1h": 60 * 60 * 1000, + "4h": 4 * 60 * 60 * 1000, + "1d": 24 * 60 * 60 * 1000, + }; + return intervalMap[interval] || 60 * 1000; + } + + // Cleanup + destroy(): void { + if (this.accountPollTimer) { + clearInterval(this.accountPollTimer); + this.accountPollTimer = null; + } + if (this.orderPollTimer) { + clearInterval(this.orderPollTimer); + this.orderPollTimer = null; + } + if (this.depthPollTimer) { + clearInterval(this.depthPollTimer); + this.depthPollTimer = null; + } + if (this.tickerPollTimer) { + clearInterval(this.tickerPollTimer); + this.tickerPollTimer = null; + } + + for (const timer of this.klinePollTimers.values()) { + clearInterval(timer); + } + this.klinePollTimers.clear(); + } +} diff --git a/src/exchanges/create-adapter.ts b/src/exchanges/create-adapter.ts index 5bc250d..93e4909 100644 --- a/src/exchanges/create-adapter.ts +++ b/src/exchanges/create-adapter.ts @@ -2,6 +2,7 @@ import type { ExchangeAdapter } from "./adapter"; import { AsterExchangeAdapter, type AsterCredentials } from "./aster-adapter"; import { GrvtExchangeAdapter, type GrvtCredentials } from "./grvt/adapter"; import { LighterExchangeAdapter, type LighterCredentials } from "./lighter/adapter"; +import { BackpackExchangeAdapter, type BackpackCredentials } from "./backpack/adapter"; export interface ExchangeFactoryOptions { symbol: string; @@ -9,9 +10,10 @@ export interface ExchangeFactoryOptions { aster?: AsterCredentials; grvt?: GrvtCredentials; lighter?: LighterCredentials; + backpack?: BackpackCredentials; } -export type SupportedExchangeId = "aster" | "grvt" | "lighter"; +export type SupportedExchangeId = "aster" | "grvt" | "lighter" | "backpack"; export function resolveExchangeId(value?: string | null): SupportedExchangeId { const fallback = (value ?? process.env.EXCHANGE ?? process.env.TRADE_EXCHANGE ?? "aster") @@ -20,12 +22,14 @@ export function resolveExchangeId(value?: string | null): SupportedExchangeId { .toLowerCase(); if (fallback === "grvt") return "grvt"; if (fallback === "lighter") return "lighter"; + if (fallback === "backpack") return "backpack"; return "aster"; } export function getExchangeDisplayName(id: SupportedExchangeId): string { if (id === "grvt") return "GRVT"; if (id === "lighter") return "Lighter"; + if (id === "backpack") return "Backpack"; return "AsterDex"; } @@ -37,5 +41,8 @@ export function createExchangeAdapter(options: ExchangeFactoryOptions): Exchange if (id === "lighter") { return new LighterExchangeAdapter({ ...options.lighter, displaySymbol: options.symbol }); } + if (id === "backpack") { + return new BackpackExchangeAdapter({ ...options.backpack, symbol: options.symbol }); + } return new AsterExchangeAdapter({ ...options.aster, symbol: options.symbol }); } diff --git a/tests/exchange-factory.test.ts b/tests/exchange-factory.test.ts index dec33ab..d079def 100644 --- a/tests/exchange-factory.test.ts +++ b/tests/exchange-factory.test.ts @@ -2,6 +2,7 @@ import { describe, expect, it, beforeEach, afterEach } from "vitest"; import { createExchangeAdapter, resolveExchangeId } from "../src/exchanges/create-adapter"; import { AsterExchangeAdapter } from "../src/exchanges/aster-adapter"; import { GrvtExchangeAdapter } from "../src/exchanges/grvt/adapter"; +import { BackpackExchangeAdapter } from "../src/exchanges/backpack/adapter"; const ORIGINAL_ENV = { ...process.env }; @@ -26,6 +27,7 @@ describe("exchange factory", () => { it("resolves exchange id case-insensitively", () => { expect(resolveExchangeId("Grvt")).toBe("grvt"); expect(resolveExchangeId("ASTER")).toBe("aster"); + expect(resolveExchangeId("BACKPACK")).toBe("backpack"); }); it("creates grvt adapter when EXCHANGE=grvt", () => { @@ -41,4 +43,15 @@ describe("exchange factory", () => { expect(adapter).toBeInstanceOf(GrvtExchangeAdapter); expect(adapter.id).toBe("grvt"); }); + + it("creates backpack adapter when EXCHANGE=backpack", () => { + process.env.EXCHANGE = "backpack"; + process.env.BACKPACK_API_KEY = "api-key"; + process.env.BACKPACK_API_SECRET = "secret"; + process.env.TRADE_SYMBOL = "BTCUSDC"; + + const adapter = createExchangeAdapter({ symbol: "BTCUSDC" }); + expect(adapter).toBeInstanceOf(BackpackExchangeAdapter); + expect(adapter.id).toBe("backpack"); + }); });